goToMain / libosdp

Implementation of IEC 60839-11-5 OSDP (Open Supervised Device Protocol); provides a C library with support for C++, Rust and Python3
https://libosdp.sidcha.dev
Apache License 2.0
128 stars 69 forks source link

CP send a broadcast #166

Open jason155392 opened 4 months ago

jason155392 commented 4 months ago

Can CP send a broadcast to PD now? I checked the API and found that only the osdp_cp_send_command function is available. This function requires specifying the PD offset. However, osdp_cp_setup cannot be set up with osdp_pd_info_t for the 0x7F address. This will cause a "packet seq mismatch" issue.

How can libosdp handle this now?

sidcha commented 4 months ago

The broadcast support that we have is entirely for the PD so if you need it for the CP, we should enable it. Can you describe what you are trying to achieve?

Also, as I recall, the broadcast message was underspecified in OSDP v2.2 for all practical purposes.

jason155392 commented 4 months ago

I want to implement a function to get/set a Peripheral Device's (PD) address using broadcast messages.

Initially, I'm considering the following approach:

  1. The Control Panel (CP) can send an "osdp_MFG" broadcast to check the PD's address.
  2. Subsequently, the CP can send an "osdp_COMSET" broadcast to set the PD's address.

I've reviewed OSDP v2.2, which specifies that "the use of the broadcast address should be limited to controlled (single PD) configurations." Therefore, this method is suitable for closed environments, where the CP can utilize it to manage single PD information effectively.

sidcha commented 4 months ago

Okay, that sounds compelling enough. Let me see how this can be implemented.

sidcha commented 4 months ago

Looks like #113 can make use of this too.

schmida2 commented 3 months ago

Looks like #113 can make use of this too.

The proposed concept of OSDP auto addressing revision 2 does not rely on broadcast anymore, esp. because using broadcasts during operation sets back message sequence numbers (SQN) and this would harm the OSDP built-in error recovery

sidcha commented 3 months ago

@schmida2 I turned #113 into a discussion. Do you mind updating that thread with the most recent version of your proposal? (I think the current link points to the one with broadcast messages)

The last comment has the most recent revision: https://github.com/schmida2/libosdp/blob/osdp-extension-autoaddr/OSDP_Extension-AutoAddressingProtocol.md