Q. From the toByteArray method of my read request, how do I access the point ID? I can easily access the read parameters but not the point ID!
A. There is not necessarily a single point ID for the read request.
Discussion: Many protocols feature requests whose responses return the values for more than one data point. To accommodate polling in this fashion, devDriver combines (groups) all driver control points that have the equivalent Read Parameters into the same Read Request. The relationship between driver control points to a read request is potentially many-to-one. Because of this, a read request does not necessarily have just one pointId, it could have many pointIds.
In the event that many driver control points are automatically placed in the same read request, all of them will have the same Read Parameters (they all could have different pointIds). For this reason, the pointId is generally used from the parseReadValue method on the read response (as opposed to the read request). The philosophy is that the readParameters structure should have enough information to formulate the outgoing request. Then on the response side, the pointId should have any extra information (if there is any) that is required to index into the response and extract the data value for the particular data point.
Some protocols have a read request that retrieves many data values, but requires that each desired value be specifically requested. For example, in this scenario a request might state "Please Read Inputs 1, 2, 3, 4, 5, 6, 7". The response would then return the values that were requested (Inputs 1, 2, 3, 4, 5, 6, 7). In this scenario, you can get the array of point IDs that are assigned to the read request (see line item two just below). However, even in this scenario, it still might be better to add a property to the readParameters structure (perhaps an enumeration whose possible values would be inputs1_7, inputs8_15, etc.). Doing so would take maximum advantage of devDriver's ability to combine as many driver control points as possible into a single read request.
Final Answer:
To access the point ID for the read request, there are two options:
Copyright © 2000-2016 Tridium Inc. All rights reserved.