コード例 #1
0
        private int Acknowledge_Alarm_Encode(ref Byte[] apdu, Byte invoke_id, ref ACKNOWLEDGE_ALARM_DATA Ack_data, int pos)
        {
            int len      = 0;   /* length of each encoding */
            int apdu_len = 0;

            apdu[pos + 0] = (byte)BACNET_PDU_TYPE.PDU_TYPE_CONFIRMED_SERVICE_REQUEST;
            apdu[pos + 1] = BasicalProcessor.Encode_MaxSegsandApdu(0, 1476);
            apdu[pos + 2] = invoke_id;
            apdu[pos + 3] = (byte)BACNET_CONFIRMED_SERVICE.SERVICE_CONFIRMED_ACKNOWLEDGE_ALARM;
            apdu_len      = 4;

            /* tag 0 - processIdentifier */
            len       = BasicalProcessor.Encode_Context_Unsigned(ref apdu, 0, Ack_data.ProcessIdentifier, pos + apdu_len);
            apdu_len += len;
            /* tag 1 - eventObjectIdentifier */
            len       = BasicalProcessor.Encode_Context_ObjectId(ref apdu, 1, (int)Ack_data.EventIdentifier.type, Ack_data.EventIdentifier.instance, pos + apdu_len);
            apdu_len += len;
            /* tag 2 - toState */
            len       = BasicalProcessor.Encode_Context_Enumerate(ref apdu, 2, (uint)Ack_data.StateAcknowledged, apdu_len + pos);
            apdu_len += len;
            /* tag 3 - timeStamp */
            len       = BasicalProcessor.Encode_Context_Timestamp(ref apdu, 3, ref Ack_data.TimeStamp, pos + apdu_len);
            apdu_len += len;
            /* tag 4 - Acknowledgment Source */

            len       = BasicalProcessor.Encode_Context_Character_String(ref apdu, 4, ref Ack_data.Source, pos + apdu_len);
            apdu_len += len;
            /* tag 5- timeStamp */
            len       = BasicalProcessor.Encode_Context_Timestamp(ref apdu, 5, ref Ack_data.TimeOfAcknowledgment, pos + apdu_len);
            apdu_len += len;
            return(apdu_len);
        }