/* Used for 112 format frame disassemble : 1 byte function code:2 byte data:2 byte data when exception the format is: 1 byte error code:1 byte excepton code The function code that conform to this format : 0x05 0x06  */
mb_status_t pdu_type122_disassemble(mb_handler_t *req_handler, uint8_t function_code, uint16_t *data1, uint16_t *data2, uint8_t *exception_code)
/* Used for 112 format frame disassemble : 1 byte function code:2 byte data:2 byte data when exception the format is: 1 byte error code:1 byte excepton code The function code that conform to this format : 0x05 0x06  */
mb_status_t pdu_type122_disassemble(mb_handler_t *req_handler, uint8_t function_code, uint16_t *data1, uint16_t *data2, uint8_t *exception_code)
{
    mb_status_t status  = MB_SUCCESS;
    uint8_t    *pdu_buf = &req_handler->mb_frame_buff[req_handler->pdu_offset];
    uint16_t    revdata;
    if ((pdu_buf[0] & 0x80) != 0 ) {
        if (exception_code != NULL) {
           *exception_code = pdu_buf[1];
        }
        status = MB_RESPOND_EXCEPTION;
        return status;
    }
    if (data1 != NULL) {
        revdata = pdu_buf[2];
        revdata = pdu_buf[1] | (revdata << 8);
        *data1  = betoh16(revdata);
    }
    if (data2 != NULL) {
        revdata = pdu_buf[4];
        revdata = pdu_buf[3] | (revdata << 8);
        *data2  = betoh16(revdata);
    }
    return status;
}