Skip to main content

A dialler implementation using the SIA-DC09 protocol

Project description

dc09_spt (Secure Premises Transceiver a.k.a. dialler)

A set of python classes to implement a dialler using the SIA-DC09 protocol set and conforming to the EN-50136-1 norm

The provided classes should be enough to implement an dialler (SPT, Secure Premises Transceiver, in EN-50136-1 lingo) with the following functions

What functions are implemented

Implemented functions as for now are :

  • construction of messages according to the SIA-DC09 standard
  • construction of the payload events for SIA-DC09 according to the SIA-DC07 standard
  • construction of the payload events for SIA-DC07 according to the SIA-DC03 standard
  • construction of the payload events for SIA-DC07 according to the SIA-DC05 standard
  • crypt the SIA-DC09 messages using AES128 or AES256
  • poll main and optionally back-up transmission paths according to EN 50136-1 norm in a separate thread
  • use of primary paths for both the main and the back-up transmission paths resulting in a total of 4 paths per dialler
  • transmission of DC09 events efficiently in a separate thread and check the answer before deleting them from the queue
  • send timed routine messages
  • keep track of time offset of the various receivers.

Introduction

As a developer of security software i often heard the complaint that it would be hard to write a decent protocol implementation, especially when checksums and encryption are involved. While being one of the authors of a multi protocol IP receiver i did not have the feel that it would be too hard.

Then, when a friend asked if i knew an example of the SIA-DC09 protocol in the Internet to be used as a reference for development, and i could not find any, combined with him mentioning python and my long standing wish to try that language too, it started itching. And the next weekend i started learning python (not that difficult after many years programming many languages) and made a set of classes to handle the DC09 messages.

While testing these classes in the evenings of the next week, and getting fun further exploring the possibilities of python, i added this dc09_dialler class for testing the protocol, and noticed it could be interesting for others to use or read this software.

Because our company is not in the business of making transmitters, but specialized in making redundant multi protocol receivers and Alarm Monitoring Software, we decided to open source this set of classes.

The provided example (command line) application, creates two independant diallers with both their polling and routine messages and a simple way to send events. The hosts mentioned in the example are our test receivers. You are encouraged to try sending events to them.

Please remember i am an C/C++ programmer and this is my first venture into an python module. It is very likely that serious python programmers have many hints and remarks at my code. Please comment or correct. Learning python was the main reason to start this project.

Protocol basics

The SIA-DC09 protocol definition defines how to send optionally encrypted events to a receiver and perform the transmission path tests by sending poll messages. The events sent in such an DC09 block is defined in the SIA-DC07 standard.

This DC07 standard is basically a description how an receiver can communicate with AMS (Alarm Monitoring Station) software and can transfer messages in various transmitter protocols.

This set of classes implements the SIA-DC03 (a.k.a. "SIA") and the SIA-DC05 (a.k.a. "CID") transmitter protocols. These two protocols make up for well over 90% of the used message formats in alarm messaging. In effect it should be possible to cover most use cases.

Dialler configuration

In general the configuration consists of defining account number, encryption key and communication paths.

instantiating a dialler

At instantiating a dialler, you specify the account number to be used for the envelope. That, together with the receiver and line number, defines the SPT in the protocol.

example :

spt = dc09_spt("0123")

define a communication path

Next you define the communication paths to be used to reach the receiver and the encrytion key to be used in that path.

example :

spt.set_path("main", "primary", "ovost.eu", 12128, "0123", key=None)

Each spt can handle 4 paths, labeled main.primary, main.secondary, back-up.primary and back-up.secondary. The main path is for the main transmission path, where the fast poll message will be sent. Main.primary connects to the primary receiver, main.secondary to the secondary receiver. The back-up path will only be used if the main path is unavailable except for the slow poll to show its availability.

set the polling frequency and messages for fail and restore

Polling is defined in SIA-DC09 to show the communication path is available for transfer of events. The polling interval is, for Europe, defined in the EN-50136-1 norm. For dual path the polling in the back-up path will take over the frequency of the main path in case it fails.

example :

spt.start_poll(85,890, ok_msg={'code':  'YK'},  fail_msg={'code':  'YS'})

optionally set routine reports

Normally it is preferred that the alarm panel, in this case the application using this set of classes sends the routine events to show it is functioning, but it can be delegated to the dc09_spt class by defining a routine report. I suggest to use a zone number of 99 in SIA and 999 in CID type messages to make it possible to recognize the SPT originated messages.

example:

spt.start_routine([{'interval':  7200,  'type': 'SIA-DCS',  'code':  'RP',  'zone':  99}])

Send an event

To send an event you call the send_msg method with the type of message and an map with the content. In the message you can define a different account number if the receiver accepts that.

example:

spt.send_msg('SIA-DCS', {'code':'OP','zone': 14,  'time':  'now'})
spt.send_msg('ADM-CID', {'account':  '124',  'code': 400, 'q': 1, 'zone': 14})

Next steps

This is the first upload of these classes. In my tests they work, but some work is still planned for the near future:

To Do

1. complete the package for upload to Pipi 2. extend documentation and comments 3. extend the dc03_msg class to handle all keys defined in the DC03 standard. (this subset should be enough for over 90% of the use cases though) 4. extend the dc09_msg class with the extensions of the SIA-DC09 2013 version

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

my_dc09_spt-0.1.1.tar.gz (23.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

my_dc09_spt-0.1.1-py3-none-any.whl (27.3 kB view details)

Uploaded Python 3

File details

Details for the file my_dc09_spt-0.1.1.tar.gz.

File metadata

  • Download URL: my_dc09_spt-0.1.1.tar.gz
  • Upload date:
  • Size: 23.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for my_dc09_spt-0.1.1.tar.gz
Algorithm Hash digest
SHA256 50fd8262f1faf549b66075609b5fefda65535e5d98c9f84a21440b81c671b6b7
MD5 3b8e4db091c520e90e63d99dc273cf17
BLAKE2b-256 166abae727b2b2275a9aa93270fd0b9ff527739da2139d1163caff5a0fa47787

See more details on using hashes here.

File details

Details for the file my_dc09_spt-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: my_dc09_spt-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 27.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for my_dc09_spt-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e2c035c545b9648434cb305b0ee28d453c3335982d886c1d65d6964d5891a175
MD5 fee787c22c4f54fa9331e7218fc5ca29
BLAKE2b-256 1c7c9e0e3cf4afd8312b5bddf7a6b4559d72a32179465d72da0e393320496c9d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page