Commit Graph

1865 Commits

Author SHA1 Message Date
HomeSpan 0be3b0cd1b
Update Reference.md 2024-04-21 21:23:44 -05:00
HomeSpan 050a30f72c
Update Reference.md 2024-04-21 21:16:08 -05:00
Gregg 4e5d03f63f renamed CUSTOM_CHAR_TLV() macro to CUSTOM_CHAR_TLV8() macro 2024-04-21 15:18:22 -05:00
HomeSpan 04cb07a0fc
Update README.md 2024-04-21 12:45:27 -05:00
HomeSpan 059c58ca46
Update TLV8.md 2024-04-21 12:41:14 -05:00
HomeSpan 4334789d50
Update TLV8.md 2024-04-21 12:39:39 -05:00
HomeSpan fa25369ebb
Update TLV8.md 2024-04-21 12:37:51 -05:00
HomeSpan ccda8f04d9
Update TLV8.md 2024-04-21 10:31:10 -05:00
HomeSpan b995a75907
Update TLV8.md 2024-04-21 08:30:07 -05:00
HomeSpan 998bd873bc
Update TLV8.md 2024-04-21 08:27:00 -05:00
HomeSpan bfdf114ed3
Update TLV8.md 2024-04-21 07:46:01 -05:00
HomeSpan d51b74e1c1
Update TLV8.md 2024-04-21 07:06:36 -05:00
HomeSpan aa9d64cb58
Update TLV8.md 2024-04-20 20:17:02 -05:00
HomeSpan e83df601b2
Update TLV8.md 2024-04-20 20:08:53 -05:00
HomeSpan e0f593bc2e
Update TLV8.md 2024-04-20 19:50:46 -05:00
HomeSpan d9e9783dc1
Update TLV8.md 2024-04-20 19:01:50 -05:00
HomeSpan e6c7637825
Update TLV8.md 2024-04-20 18:35:29 -05:00
Gregg b4bfac54e7 small tweaks to the TLV8 library for ease of use 2024-04-20 10:14:31 -05:00
HomeSpan 173ba036f0
Update TLV8.md 2024-04-20 09:05:43 -05:00
HomeSpan 15a0396897
Update TLV8.md 2024-04-20 08:00:19 -05:00
HomeSpan cd3b525dbb
Update TLV8.md 2024-04-20 07:54:41 -05:00
HomeSpan f96721b948
Update TLV8.md 2024-04-20 07:23:18 -05:00
HomeSpan 520a4f3df0
Update TLV8.md 2024-04-19 22:05:02 -05:00
HomeSpan 9b0555d256
Update TLV8.md 2024-04-19 12:58:43 -05:00
HomeSpan b05be87a29
Update TLV8.md 2024-04-18 22:20:58 -05:00
HomeSpan dfec533212
Create TLV8.md 2024-04-18 21:06:47 -05:00
HomeSpan 04443d70dd
Update Reference.md 2024-04-18 20:59:55 -05:00
HomeSpan 2ecbed9f26
Update Reference.md 2024-04-18 18:21:02 -05:00
HomeSpan 6794a804f9
Update README.md 2024-04-18 17:59:31 -05:00
HomeSpan 64f67fbb8a
Update Reference.md 2024-04-18 07:04:13 -05:00
HomeSpan bb531184d7
Documents resetIID(), Service::getIID() and Characteristic::getIID() 2024-04-18 06:43:58 -05:00
Gregg d1dd565478 Converted IID from int to uint32_t everywhere 2024-04-17 07:24:08 -05:00
Gregg 723c343277 Added error checking to warn if non-bridge device defines more than 3 Accessories
It appears that HomeKit requires devices with more than 3 Accessories to be configured as a bridge.  If not, the Home App will ignore any functional Services in the first Accessory and treat it like a bridge regardless.  Device with 3 or less Accessories do not require a bridge configuration.
2024-04-16 22:17:00 -05:00
Gregg b9efa873dc Added error-checking for homeSpan.resetIID()
HomeSpan will throw a Warning when 'i' CLI command finds a duplicate IID within the same Accessory.
2024-04-16 21:56:07 -05:00
Gregg fe3269e9ef Added new validation check for homeSpan.resetIID()
New value must be equal to, or greater than, the last IID value used.  This prevents possible re-use.
2024-04-15 22:14:05 -05:00
Gregg 73561328e6 Changed TLV8:add() for *values* to ensure resulting size is always multiple of 2
Checked that this is correctly interpreted by HomeKit using adaptive light TLV.

