ArduRPC

class ardurpc.ArduRPC(handlers=None, **kwargs)[source]

Functions with camel-case names are directly mapped to a function on the device. Functions without camel-case names are not mapped. The second function type should be preferred.

getHandlerList()[source]

Get a handler list.

Function ‘get_handlers()’ should be preferred.

Returns:Raw value returned by the device
getHandlerName(handler_id)[source]

Get a handler name by its ID.

Parameters:handler_id (Integer) – The ID of the handler
Returns:The name of the handler
Return type:String
getLibraryVersion()[source]

Get the version of the ArduRPC library running on the device.

Returns:Raw value returned by the device
getMaxPacketSize()[source]

Get the max packet size supported by the device.

Returns:Raw value returned by the device
getProtocolVersion()[source]

Get supported protocol version.

Returns:Value returned by the device
get_handler(handler_id)[source]

Return a instance of the handler.

Parameters:handler_id (Integer) – The ID of the handler
Returns:Class instance or None
Return type:Instance
get_handler_by_name(name)[source]

Return a instance of the handler.

Parameters:name (String) – The name of the handler
Returns:Class instance or None
Return type:Instance
get_handler_cache()[source]

Get a list of all cached handlers.

Returns:Dict: Key = Name, Value = Instance
Return type:Dict
get_handler_names()[source]

Return a list of handler names present on the device.

Returns:List of names
Return type:List
get_handlers()[source]

Get a list of all available handlers.

Returns:Dict: Key = Name, Value = Instance
Return type:Dict
get_version()[source]

Get the version of the ArduRPC library running on the device.

Returns:A Dict with major, minor and patch level
Return type:Dict
ardurpc.load_handlers()[source]

Load build-in handlers.

ardurpc.register(handler_type, handler, mask=16)[source]

Register a new handler.

Parameters:
  • handler_type (Integer) – The ID of the handler type
  • handler (Class) – The handler class (Not an instance)
  • mask (Integer) – The mask to group handlers

ArduRPC exceptions.

  • Failure
    • FunctionNotFound
    • HandlerNotFound
    • CommandNotFound
  • Timeout
exception ardurpc.exception.ArduRPCException(value='')[source]

Base ArduRPC Exception.

__weakref__

list of weak references to the object (if defined)

exception ardurpc.exception.CommandNotFound(value='')[source]

The command is not available on the microcontroller.

exception ardurpc.exception.Failure(value='')[source]

Something went wrong while executing a command.

But no reason was given.

exception ardurpc.exception.FunctionNotFound(value='')[source]

The function is not available on the microcontroller.

exception ardurpc.exception.HandlerNotFound(value='')[source]

The handler is not available on the microcontroller.

exception ardurpc.exception.InvalidHeader(value='')[source]

The header was malformed

exception ardurpc.exception.InvalidRequest(value='')[source]

The request was malformed

exception ardurpc.exception.Timeout(value='')[source]

A timeout occurred.

exception ardurpc.exception.UnknownReturnCode(value='')[source]

.