OpenZWave / python-openzwave

Python wrapper for openzwave
Other
200 stars 141 forks source link

1.6 Update - Support BitSet ValueID (python-openzwave) #165

Open Fishwaldo opened 5 years ago

Fishwaldo commented 5 years ago

Per the OZW 1.6 Release Notes on the new BitSet ValueID

Need to ensure that the BitSet ValueID is supported.

Manager References: Manager::GetValueAsBitSet (ValueID const &_id, uint8 _pos, bool *o_value) SetValue (ValueID const &_id, uint8 _pos, bool const _value) GetBitMask (ValueID const &_id, int32 *o_mask) GetBitSetSize (ValueID const &_id, uint8 *o_size)

kdschlosser commented 5 years ago

OK I am working on this now. I have encountered a missing method for the Mnager class

bool Manager::GetValueAsBinaryString ( ValueID const & _id, string *  o_value )

I also noticed some errors in the documentation. under the section for the GetValueAsBitSet as well as for the overloaded SetValue. This is what the description of the returned value currently is.

true if the value was obtained. Returns false if the value is not a ValueID::ValueType_Bool. The type can be tested with a call to ValueID::GetType.

I believe it should read

true if the value was obtained. Returns false if the value is not a ValueID::ValueType_BitSet. The type can be tested with a call to ValueID::GetType.

kdschlosser commented 5 years ago

I just finished making the updates. It is going to compile and run the tests so we will see if it works.

I still have yet to check out the unittests to see if there are changes that need to be made there as well.

kdschlosser commented 5 years ago

quick question.

the index for the bit.. does the index run from right to left of left to right? I know you already know this that bit positions run from right to left. But you may have coded it to index the bit from left to right..

Fishwaldo commented 5 years ago

LSB = 0, MSB is highest.

kdschlosser commented 5 years ago

ok. you got me with the geek speak. I am a green horn in the programming world. only 3 years. I am going to need some clarification. :flushed:

Fishwaldo commented 5 years ago

LSB - least significant bit. Bit 1 which equals 1. MSB - most significant bit. Eg, bit 8 which equals 127.

kdschlosser commented 5 years ago

ok so it is indexed from right to left. good to know.