![]() ![]() If this function is not called before connecting, a default register with zero entries is setup. The register values are initialized with zero. Sets the registered map structure for requests from other ModBus clients to map. bool QModbusServer:: setMap(const QModbusDataUnitMap & map) See also QModbusDataUnit::RegisterType, data(), and dataWritten(). Nevertheless this function returns true in such cases. Note that the signal is not emitted when data has not changed. If the call was successful the dataWritten() signal is emitted. Returns false if address outside of the map range. A Modbus server has four tables ( table) and each have a unique address field, which is used to write data to the desired field. bool QModbusServer:: setData( QModbusDataUnit::RegisterType table, quint16 address, quint16 data) This may happen when newData contains exactly the same values as the register already. Note that the signal is not emitted when the addressed register has not changed. Returns false if the newData range is outside of the map range. bool QModbusServer:: setData(const QModbusDataUnit & newData) Returns the address of this Modbus server instance. int QModbusServer:: serverAddress() const Note: Sub-classes that implement reading from a different backing store then default one, also need to implement setMap() and writeData(). Every other request type should be forwarded to this default implementation. A common reason might be to filter out function code requests for data values to limit read/write access and function codes not desired in particular implementations such as serial line diagnostics on ethernet or Modbus Plus transport layers. The override must handle the request type in question and return the appropriate QModbusResponse. The default handling of the standard Modbus function code requests can be overwritten by reimplementing this function. All other Modbus function codes not included in the specification are forwarded to processPrivateRequest(). The default implementation of this function handles all standard Modbus function codes as defined by the Modbus Application Protocol Specification 1.1b. ![]() This function returns a QModbusResponse or QModbusExceptionResponse depending on the nature of the request. Processes a Modbus client request and returns a Modbus response. QModbusResponse QModbusServer:: processRequest(const QModbusPdu & request) This default implementation returns a QModbusExceptionResponse with the request function code and error code set to illegal function. Reimplementations should call this function again to ensure an exception response is returned for all unknown function codes the custom Modbus implementation does not handle. Overwriting this function allows handling of additional function codes and subfunction-codes not specified in the Modbus Application Protocol Specification 1.1b. It is called by processRequest() if the given request is not a standard Modbus request. This function should be implemented by custom Modbus servers. QModbusResponse QModbusServer:: processPrivateRequest(const QModbusPdu & request) The signal is not emitted when the to-be-written fields have not changed due to no change in value.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |