You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
Current implementation of osdp_status_report and specifically ISTATR that forces input status to either '0' or '1' (uint32_t mask) is not compatible with implementations that report status above 0x01 to indicate different fault states.
I think this is yet another case of the OSDP standard being somewhat unclear which have led to different implementatons of it.
I noticed that in the newly released 2.2.2 standard, they have specified a new set of possible standard codes for ISTATR (above 0x01), with anything above 0x80 reserved for vendor specific implementations. So a change to how this work would also make the library conform with the latest OSDP version.
Describe the solution you'd like
Change the logic and the uint32_t mask in osdp_status_report to a byte array with a defined value for the maximum number of inputs allowed
This would be a breaking change to the library API though
I'd be willing to submit a PR for it if wanted
OSDP 2.2/IEC SPEC
OSDP 2.2.2 ISTATR SPEC
Relevant code
pd_build_reply(...)
case REPLY_ISTATR: {
event = (struct osdp_event *)pd->ephemeral_data;
int n = pd->cap[OSDP_PD_CAP_CONTACT_STATUS_MONITORING].num_items;
if (event->status.nr_entries != n) {
break;
}
assert_buf_len(n + 1, max_len);
buf[len++] = pd->reply_id;
**for (i = 0; i < n; i++) {
buf[len++] = !!(event->status.mask & (1 << i));
}**
ret = OSDP_PD_ERR_NONE;
break;
}
cp_decode_response(...)
case REPLY_ISTATR: {
uint32_t status_mask = 0;
int cap_num = OSDP_PD_CAP_CONTACT_STATUS_MONITORING;
if (len != pd->cap[cap_num].num_items || len > 32) {
LOG_ERR("Invalid input status report length %d", len);
return OSDP_CP_ERR_GENERIC;
}
**for (i = 0; i < len; i++) {
status_mask |= !!buf[pos++] << i;
}**
event.type = OSDP_EVENT_STATUS;
event.status.type = OSDP_STATUS_REPORT_INPUT;
event.status.nr_entries = len;
event.status.mask = status_mask;
memcpy(pd->ephemeral_data, &event, sizeof(event));
make_request(pd, CP_REQ_EVENT_SEND);
ret = OSDP_CP_ERR_NONE;
break;
}
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
Current implementation of osdp_status_report and specifically ISTATR that forces input status to either '0' or '1' (uint32_t mask) is not compatible with implementations that report status above 0x01 to indicate different fault states.
I think this is yet another case of the OSDP standard being somewhat unclear which have led to different implementatons of it.
I noticed that in the newly released 2.2.2 standard, they have specified a new set of possible standard codes for ISTATR (above 0x01), with anything above 0x80 reserved for vendor specific implementations. So a change to how this work would also make the library conform with the latest OSDP version.
Describe the solution you'd like
Change the logic and the uint32_t mask in osdp_status_report to a byte array with a defined value for the maximum number of inputs allowed
This would be a breaking change to the library API though
I'd be willing to submit a PR for it if wanted
OSDP 2.2/IEC SPEC
![Image](https://private-user-images.githubusercontent.com/1904324/407838724-471f91fe-8758-46ca-a690-6fdd07355ec8.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkxNDA1MTksIm5iZiI6MTczOTE0MDIxOSwicGF0aCI6Ii8xOTA0MzI0LzQwNzgzODcyNC00NzFmOTFmZS04NzU4LTQ2Y2EtYTY5MC02ZmRkMDczNTVlYzgucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIwOSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMDlUMjIzMDE5WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9MjMwZjdhZWIxNzM0MmE1ZDE0MjI4MzA4ZTk5OGVjOWE1M2UzNjZmNWE3MDAxNjA5NTYyNzkwMjE4YTFlYWRkOSZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.UhnNzUFU6SthEQ1TM1OQsb-n6to-U1pWrjJpLoSkm7c)
OSDP 2.2.2 ISTATR SPEC
![Image](https://private-user-images.githubusercontent.com/1904324/407828413-43fd74ad-60b0-48ec-a8b8-7de77ff97903.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkxNDA1MTksIm5iZiI6MTczOTE0MDIxOSwicGF0aCI6Ii8xOTA0MzI0LzQwNzgyODQxMy00M2ZkNzRhZC02MGIwLTQ4ZWMtYThiOC03ZGU3N2ZmOTc5MDMucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIwOSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMDlUMjIzMDE5WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9YzUwNzZmMGE0NzIxZjQ5MzM1NDU3NjM0NDJiZmFhM2U0ZDljYTE5MDg0MjJmZjBiYjU2M2RjYTY5YzUzMTdkYSZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.M7y7mrcIWzbCk0agwh_nhpm66qctB7ierKQH2OWPHPY)
Relevant code
pd_build_reply(...)
cp_decode_response(...)
The text was updated successfully, but these errors were encountered: