serialclass module

Class to Handle all Serial communication between Lorenz Sensors and the PC

# https://stackoverflow.com/questions/25382455/python-notimplementederror-pool-objects-cannot-be-passed-between-processes __getstate__ is always called prior to pickling an object, and allow you to specify exactly which pieces of the object’s state should actually be pickled. Then upon unpickling, __setstate__(state) will be called if its implemented (it is in our case), or if it’s not, the dict returned by __getstate__ will be used as the __dict__ for the unpickled instance. In the above example, we’re explicitly setting __dict__ to the dict we returned in __getstate__, but we could have just not implemented __setstate__ and gotten the same effect.

class serialclass.polling_serial(LorenzSerials)

Bases: object

Polling class for SOPM of data from the sensors by multiprocessing module approach

caller(func, args)

Second caller funtion for TASKS list Calls the function passed to the TASKS list

Parameters
  • function_name – (function) function to be called

  • args – (tuple) parameters

Returns

result

callerstar(args)

First caller function for TASKS list Accepts a tuple of two args parameters

Parameters
  • args – (object) LorenzSerial object

  • args – (int) a = 0 by default

Returns

(function) caller function

ordered_pool(core_number=4)

Start polling values from the sensors in parallel

Parameters

core_number – (int) number of cores to use for parallel processing by default = 4

Returns

(list of int) four sensor values

ordered_pools(core_number=4)

Start polling values from the sensors in parallel but with multiple methods

Parameters

core_number – (int) number of cores to use for parallel processing by default = 4

Returns

(list of int) four sensor values

process_send_rand(LorenzSerial, a=0)

Gets sensor values from the Lorenz sensor

Parameters
  • args – (object) LorenzSerial object

  • args – (int) a = 0 by default

Returns

(int) sensor value