Expand description
§LibOSDP - Open Supervised Device Protocol Library
This is a cross-platform open source implementation of IEC 60839-11-5 Open Supervised Device Protocol (OSDP). The protocol is intended to improve interoperability among access control and security products. It supports Secure Channel (SC) for encrypted and authenticated communication between configured devices.
OSDP describes the communication protocol for interfacing one or more Peripheral Devices (PD) to a Control Panel (CP) over a two-wire RS-485 multi-drop serial communication channel. Nevertheless, this protocol can be used to transfer secure data over any stream based physical channel. Read more about OSDP here.
This protocol is developed and maintained by Security Industry Association (SIA).
§Getting started
A device complying with OSDP can either be a CP or a PD. There can be only one CP on a bus which can talk to multiple PDs. LibOSDP allows your application to work either as a CP or a PD so depending on what you want to do you have to do some things differently.
LibOSDP creates the following constructs which allow interactions between devices on the OSDP bus. These should not be confused with the protocol specified terminologies that may use the same names. They are:
- Channel - Something that allows two OSDP devices to talk to each other
- Commands - A call for action from a control panel (CP) to peripheral device (PD)
- Events - A call for action from peripheral device (PD) to control panel (CP)
The app starts by defining a type that implements the Channel
trait; this allows your
devices to communicate with other osdp devices on the bus. Then you describe the PD you are
- talking to on the bus (in case of CP mode of operation) or,
- going to behave as on the bus (in case of PD mode of operation)
by using the
PdInfo
struct.
You can use the PdInfo
(or a vector of PdInfo
structs in case of CP mode) to create a
ControlPanel
or PeripheralDevice
context. Both these contexts have a non-blocking
method refresh()
that needs to called as frequently as your app can permit. To meet the OSDP
specified timing requirements, your app must call this method at least once every 50ms.
After this point, the CP context can,
- send commands to any one of the PDs (to control LEDs, Buzzers, Input/Output pins, etc.,)
- register a closure for events that are sent from a PD
and the PD context can,
- notify it’s controlling CP about an event (card read, key press, tamper, etc.,)
- register a closure for commands issued by the CP
You can find a template implementation for CP app here and PD app here.
Structs§
- Control
Panel - OSDP CP device context.
- Osdp
ComSet - Command to set the communication parameters for the PD. The effects of this command is expected to be be stored in PD’s non-volatile memory as the CP will expect the PD to be in this state moving forward.
- Osdp
Command Buzzer - Command to control the behavior of a buzzer in the PD
- Osdp
Command File Tx - Command to kick-off a file transfer to the PD.
- Osdp
Command Keyset - Command to set secure channel keys to the PD.
- Osdp
Command Led - Command to control the behavior of it’s on-board LEDs
- Osdp
Command Mfg - Command to to act as a wrapper for manufacturer specific commands
- Osdp
Command Output - Command to control digital output exposed by the PD.
- Osdp
Command Text - Command to manipulate the on-board display unit (Can be LED, LCD, 7-Segment, etc.,) on the PD.
- Osdp
Event Card Read - Event that describes card read activity on the PD
- Osdp
Event KeyPress - Event to describe a key press activity on the PD
- Osdp
Event MfgReply - Event to transport a Manufacturer specific command’s response.
- Osdp
Flag - OSDP setup flags
- Osdp
LedParams - LED params sub-structure. Part of LED command: OsdpCommandLed
- Osdp
Status Report - Event to describe various status changes on PD
- PdCap
Entity - PD capability entity to be used inside
PdCapability
- PdId
- PD ID information advertised by the PD.
- PdInfo
- OSDP PD Information. This struct is used to describe a PD to LibOSDP
- PdInfo
Builder - OSDP PD Info Builder
- Peripheral
Device - OSDP Peripheral Device (PD) context
Enums§
- Channel
Error - OSDP channel errors
- Osdp
Card Formats - Various card formats that a PD can support. This is sent to CP when a PD must report a card read
- Osdp
Command - CP interacts with and controls PDs by sending commands to it. The commands in this enum are specified by OSDP specification.
- Osdp
Error - OSDP public errors
- Osdp
Event - CP to intimate it about various events that originate there (such as key press, card reads, etc.,). They do this by creating an “event” and sending it to the CP. This module is responsible to handling such events though OsdpEvent.
- Osdp
LedColor - LED Colors as specified in OSDP for the on_color/off_color parameters.
- Osdp
Status Report Type - Status report type
- PdCapability
- OSDP defined PD capabilities. PDs expose/advertise features they support to the CP by means of “capabilities”.
Traits§
- Channel
- The Channel trait acts as an interface for all channel implementors. See module description for the definition of a “channel” in LibOSDP.
- Convert
Endian - Trait to convert between BigEndian and LittleEndian types
- Osdp
File Ops - File operations handler trait. Any type that implements this trait can be
registered with
crate::ControlPanel::register_file_ops
orcrate::PeripheralDevice::register_file_ops
.
Functions§
- get_
source_ info - Get LibOSDP source info string
- get_
version - Get LibOSDP version