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 int sn = 0)

Creates a generic BrainStem/stem object to be used in the program

Parameters
  • id: This value will be assigned by the underlying library if a serial number is not provided and will be replaced by the devices serial number once a connection is made.

  • result: object, containing NO_ERROR or a non zero Error code.

  • sn: Serial number of the device you want to create. Not required.

void module_disconnectAndDestoryStem(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: The id assigned by the create stem vi.

  • result: object, containing NO_ERROR or a non zero Error code.

void module_discoverAndConnect(unsigned int *id, struct Result *result, int transport = (int)USB)

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: The id assigned by the create stem vi.

  • 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 deviceListItem *stemList, int *stemListLength, int transport = (int)USB)

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: The id assigned by the create stem vi.

  • result: object, containing NO_ERROR or a non zero Error code.

  • stemList: List of device specifiers for each of the discovered devices

  • stemListLength: 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: The id assigned by the create stem vi.

  • 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: The id assigned by the create stem vi.

  • 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: The id assigned by the create stem vi.

  • id_linkStem: The link stem’s id assigned by the create stem vi. (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: The id assigned by the create stem vi.

  • 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: The id assigned by the create stem vi.

  • 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: The id assigned by the create stem vi.

  • 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: The id assigned by the create stem vi.

  • 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