Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

MTConnect Adapter acting as a relay for a device sending SHDR data on serial port

License

NotificationsYou must be signed in to change notification settings

Demo-Smart-Factory-Concordia-University/MTCAdapterRelay

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MTConnect Adapter acting as a relay for a physical device (e.g. a sensor) sending SHDR data on the serial port.

The MTCAdapterReay allows to hock up a device capable of sending SHDR data on the serial port butnot capable of sending TCP/IP data to an MTConnect Agent.

The MTCAdapterRelay is a small Python library desinged to work together with theMTConnect cpp agent.

Usage

Two classes need to be defined: anMTCAdapterRelayHandler and aMTCAdapterRelay class.

MTCAdapterRelayHandler

TheMTCAdapterRelayHandler is responsible to define the proper parameters for communicating with thedevice over the serial port.

At minimum the 'serial_port' attribute must be defined. It is the name of the Linux device fileto access the serial port (e.g./dev/ttyUSB1).

Further the following attributes may have to be redfined to match the configuration of the used serial port:

baudrate = 115200parity = serial.PARITY_NONEbytesize = serial.EIGHTBITSstopbits = serial.STOPBITS_ONE

MTCAdapterRelay

TheMTCAdapterRelay class is a specialized TCP/IP server which implements the PING/PONG hearthbeat convention oftheMTConnect cpp agent.

The attributeadapter_port (default value 7878) holds the port number on which the adapter relay will run.

The attributedeviceHandler_class must contain theMTCAdapterRelayHandler class defining the correctserial port paramters to communicate with the device.

Example

A typical example looks like this(this is an example for a temperature sensor connected via an Arduino type device.The Arduino sketch is availblehere):

from mtcadapterrelay import MTCAdapterRelay, MTCAdapterRelayHandlerimport sysclass DS18B20_MTCAdapterRelayHandler(MTCAdapterRelayHandler):        serial_port = '/dev/ttyUSB1'    baudrate = 115200    parity = serial.PARITY_NONE    bytesize = serial.EIGHTBITS    stopbits = serial.STOPBITS_ONEclass DS18B20_MTCAdapterRelay(MTCAdapterRelay):        adapter_port = 8881    deviceHandler_class = DS18B20_MTCAdapterRelayHandler    myAdapter = DS18B20_MTCAdapterRelay()try:    myAdapter.serve_forever()except KeyboardInterrupt:    sys.exit(0)

About

MTConnect Adapter acting as a relay for a device sending SHDR data on serial port

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp