Cypress
1.0
C++ Spiking Neural Network Simulation Framework
|
#include <netio4.hpp>
Public Member Functions | |
NetIO4 (cypress::Json &config) | |
~NetIO4 () override | |
NetIO4 (const std::string &config_filename=".netio4_config.json") | |
bool | has_config () override |
bool | connected () |
int | device_port (const std::string &device) |
bool | state (int port) |
void | switch_on (int port) |
void | switch_off (int port) |
bool | state (const std::string &device) override |
bool | switch_on (const std::string &device) override |
bool | switch_off (const std::string &device) override |
Class used to communicate with a NETIO4 intelligent power outlet. This is used to switch neuromorphic hardware devices on and off, as bugs in the hardware sometimes cause them to become responseless, causing experiments to crash with an exception.
cypress::NetIO4::NetIO4 | ( | cypress::Json & | config | ) |
Reads the NetIO4Power configuration from the given json configuration. The configuration must have the following format:
{ "address": "192.168.1.78", "port": 1234, "user": "admin", "password": "admin", "device_map": { "spikey": 1, "nmmc1": 2 } }
|
inlineoverride |
|
explicit |
Reads the NetIO4Power configuration from the given JSON file. See the other constructor for the expected format. If the file is not found, the NetIO4Power class will simply do nothing.
config_filename | is the name of the file from which the configuration should be read. |
bool cypress::NetIO4::connected | ( | ) |
Returns true if the class can successfully communicate with the device.
int cypress::NetIO4::device_port | ( | const std::string & | device | ) |
Returns the port the given device is connected to. The device name must be the cannonical backend name as returned by "backend.name()". Returns -1 if no port is mapped to the given device.
|
inlineoverridevirtual |
Returns true if the configuration was sucessfully read in the constructor.
Implements cypress::PowerDevice.
bool cypress::NetIO4::state | ( | int | port | ) |
Returns true if the port with the given port id is currently switched on, false if the device is switched off. Throws an exception if the communication with the device fails or the given port does not exist.
|
overridevirtual |
Returns the state of the device with the given name. If the device cannot be controlled, false should be returned.
device | is the canonical backend name (returned by backend.name()) of the device for which the state should be returned. |
Implements cypress::PowerDevice.
void cypress::NetIO4::switch_off | ( | int | port | ) |
|
overridevirtual |
Switches the device with teh given name off.
device | is the canonical backend name (returned by backend.name()) of the device that should be controlled. |
Implements cypress::PowerDevice.
void cypress::NetIO4::switch_on | ( | int | port | ) |
|
overridevirtual |
Switches the device with teh given name on.
device | is the canonical backend name (returned by backend.name()) of the device that should be controlled. |
Implements cypress::PowerDevice.