Пример #1
0
        public static string GetEventJson(this SkippyMessage message, string deviceId)
        {
            // There is a bug in some FW versions which results in the deviceId being reported by the
            // device not being reliable.  So we just overwrite it here with what the device registerred
            // against the server with.
            var jsonObject = JObject.Parse(message.ToJson());

            jsonObject["device"]["deviceId"] = deviceId;

            return(jsonObject.ToString(Formatting.None));
        }
Пример #2
0
        public static string GetEventType(this SkippyMessage message)
        {
            switch (message.Reason)
            {
            case SkippyMessage.Types.ReasonForMessage.ALARM:
                return("alarm");

            case SkippyMessage.Types.ReasonForMessage.SIGN_ON:
                return("startup");

            case SkippyMessage.Types.ReasonForMessage.SAMPLE_PERIOD:
            default:
                return("heartbeat");
            }
        }