Ejemplo n.º 1
0
        public GetDevicesMessage GetDevices()
        {
            var response = PimaticRestClient.PerformHttpGet("/api/devices");
            var devices  = JsonConvert.DeserializeObject <GetDevicesMessage>(GetResultMessage(response));

            if (!devices.devices.Any() || devices.devices == null)
            {
                throw new PimaticException("E_PIM_SVC.003", "No devices found");
            }

            return(devices);
        }
Ejemplo n.º 2
0
        public GetDeviceByIdMessage GetDeviceById(string deviceId)
        {
            var response = PimaticRestClient.PerformHttpGet("/api/devices/" + deviceId);
            var device   = JsonConvert.DeserializeObject <GetDeviceByIdMessage>(GetResultMessage(response));

            if (device != null)
            {
                if (device.device == null)
                {
                    throw new PimaticException("E_PIM_SVC.005", "Device could not be found for deviceId {0}", deviceId);
                }
            }

            return(device);
        }
Ejemplo n.º 3
0
        public GetPageByIdMessage GetPageById(string pageId)
        {
            var response           = PimaticRestClient.PerformHttpGet("/api/pages/" + pageId);
            var getPageByIdMessage = JsonConvert.DeserializeObject <GetPageByIdMessage>(GetResultMessage(response));

            if (getPageByIdMessage != null)
            {
                if (getPageByIdMessage.page == null)
                {
                    throw new PimaticException("E_PIM_SVC.004", "Page for pageId {0} could not be captured", pageId);
                }
            }

            return(getPageByIdMessage);
        }
Ejemplo n.º 4
0
        public GetVariablesMessage GetVariables()
        {
            var response = PimaticRestClient.PerformHttpGet("/api/variables");

            return(JsonConvert.DeserializeObject <GetVariablesMessage>(GetResultMessage(response)));
        }
Ejemplo n.º 5
0
        public GetDeviceClassConfigSchemaMessage GetDeviceClassConfigSchema(string className)
        {
            var response = PimaticRestClient.PerformHttpGet("/api/device-class/" + className);

            return(JsonConvert.DeserializeObject <GetDeviceClassConfigSchemaMessage>(GetResultMessage(response)));
        }
Ejemplo n.º 6
0
        public GetGuiSettingsMessage GetGuiSetttings()
        {
            var response = PimaticRestClient.PerformHttpGet("/api/config/settings/gui");

            return(JsonConvert.DeserializeObject <GetGuiSettingsMessage>(GetResultMessage(response)));
        }
Ejemplo n.º 7
0
        public GetConfigMessage GetConfig()
        {
            var response = PimaticRestClient.PerformHttpGet("/api/config?password=" + PimaticSettings.Password);

            return(JsonConvert.DeserializeObject <GetConfigMessage>(GetResultMessage(response)));
        }