Module Entity¶
- group ModuleEntity
The Module Entity provides a generic interface to a BrainStem hardware module. The Module Class is the parent class for all BrainStem modules. Each module inherits from Module and implements its hardware specific features.
-
void module_createStem(unsigned int *id, struct Result *result, unsigned char moduleAddress, bool autoNetworking, unsigned char model)¶
Creates a brainstem object that the library will manage internally and creates a unique identifier that will be used for other function calls in this library.
- Parameters:
id – Unique identifier for the internally created stem.
result – object, containing NO_ERROR or a non zero Error code.
-
void module_disconnectAndDestroyStem(unsigned int *id, struct Result *result)¶
Disconnects from device defined by the ID and will destroy any internal memory associated with the Device.
- Parameters:
id – ID assigned through “module_createStem”
result – object, containing NO_ERROR or a non zero Error code.
-
void module_discoverAndConnect(unsigned int *id, struct Result *result, int transport, unsigned int serialNumber)¶
Finds and connects to the first device found on the given transport. If a serial number was provided when module_createStem was called then it will only connect to that specific id.
- Parameters:
id – ID assigned through “module_createStem”
result – object, containing NO_ERROR or a non zero Error code.
transport – Defines what connection method should be searched for BrainStem devices. (i.e. USB, TCPIP, etc.)
-
void module_sDiscover(unsigned int *id, struct Result *result, struct linkSpec_CCA *stemList, int listLength, int transport)¶
Discovers all of the BrainStem devices on a given transport. The return list is filled with device specifiers which contains information about the device.
- Parameters:
id – ID assigned through “module_createStem”
result – object, containing NO_ERROR or a non zero Error code.
stemList – List of device specifiers for each of the discovered devices
listLength – Indicates how long the list is.
transport – Defines what connection method should be searched for BrainStem devices. (i.e. USB, TCPIP, etc.)
-
void module_disconnect(unsigned int *id, struct Result *result)¶
Disconnects device, but does not destroy underlying object. i.e. “module_reconnect” could be called without calling “module_createStem” again.
- Parameters:
id – ID assigned through “module_createStem”
result – object, containing NO_ERROR or a non zero Error code.
-
void module_reconnect(unsigned int *id, struct Result *result)¶
Reestablishes a connection with a preexisting stem object. The original stem would of been created with “module_createStem”.
- Parameters:
id – ID assigned through “module_createStem”
result – object, containing NO_ERROR or a non zero Error code.
-
void module_connectThroughLinkModule(unsigned int *id, unsigned int *id_linkStem, struct Result *result)¶
Establishes connection through another stems link/connection (i.e. transport: USB, TCPIP). Refer to BrainStem Networking at www.acroname.com/support
- Parameters:
id – ID assigned through “module_createStem”
id_linkStem – The link stem’s id assigned through “module_createStem” (The stem providing the connection.)
result – object, containing NO_ERROR or a non zero Error code.
-
void module_setModuleAddress(unsigned int *id, struct Result *result, int address)¶
Changes the module address of the stem object that was created via “module_createStem”. Refer to BrainStem Networking at www.acroname.com/support
- Parameters:
id – ID assigned through “module_createStem”
result – object, containing NO_ERROR or a non zero Error code.
address – New address to be set.
-
void module_getModuleAddress(unsigned int *id, struct Result *result)¶
Retrieves the module address of the stem object that was created via “module_createStem”. Refer to BrainStem Networking at www.acroname.com/support
- Parameters:
id – ID assigned through “module_createStem”
result – object, containing NO_ERROR and the module/stems current module address or a non zero Error code.
-
void module_isConnected(unsigned int *id, struct Result *result)¶
Returns the current state of the module/stem’s connection. Refer to BrainStem Networking at www.acroname.com/support
- Parameters:
id – ID assigned through “module_createStem”
result – object, containing NO_ERROR and the status of the connection or a non zero Error code. (0 = disconnected; 1 = connected.)
-
void module_setNetworkingMode(unsigned int *id, struct Result *result, int mode)¶
Changes the networking mode of the stem object. Auto mode is enabled by default which allows automatic adjustment of the module/stems networking configuration. Refer to BrainStem Networking at www.acroname.com/support
- Parameters:
id – ID assigned through “module_createStem”
result – object, containing NO_ERROR or a non zero Error code.
mode – New mode to be set.
-
void module_clearAllStems()¶
Disconnects and destroys all modules/stems. During development the dll doesn’t always “detach” between runs. This can create problematic scenarios if there are not subsequent disconnect and destroy calls for every create call made. This function can be a helpful post-execution/tear-down process when bringing up new BrainStem Networks. However, not required if connections are handles correctly. Refer to BrainStem Networking at www.acroname.com/support