Пример #1
0
        private ControlSystemTelemetryMessage BuildTelemetry()
        {
            TelemetryMessage.DeviceStatus currentStatus = TelemetryMessage.DeviceStatus.online; //TODO: Get device's real status

            ControlSystemTelemetryMessage tMsg = new ControlSystemTelemetryMessage(currentStatus, DeviceSettings.LIBRARY_FW_VERSION);

            tMsg.common.occupied = true;    //This is an example for adding occupancy imnformation to the device's telemetry data.

            //TODO: Based on your device type, add additioanl telemetry fields, and update their data

            return(tMsg);
        }
Пример #2
0
        /// <summary>
        /// Send the global telemetry message to the server
        /// </summary>
        /// <param name="tMsg"></param>
        /// <returns>Telemetry response or null</returns>
        private TelemetryResponse SendTelemetry(ControlSystemTelemetryMessage tMsg)
        {
            try
            {
                return(_cloudApi.SendTelemetry(tMsg));
            }

            catch (DeviceNotAuthorizedException)
            {
                RegisterControlSystem();
                return(null);
            }
        }