Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

libosdp

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

libosdp

Library implementation of IEC 60839-11-5 OSDP (Open Supervised Device Protocol)

  • 3.0.8
  • PyPI
  • Socket score

Maintainers
1

LibOSDP for Python

This package exposes the C/C++ library for OSDP devices to python to enable rapid prototyping of these devices. There are two modules exposed by this package:

  • osdp_sys: A thin wrapper around the C/C++ API; this is a low level API and is no longer recommended to use this directly.

  • osdp: A wrapper over the osdp_sys to provide python friendly API; this implementation which is now powering the integration testing suit used to test all changes made to this project.

Install

You can install LibOSDP from PyPI using,

pip install libosdp

Or, from github,

pip install -e "git+https://github.com/goToMain/libosdp#egg=libosdp&subdirectory=python"

Or, from source using,

git clone https://github.com/goToMain/libosdp --recurse-submodules
cd libosdp/python
python3 setup.py install

Quick Start

Control Panel Mode

# Create a communication channel
channel = SerialChannel("/dev/ttyUSB0")

# populate osdp_pd_info_t from python
pd_info = [
    PDInfo(101, channel, scbk=KeyStore.gen_key()),
]

# Create a CP device and kick-off the handler thread and wait till a secure
# channel is established.
cp = ControlPanel(pd_info, log_level=LogLevel.Debug)
cp.start()
cp.sc_wait_all()

while True:
    ## Check if we have an event from PD
    led_cmd = { ... }
    event = cp.get_event(pd_info[0].address)
    if event:
        print(f"CP: Received event {event}")

    # Send LED command to PD-0
    cp.send_command(pd_info[0].address, led_cmd)

see examples/cp_app.py for more details.

Peripheral Device mode:

# Create a communication channel
channel = SerialChannel("/dev/ttyUSB0")

# Describe the PD (setting scbk=None puts the PD in install mode)
pd_info = PDInfo(101, channel, scbk=None)

# Indicate the PD's capabilities to LibOSDP.
pd_cap = PDCapabilities()

# Create a PD device and kick-off the handler thread and wait till a secure
# channel is established.
pd = PeripheralDevice(pd_info, pd_cap)
pd.start()
pd.sc_wait()

while True:
    # Send a card read event to CP
    card_event = { ... }
    pd.notify_event(card_event)

    # Check if we have any commands from the CP
    cmd = pd.get_command()
    if cmd:
        print(f"PD: Received command: {cmd}")

see examples/pd_app.py for more details.

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc