meh - 2009-08-02

I'm not sure that I understand this.  The first part would be the network stuff (N) and the second part is the PDU.

Looks something like this.

            // BVLC Part
          
            //ANNEX J - BACnet/IP (NORMATIVE)

            // http://www.bacnetwiki.com/wiki/index.php?title=BACnet_Virtual_Link_Control
            //pdu-type [0] Unsigned (0..15), -- 0 for this PDU type
            data[optr++] = BACnetEnums.BACNET_BVLC_TYPE_BIP;                                    //Type
            data[optr++] = (byte)BACnetEnums.BACNET_BVLC_FUNCTION.BVLC_ORIGINAL_BROADCAST_NPDU; //Function
            data[optr++] = 0x00;        // Length (2 octets) bvlc.length
            data[optr++] = 0x0c;        //  bvlc.length
            //
            /*
           The format of the BACnet-Confirmed-Request-PDU is:
            Bit Number:   7   6   5   4   3   2   1   0
                        |---|---|---|---|---|---|---|---|
                        | PDU Type  |   |SEG|MOR| SA| 0 |
                        |---|---|---|---|---|---|---|---|
                        | 0 |  Max Segs |  Max Resp     |
                        |---|---|---|---|---|---|---|---|
                        |             Invoke ID         |
                        |---|---|---|---|---|---|---|---|
                        |       Sequence Number         |    Only present if SEG = 1
                        |---|---|---|---|---|---|---|---|
                        |      Proposed Window Size     |    Only present if SEG = 1
                        |---|---|---|---|---|---|---|---|
                        |        Service Choice         |
                        |---|---|---|---|---|---|---|---|
                        |       Service Request         |
                        |               .               |
                        |               .               |
                        |               .               |
                        |---|---|---|---|---|---|---|---|
                       The PDU fields have the following values:
             *
                       PDU Type =       0 (BACnet-Confirmed-Service-Request-PDU)
                            SEG =       0 (Unsegmented Request)
                                        1 (Segmented Request)
                            MOR =       0 (No More Segments Follow)
                                        1 (More Segments Follow)
                             SA =       0 (Segmented Response not accepted)
                                        1 (Segmented Response accepted)
                       Max Segs =       (0..7) (Number of response segments accepted per 20.1.2.4)
                       Max Resp =       (0..15) (Size of Maximum APDU accepted per 20.1.2.5)
                      Invoke ID =       (0..255)
                Sequence Number =       (0..255) Only present if SEG = 1
           Proposed Window Size =       (1..127) Only present if SEG = 1
                 Service Choice =       BACnetConfirmedServiceChoice
                Service Request =       Variable Encoding per 20.2.
             *
           Bits shown in the diagram as '0' shall be set to zero. These bits are currently unused and are reserved by ASHRAE.
           */
            // Start of NPDU
            // http://www.bacnetwiki.com/wiki/index.php?title=NPDU
            data[optr++] = 0x01;        // Always 1 BACnet Version
            data[optr++] = 0x02;        // Control (Destination present, no source)Control: 0x04
            data[optr++] = 0x04;        // APDU Type            max
            data[optr++] = 0x01;        // Invoke ID
            data[optr++] = 0x0C;        // Service Choice
            data[optr++] = 0x0C;        // Length Value Type
            // APDU start
            // http://www.bacnetwiki.com/wiki/index.php?title=APDU
            //0030 in the capture
            data[optr++] = 0x02;        // Instance number
            data[optr++] = 0x04;        // Instance number
            data[optr++] = 0x4B;        // ObjectIdentifier:
            data[optr++] = 0x1E;        // ObjectIdentifier:
            data[optr++] = 0x1A;        // ObjectIdentifier:
            data[optr++] = 0x4C;        // Property Identifier
            data[optr++] = 0xF3;        // Trailer
            //(12 bytes)

Am I even close??

Mike