public UInt16 Decode_confirmed_Service_Request(ref Byte[] apdu, UInt16 apdu_len, ref BACNET_CONFIRMED_SERVICE_DATA service_data, ref Byte service_choice, ref UInt16 service_requst_len, int pos) { UInt16 len = 0; /* counts where we are in PDU */ service_data.segmented_message = (apdu[0 + pos] & 0x08) != 0 ? true : false; service_data.more_follows = (apdu[0] & 0x04) != 0 ? true : false; service_data.segmented_response_accepted = (apdu[pos] & 0x02) != 0 ? true : false; service_data.max_segs = BasicalProcessor.Decode_Max_Segs(ref apdu, pos + 1); service_data.max_resp = BasicalProcessor.Decode_Max_Apdu(ref apdu, pos + 1); service_data.invoke_id = apdu[pos + 2]; len = 3; if (service_data.segmented_message) { service_data.sequence_number = apdu[pos + len++]; service_data.proposed_window_number = apdu[pos + len++]; } service_choice = apdu[pos + len++]; ; service_requst_len = (UInt16)(apdu_len - len); return(len); }