4. pyB12MPS Server

4.1. Server Commands

Commands beginning and ending in underscore “_” are special commands which are interpreted by the MPS Server. All other commands are passed directly to the Bridge12 MPS through the serial connection.




Close the serial port


Flush the serial port buffer


Return bytes in waiting at serial port


Initialize MPS serial port connection


System ready status of MPS (1 = Ready, 0 = Not Ready)


Stop the MPS Server

4.2. Server and Handler Class

class MPSTCPHandler(request, client_address, server)

The RequestHandler class for MPS server.

It is instantiated once per connection to the server, and must override the handle() method to implement communication to the client.

class MPSTCPServer(ip_port, MPSTCPHandler)

Server for MPS Communication


Close the MPS serial port


Automatically Detect Serial Port for MPS


Initialize the MPS serial connection

4.3. Example - pyB12MPS Server

Here is an example using functions for checking the status of the MPS server.

import pyB12MPS as mps

# Start the server

# Test server connection
testValue = mps.test()

if testValue == 0:
    print('Server Running')
    print('Server Error')

# Test if MPS is ready
readyValue = mps.systemReady()

if readyValue == 1:
    print('MPS System is Ready')
    print('MPS System Not Ready')

# Stop the server