TLV code is now ready for documentation and then transfer to dev branch.
2024-04-14 21:29:02 -05:00
Gregg a7d57699a0 Added homeSpan.resetIID()...
...as well as SpanService.getIID() and SpanCharacteristic.getIID().

This provides control of IIDs used for each Service and Characteristic.
By using this with adaptive lighting test, was able to verify that HomeKit can interpret TLV values of 1 byte, 2 bytes, and 4 bytes, but not 3 bytes.  Suggests that TLV values need to be multiples of 2 (i.e. uint8, uint16, uint32).  Will change TLV value-writing methodology so that padding zeros are used to round to 1, 2, 4, or 8 bytes.
2024-04-14 21:05:09 -05:00
Gregg e4df56293a Added TLV8:printAll()
Recursively prints an entire TLV and all embedded sub-TLVs based on a best-guess if the value of any TLV is a sub-TLV.
2024-04-14 13:37:04 -05:00
Gregg 48cab1f82b Changed tlv8_t from struct to class and made variables private
Add getLen() and getTag() method to get length and tag of tlv8_t.

Also overrode subscript operator [] so you can access any element of internal uint8_t array.

Given previous additions (such as getVal()) there is now no reason to need to access the underlying std::unique_ptr directly.
2024-04-13 22:59:37 -05:00
Gregg 28990d6ed6 Revert "Changed TLV:add() so it returns TLV8 instead of iterator."
This reverts commit 7a50479bac.
2024-04-13 22:00:37 -05:00
Gregg 7a50479bac Changed TLV:add() so it returns TLV8 instead of iterator.
Makes it easier to chain .add() functions as well as dynamically create sub TLVs.

Changing TLV8::add() in this fashion also required updating various use cases of TLV::add() in HAP.cpp where add() was used to reserve space for a blank TLV element.  All changes have been tested.
2024-04-13 19:12:26 -05:00
Gregg 5ded77d6d9 Replace TLV8 (*it)[0] with new TLV8 getVal() method in HAP.cpp 2024-04-08 21:52:51 -05:00
Gregg d40d709643 Add TLV8 add() methods for uint64_t and char*, as well as new getVal() template for returning an integer 2024-04-08 21:33:27 -05:00
Gregg acebaf6caa Add ability to unpack TLV8 by iterator
Also fixed bug using increment operator (++) by replacing with std::next()
2024-04-06 21:45:49 -05:00
Gregg 7e2625034c Added TLV8_it add(uint8_t tag, TLV8 &subTLV)
Allows easy-add of a sub TLV to an existing TLV8
2024-04-04 21:31:28 -05:00
Gregg 75cbf9715f added mechanism to strip unnecessary backslashes from Home App JSON
Apple "escapes" forward slashes in JSON output, replacing '/' with '\/', which destroys base64 strings.
2024-04-04 21:12:13 -05:00
Gregg 3d4b02e492 created getDataGeneric() and getStringGeneric()
Though this simplifies the code, the code size is still the same - compiler must have already optimized these functions.
2024-03-31 21:40:00 -05:00
Gregg 1892a0a5a2 created getTLVGeneric() and used as base for getTLV() and getNewTLV()
avoids unnecessary duplication of code where the only difference is whether you need the value or the newValue of a Characteristic.
2024-03-31 21:25:22 -05:00
Gregg f137b0bee5 Updated getTLV() so it uses a fixed buffer as intermediate step
This is much more memory efficient.  Instead of decoding entire STRING from base64 to a temporary buffer or potentially very large size and then unpacking into TLV object, we decode a maximum of 48 characters at a time and unpack the resulting 36 (max) bytes until entire STRING is consumed.

getTLV() returns pack_size of final TLV, unless there is a problem with conversion, in which cae TLV is wiped and return value=0
2024-03-31 21:13:17 -05:00
Gregg eb821f002f created getTLV(TLV8 &tlv)
Works, but is memory-inefficient since it decodes entire string before unpacking.  Need to add new functionality to TLV8 so that unpacking can be done in chunks similar to how pack() works.

Also need to create getNewTLV() OR make all get/getNew generic to reduce code size.
2024-03-31 09:23:23 -05:00