itm / wsn-device-drivers

Drivers for Wireless Sensor Network Devices
Other
6 stars 4 forks source link

Improve MacAddress class to work with Strings, Longs and Byte-Arrays #23

Closed danbim closed 13 years ago

danbim commented 13 years ago

The MacAddress class should be able to be constructed from Strings (Hex, Dec, Binary), Longs and Byte-Arrays. In the same manner it should have methods to return the MacAddress as one of these types.

psotres commented 13 years ago

In fact, current MacAddress should implement the equals() method by comparing its adress byteArray and not by creating a HexString based on this adress and then comparing the resultingString.

Also, although not really neccesary, I'd suggest to modify StringUtils toHexString methods to give some control on how HexStrings are created. Right now, a toHexString called over [00:13:A2:00:40:6D:0B:5A] results in "0x0 0x13 0xa2 0x0 0x40 0x6d 0xb 0x5a". Each hex byte should be always 2 digits, and some parameters could be passed to avoid '0x' and to change ' ' as separator.

danbim commented 13 years ago

Good idea.

Regarding the StringUtils stuff: could you open a ticket in Testbed Runtime's issue tracker?