Enumerations | Functions
IP Connection

Enumerations

enum  { IPCON_CALLBACK_ENUMERATE = 253, IPCON_CALLBACK_CONNECTED = 0, IPCON_CALLBACK_DISCONNECTED = 1 }
enum  { IPCON_ENUMERATION_TYPE_AVAILABLE = 0, IPCON_ENUMERATION_TYPE_CONNECTED = 1, IPCON_ENUMERATION_TYPE_DISCONNECTED = 2 }
enum  { IPCON_CONNECT_REASON_REQUEST = 0, IPCON_CONNECT_REASON_AUTO_RECONNECT = 1 }
enum  { IPCON_DISCONNECT_REASON_REQUEST = 0, IPCON_DISCONNECT_REASON_ERROR = 1, IPCON_DISCONNECT_REASON_SHUTDOWN = 2 }
enum  { IPCON_CONNECTION_STATE_DISCONNECTED = 0, IPCON_CONNECTION_STATE_CONNECTED = 1, IPCON_CONNECTION_STATE_PENDING = 2 }

Functions

int ipcon_authenticate (IPConnection *ipcon, const char secret[64])
int ipcon_connect (IPConnection *ipcon, const char *host, uint16_t port)
void ipcon_create (IPConnection *ipcon)
void ipcon_destroy (IPConnection *ipcon)
int ipcon_disconnect (IPConnection *ipcon)
int ipcon_enumerate (IPConnection *ipcon)
bool ipcon_get_auto_reconnect (IPConnection *ipcon)
int ipcon_get_connection_state (IPConnection *ipcon)
uint32_t ipcon_get_timeout (IPConnection *ipcon)
void ipcon_register_callback (IPConnection *ipcon, uint8_t id, void *callback, void *user_data)
void ipcon_set_auto_reconnect (IPConnection *ipcon, bool auto_reconnect)
void ipcon_set_timeout (IPConnection *ipcon, uint32_t timeout)
void ipcon_unwait (IPConnection *ipcon)
void ipcon_wait (IPConnection *ipcon)

Enumeration Type Documentation

anonymous enum

Possible IDs for ipcon_register_callback.

Enumerator:
IPCON_CALLBACK_ENUMERATE 
IPCON_CALLBACK_CONNECTED 
IPCON_CALLBACK_DISCONNECTED 

Definition at line 297 of file ip_connection.h.

anonymous enum

Possible values for enumeration_type parameter of EnumerateCallback.

Enumerator:
IPCON_ENUMERATION_TYPE_AVAILABLE 
IPCON_ENUMERATION_TYPE_CONNECTED 
IPCON_ENUMERATION_TYPE_DISCONNECTED 

Definition at line 308 of file ip_connection.h.

anonymous enum

Possible values for connect_reason parameter of ConnectedCallback.

Enumerator:
IPCON_CONNECT_REASON_REQUEST 
IPCON_CONNECT_REASON_AUTO_RECONNECT 

Definition at line 319 of file ip_connection.h.

anonymous enum

Possible values for disconnect_reason parameter of DisconnectedCallback.

Enumerator:
IPCON_DISCONNECT_REASON_REQUEST 
IPCON_DISCONNECT_REASON_ERROR 
IPCON_DISCONNECT_REASON_SHUTDOWN 

Definition at line 329 of file ip_connection.h.

anonymous enum

Possible return values of ipcon_get_connection_state.

Enumerator:
IPCON_CONNECTION_STATE_DISCONNECTED 
IPCON_CONNECTION_STATE_CONNECTED 
IPCON_CONNECTION_STATE_PENDING 

Definition at line 340 of file ip_connection.h.


Function Documentation

int ipcon_authenticate ( IPConnection ipcon,
const char  secret[64] 
)

Performs an authentication handshake with the connected Brick Daemon or WIFI/Ethernet Extension. If the handshake succeeds the connection switches from non-authenticated to authenticated state and communication can continue as normal. If the handshake fails then the connection gets closed. Authentication can fail if the wrong secret was used or if authentication is not enabled at all on the Brick Daemon or the WIFI/Ethernet Extension.

For more information about authentication see http://www.tinkerforge.com/en/doc/Tutorials/Tutorial_Authentication/Tutorial.html

Definition at line 2193 of file ip_connection.cpp.

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.

Definition at line 2106 of file ip_connection.cpp.

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.

Definition at line 2031 of file ip_connection.cpp.

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.

Definition at line 2081 of file ip_connection.cpp.

int ipcon_disconnect ( IPConnection ipcon)

Disconnects the TCP/IP connection from the Brick Daemon or the WIFI/Ethernet Extension.

Definition at line 2145 of file ip_connection.cpp.

int ipcon_enumerate ( IPConnection ipcon)

Broadcasts an enumerate request. All devices will respond with an enumerate callback.

Definition at line 2266 of file ip_connection.cpp.

Returns *true* if auto-reconnect is enabled, *false* otherwise.

Definition at line 2254 of file ip_connection.cpp.

Can return the following states:

  • IPCON_CONNECTION_STATE_DISCONNECTED: No connection is established.
  • IPCON_CONNECTION_STATE_CONNECTED: A connection to the Brick Daemon or the WIFI/Ethernet Extension is established.
  • IPCON_CONNECTION_STATE_PENDING: IP Connection is currently trying to connect.

Definition at line 2231 of file ip_connection.cpp.

uint32_t ipcon_get_timeout ( IPConnection ipcon)

Returns the timeout as set by ipcon_set_timeout.

Definition at line 2262 of file ip_connection.cpp.

void ipcon_register_callback ( IPConnection ipcon,
uint8_t  id,
void *  callback,
void *  user_data 
)

Registers a callback for a given ID.

Definition at line 2289 of file ip_connection.cpp.

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*.

Definition at line 2243 of file ip_connection.cpp.

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.

Definition at line 2258 of file ip_connection.cpp.

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.

Definition at line 2285 of file ip_connection.cpp.

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.

Definition at line 2281 of file ip_connection.cpp.



tinkerforge_laser_transform
Author(s): M.Fischer
autogenerated on Thu Jun 6 2019 20:39:26