/* Reports an exception if the provided value is 0.  */
LIGHTMODBUS_RET_ERROR parseMyRequest(ModbusSlave *status, uint8_t function, const uint8_t *requestPDU, uint8_t requestLength)
/* Reports an exception if the provided value is 0.  */
LIGHTMODBUS_RET_ERROR parseMyRequest(ModbusSlave *status, uint8_t function, const uint8_t *requestPDU, uint8_t requestLength)
{
	if (requestLength < 2)
		return modbusBuildException(status, function, MODBUS_EXCEP_ILLEGAL_VALUE);
	if (requestPDU[1] == 0)
		return modbusBuildException(status, function, MODBUS_EXCEP_ILLEGAL_VALUE);
	if (modbusSlaveAllocateResponse(status, 6) != MODBUS_OK)
		return MODBUS_GENERAL_ERROR(ALLOC);
	status->response.pdu[0] = function;
	status->response.pdu[1] = 'p';
	status->response.pdu[2] = requestPDU[1] % 2 ? 'o' : 'i';
	status->response.pdu[3] = 'n';
	status->response.pdu[4] = 'g';
	status->response.pdu[5] = 0;
	return MODBUS_NO_ERROR();
}