[zb4osgi Dev] [ZB4O - Bug #283] Manufacturer ID must be sent in reverse byte order

redmine at zb4osgi.aaloa.org redmine at zb4osgi.aaloa.org
Mon Dec 1 11:14:50 CET 2014


Issue #283 has been updated by Philipp  Buluschek.


I'm currently using it, and so had to make the required changes...

I don't believe it is the caller's responsibility to know the ZigBee detail that data is sent byte-order reversed. When the ZigBee Alliance publishes a manufacturer ID, it is like @0x1234 at . Having the ID in the code as @byte[]{0x34,0x12};@ would be very counterintuitive. 

On the other hand, the ID is always 16bit unsigned, so we should use a corresponding data type. 

In @AbstractCommand@, a @null@ manufacturer ID indicates that the command is not manufacturer specific. Although, in general, using @null@ as a special-meaning value is ugly (IMHO), here it makes the code much simpler. All clients (the @Command@ implementation, but also the manufacturer specific @AttributeImpl@ and the corresponding @Subscription@) can just use one constructor and pass @null@ for standard Commands/Attributes and pass the ID in the other case.
In short: having a @null@ value to indicate standard conformance is convenient here - but so you cannot use a short or int instead. Maybe a DoubleByte or better still a domain specific "ManufacturerID" class would fit?  

----------------------------------------
Bug #283: Manufacturer ID must be sent in reverse byte order
http://zb4o.aaloa.org/redmine/issues/283#change-734

Author: Philipp  Buluschek
Status: Feedback
Priority: Low
Assignee: Stefano Lenzi
Category: zigbee.zcl.library
Target version: org.aaloa.zb4osgi.zigbee.zcl.library-0.9.0
Has a patch: No
Has license agreement signed: No


In @ZCLHeaderImpl@, the manufacturer ID must be sent in reverse byte order. 
<pre>
private byte[] createHeader(){
  ...
  newHeader[1] = manufacturerId[1];
  newHeader[2] = manufacturerId[0];
  ...
}
</pre>


-- 
DO NOT ANSWER TO THIS E-MAIL ADDRESS, NO ONE WILL READ IT. PLEASE WRITE TO dev at zb4osgi.aaloa.org
ZigBee 4 OSGi - Redmine E-Mail Notificatioon
You have received this notification because you have either subscribed to it, or are involved in it.
To change your notification preferences, please click here: http://zb4o.aaloa.org/redmine
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://zb4osgi.aaloa.org/pipermail/dev/attachments/20141201/ca4850d5/attachment.html>


More information about the Dev mailing list