hyperion.ng
|
Functions | |
void | ipcon_create (IPConnection *ipcon) |
Creates an IP Connection object that can be used to enumerate the available devices. More... | |
void | ipcon_destroy (IPConnection *ipcon) |
Destroys the IP Connection object. More... | |
int | ipcon_connect (IPConnection *ipcon, const char *host, uint16_t port) |
Creates a TCP/IP connection to the given host and c\ port. More... | |
int | ipcon_disconnect (IPConnection *ipcon) |
Disconnects the TCP/IP connection from the Brick Daemon or the WIFI/Ethernet Extension. | |
int | ipcon_get_connection_state (IPConnection *ipcon) |
Can return the following states: More... | |
void | ipcon_set_auto_reconnect (IPConnection *ipcon, bool auto_reconnect) |
Enables or disables auto-reconnect. More... | |
bool | ipcon_get_auto_reconnect (IPConnection *ipcon) |
Returns true if auto-reconnect is enabled, false otherwise. | |
void | ipcon_set_timeout (IPConnection *ipcon, uint32_t timeout) |
Sets the timeout in milliseconds for getters and for setters for which the response expected flag is activated. More... | |
uint32_t | ipcon_get_timeout (IPConnection *ipcon) |
Returns the timeout as set by ipcon_set_timeout. | |
int | ipcon_enumerate (IPConnection *ipcon) |
Broadcasts an enumerate request. More... | |
void | ipcon_wait (IPConnection *ipcon) |
Stops the current thread until ipcon_unwait is called. More... | |
void | ipcon_unwait (IPConnection *ipcon) |
Unwaits the thread previously stopped by ipcon_wait. More... | |
void | ipcon_register_callback (IPConnection *ipcon, uint8_t id, void *callback, void *user_data) |
Registers a callback for a given ID. | |
int ipcon_connect | ( | IPConnection * | ipcon, |
const char * | host, | ||
uint16_t | port | ||
) |
Creates a TCP/IP connection to the given host
and c\ port.
The host and port can point to a Brick Daemon or to a WIFI/Ethernet Extension.
Devices can only be controlled when the connection was established successfully.
Blocks until the connection is established and returns an error code if there is no Brick Daemon or WIFI/Ethernet Extension listening at the given host and port.
void ipcon_create | ( | IPConnection * | ipcon | ) |
Creates an IP Connection object that can be used to enumerate the available devices.
It is also required for the constructor of Bricks and Bricklets.
void ipcon_destroy | ( | IPConnection * | ipcon | ) |
Destroys the IP Connection object.
Calls ipcon_disconnect internally. The connection to the Brick Daemon gets closed and the threads of the IP Connection are terminated.
int ipcon_enumerate | ( | IPConnection * | ipcon | ) |
Broadcasts an enumerate request.
All devices will respond with an enumerate callback.
int ipcon_get_connection_state | ( | IPConnection * | ipcon | ) |
Can return the following states:
void ipcon_set_auto_reconnect | ( | IPConnection * | ipcon, |
bool | auto_reconnect | ||
) |
Enables or disables auto-reconnect.
If auto-reconnect is enabled, the IP Connection will try to reconnect to the previously given host and port, if the connection is lost.
Default value is true.
void ipcon_set_timeout | ( | IPConnection * | ipcon, |
uint32_t | timeout | ||
) |
Sets the timeout in milliseconds for getters and for setters for which the response expected flag is activated.
Default timeout is 2500.
void ipcon_unwait | ( | IPConnection * | ipcon | ) |
Unwaits the thread previously stopped by ipcon_wait.
ipcon_wait and ipcon_unwait act in the same way as "acquire" and "release" of a semaphore.
void ipcon_wait | ( | IPConnection * | ipcon | ) |
Stops the current thread until ipcon_unwait is called.
This is useful if you rely solely on callbacks for events, if you want to wait for a specific callback or if the IP Connection was created in a thread.
ipcon_wait and ipcon_unwait act in the same way as "acquire" and "release" of a semaphore.