Ejemplo n.º 1
0
        // Constructor
        public Authentication(MobiControlApiConfig config, CancellationToken cancellationToken, HttpClient httpClient)
        {
            this.cancellationToken = cancellationToken;
            this.httpClient        = httpClient;

            this.baseUri = new Uri("https://" + config.FQDN);

            // Save config
            this.config = config;

            //grant_type=password&username=Administrator&password=1
            grant_type = "grant_type=password&username="******"&password=" + config.Password;
        }
Ejemplo n.º 2
0
        //

        // Main constructor
        public Api(MobiControlApiConfig mobiControlApiConfig, TelemetryClient tc, CancellationToken cancellationToken, HttpClient httpClient)
        {
            // Save
            this.tc = tc;
            this.httpClientInstance = httpClient;
            this.cancellationToken  = cancellationToken;

            // Create config object
            config = mobiControlApiConfig;

            // Create SOTI Authentication object
            authentication = new Authentication(config, cancellationToken, httpClient);

            // Initiate the HTTP Client
            Init_httpClient();
        }
Ejemplo n.º 3
0
        //

        // Main constructor
        public Api(MobiControlApiConfig mobiControlApiConfig, TelemetryClient tc, CancellationToken ct)
        {
            this.tc = tc;

            // Create config object
            config = mobiControlApiConfig;

            // Save CancellationToken
            cancellationToken = ct;

            // Create SOTI Authentication object
            authentication = new Authentication(config, cancellationToken);

            // Initiate the HTTP Client
            Init_httpClient();
        }
Ejemplo n.º 4
0
        // Constructor
        public MonitorSotiFolders(MobiControlApiConfig mobiControlApiConfig, List <MonitorSotiFolderConfig> listMonitorSotiFolderConfig, TelemetryClient tc, CancellationToken token)
        {
            this.token = token;
            this.tc    = tc;
            this.listMonitorSotiFolderConfig = listMonitorSotiFolderConfig;
            this.MobiControlApiConfig        = mobiControlApiConfig;

            // Start a task for each SOTI folder to be monitored
            listMonitorSotiFolder = new List <MonitorSotiFolder>();

            // Create task list for each SOTI folder to be monitored
            foreach (MonitorSotiFolderConfig folder in listMonitorSotiFolderConfig)
            {
                // Start monitoring folder but dont pass any know devices i.e. on start (or restart) all will come up as new devices
                MonitorSotiFolder monitorSotiGroup = new MonitorSotiFolder(folder, null, tc, token);
                monitorSotiGroup.NewDeviceList     += MonitorSotiGroup_NewDeviceList;
                monitorSotiGroup.RemovedDeviceList += MonitorSotiGroup_RemovedDeviceList;
                listMonitorSotiFolder.Add(monitorSotiGroup);
            }

            // Validate connnection to the MC server
            mcApi = new Api(mobiControlApiConfig, tc, token);
        }
Ejemplo n.º 5
0
 public Api(string jsonConfig, TelemetryClient tc, CancellationToken ct)
     : this(MobiControlApiConfig.GetConfigFromJsonString(jsonConfig), tc, ct)
 {
 }
Ejemplo n.º 6
0
 public Api(JObject jsonConfig, TelemetryClient tc, CancellationToken ct)
     : this(MobiControlApiConfig.GetConfigFromJObject(jsonConfig), tc, ct)
 {
 }