-
Notifications
You must be signed in to change notification settings - Fork 300
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ZCL types revamp #1033
Merged
Merged
ZCL types revamp #1033
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Koenkk
reviewed
Apr 27, 2024
Some quick (i.e. imprecise) performance tests (x1000000):
BuffaloZcl read uint8for (let x = 0; x < 1000000; x++) {
const buffalo = new BuffaloZcl(Buffer.from([0x00, 0x03, 0x00, 0x00]), 1);
buffalo.read(Zcl.DataType.UINT8, {});
// buffalo.read('uint8', {});
} BuffaloZcl write uint8for (let x = 0; x < 1000000; x++) {
const buffalo = new BuffaloZcl(Buffer.alloc(3), 1);
buffalo.write(Zcl.DataType.UINT8, 240, {});
// buffalo.write('uint8', 240, {});
} BuffaloZcl read arrayfor (let x = 0; x < 1000000; x++) {
const buffer = Buffer.from([32, 3, 0, 1, 2, 3]);
const buffalo = new BuffaloZcl(buffer);
buffalo.read(Zcl.DataType.ARRAY, {});
// buffalo.read('array', {});
} BuffaloZcl write arrayfor (let x = 0; x < 1000000; x++) {
const payload = {elementType: Zcl.DataType.DATA8, elements: [0, 0, 0, 0]};
// const payload = {elementType: Zcl.DataType.data8, elements: [0, 0, 0, 0]};
const buffer = Buffer.alloc(7);
const buffalo = new BuffaloZcl(buffer);
buffalo.write(DataType.ARRAY, payload, {});
// buffalo.write('array', payload, {});
} BuffaloZcl read enum8for (let x = 0; x < 1000000; x++) {
const buffalo = new BuffaloZcl(Buffer.from([0x00, 0x03, 0x00, 0x00]), 1);
buffalo.read(Zcl.DataType.ENUM8, {});
// buffalo.read('enum8', {});
} BuffaloZcl write enum8for (let x = 0; x < 1000000; x++) {
const buffalo = new BuffaloZcl(Buffer.alloc(3), 1);
buffalo.write(Zcl.DataType.ENUM8, 240, {});
// buffalo.write('enum8', 240, {});
} BuffaloZcl read bufferfor (let x = 0; x < 1000000; x++) {
const buffer = Buffer.from([0x01, 0x02, 0x03, 0x04, 0x05]);
const buffalo = new BuffaloZcl(buffer);
buffalo.read(BuffaloZclDataType.BUFFER, {});
// buffalo.read(BuffaloZclDataType[BuffaloZclDataType.BUFFER], {});
} BuffaloZcl write bufferfor (let x = 0; x < 1000000; x++) {
const buffer = Buffer.alloc(5);
const expected = Buffer.from([0x01, 0x02, 0x03, 0x04, 0x05]);
const buffalo = new BuffaloZcl(buffer);
buffalo.write(BuffaloZclDataType.BUFFER, expected, {});
// buffalo.write(BuffaloZclDataType[BuffaloZclDataType.BUFFER], expected, {});
} |
Nerivec
force-pushed
the
zcl-types-revamp
branch
from
April 28, 2024 09:23
e8be4c0
to
d9f2774
Compare
devbis
reviewed
Apr 30, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
DataType
(long overdue) and added some comments for good measureBuffalo
andBuffaloZcl
so they no longer have traces of zstack-specific logic.Buffalo
deals with base types and holds the generic functions.BuffaloZcl
adds support for Zcl-specific types.read
/write
toBuffaloZcl
with tests.read
/write
.options
-dependent and "non-value"read
/write
and tests to go with it.write
are still missing "non-value" support, impossible because of current implementations. Requires refactoring.BuffaloZcl
support and tests.TODO:
LONG_OCTET_STR
was previously using the sameread
/write
asLONG_CHAR_STR
, changed tonumber[]
/Buffer
. Need to check on the 2 use cases:Clusters.liXeePrivate.attributes.daysProfileCurrentCalendar
Clusters.liXeePrivate.attributes.daysProfileNextCalendar
read
/write
fromBuffaloZcl
toBuffalo
. Should probably be in another PR, will affect more than the Zcl definition.NOTE: zigate missing
ParameterType
values were added arbitrarily to allow compiling. It seems to also be missing types support. Code looks broken overall.