Can you give me more detailed information about fuction “getRequestKey(byte[] message)” ,It seems only get the key of received message ,not sended message.
please tell me more about the “key”,thanks.
/**
* <p>
* Extract the request key from the given message. This key is used to identify the
* {@link Request} that this message is a response to.
* </p>
*
* @param message
* The message to extract a key from.
*
* @return A key for this message.
*/
protected abstract Object getRequestKey(M message);
The key is something that you use to link an incoming response to a request that is waiting for a response. In most cases you might think this is a non-issue, since with simpler protocols like Modbus there’s only ever 1 request at a time, but the driver framework allows for many.
The key is usually something that can be extracted from the delivered bytes of a response. Modbus, for example, has a sequence number in the MBAP header that is used as the key. The sequence is incremented when a request is sent, and then that sequence number is extracted (by you, in getRequestKey()) when a response is received. The driver framework then grabs the Request object it’s holding on to with that key (Request#getKey() is called after Request#sendMessage()) and delivers the response to it (Request#receiveMessage(M message, Object key)).
Thanks
please give me more material about UA programing such as javadoc for all protected methods to wengzijue@yahoo.com.cn if possible and if it is convenient for you
The 7.3.3-beta2 ModuleSDK, available here, should have JavaDocs with protected methods included.