Esempio n. 1
0
        /// <summary>
        /// Gets the event found in byte zero of the payload if the packet is a notification event packet.
        /// </summary>
        /// <returns>The event code according to GAIA.NotificationEvents</returns>
        public GAIA.NotificationEvents GetNotificationEvent()
        {
            int EVENT_OFFSET = 0;
            int EVENT_LENGTH = 1;

            if ((CommandId & GAIA.COMMANDS_NOTIFICATION_MASK) < 1 || Payload == null || Payload.Length < EVENT_LENGTH)
            {
                return(GAIA.NotificationEvents.NOT_NOTIFICATION);
            }
            else
            {
                return(GAIA.GetNotificationEvent(Payload[EVENT_OFFSET]));
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Gets the status byte from the payload of an acknowledgement packet.
        /// By convention in acknowledgement packets the first byte contains the command status or 'result' of the command.
        /// Additional data may be present in the acknowledgement packet, as defined by individual commands.
        /// </summary>
        /// <returns>The status code as defined in GAIA.Status.</returns>
        public GAIA.Status GetStatus()
        {
            int STATUS_OFFSET = 0;
            int STATUS_LENGTH = 1;

            if (!IsAcknowledgement() || Payload == null || Payload.Length < STATUS_LENGTH)
            {
                return(GAIA.Status.NOT_STATUS);
            }
            else
            {
                return(GAIA.GetStatus(Payload[STATUS_OFFSET]));
            }
        }