RDMnet  0.3.0
Implementation of ANSI E1.33 (RDMnet)
View other versions:
ept_client.h
Go to the documentation of this file.
1 /******************************************************************************
2  * Copyright 2020 ETC Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  ******************************************************************************
16  * This file is a part of RDMnet. For more information, go to:
17  * https://github.com/ETCLabs/RDMnet
18  *****************************************************************************/
19 
25 #ifndef RDMNET_EPT_CLIENT_H_
26 #define RDMNET_EPT_CLIENT_H_
27 
28 #include "etcpal/uuid.h"
29 #include "rdmnet/client.h"
30 #include "rdmnet/common.h"
31 #include "rdmnet/message.h"
32 
48 #ifdef __cplusplus
49 extern "C" {
50 #endif
51 
53 typedef int rdmnet_ept_client_t;
55 #define RDMNET_EPT_CLIENT_INVALID -1
56 
65  rdmnet_client_scope_t scope_handle,
66  const RdmnetClientConnectedInfo* info,
67  void* context);
68 
77  rdmnet_client_scope_t scope_handle,
79  void* context);
80 
89  rdmnet_client_scope_t scope_handle,
90  const RdmnetClientDisconnectedInfo* info,
91  void* context);
92 
103  rdmnet_client_scope_t scope_handle,
104  client_list_action_t list_action,
105  const RdmnetEptClientList* client_list,
106  void* context);
107 
117  rdmnet_client_scope_t scope_handle,
118  const RdmnetEptData* data,
119  RdmnetSyncEptResponse* response,
120  void* context);
121 
130  rdmnet_client_scope_t scope_handle,
131  const RdmnetEptStatus* status,
132  void* context);
133 
136 {
143  void* context;
145 
147 typedef struct RdmnetEptClientConfig
148 {
149  /************************************************************************************************
150  * Required Values
151  ***********************************************************************************************/
152 
161 
162  /************************************************************************************************
163  * Optional Values
164  ***********************************************************************************************/
165 
170  uint8_t* response_buf;
171 
176  const char* search_domain;
178 
188 #define RDMNET_EPT_CLIENT_CONFIG_DEFAULT_INIT \
189  { \
190  {{0}}, {NULL, NULL, NULL, NULL, NULL, NULL, NULL}, NULL, 0, NULL, NULL \
191  }
192 
198  RdmnetEptClientClientListUpdateReceivedCallback client_list_update_received,
201  void* context);
202 
205  rdmnet_disconnect_reason_t disconnect_reason);
206 
208  const RdmnetScopeConfig* scope_config,
209  rdmnet_client_scope_t* scope_handle);
211  rdmnet_client_scope_t* scope_handle);
213  rdmnet_client_scope_t scope_handle,
214  rdmnet_disconnect_reason_t disconnect_reason);
216  rdmnet_client_scope_t scope_handle,
217  const RdmnetScopeConfig* new_scope_config,
218  rdmnet_disconnect_reason_t disconnect_reason);
220  rdmnet_client_scope_t scope_handle,
221  char* scope_str_buf,
222  EtcPalSockAddr* static_broker_addr);
223 
225  rdmnet_client_scope_t scope_handle);
226 
228  rdmnet_client_scope_t scope_handle,
229  const EtcPalUuid* dest_cid,
230  uint16_t manufacturer_id,
231  uint16_t protocol_id,
232  const uint8_t* data,
233  size_t data_len);
235  rdmnet_client_scope_t scope_handle,
236  const EtcPalUuid* dest_cid,
237  ept_status_code_t status_code,
238  const char* status_string);
239 
240 #ifdef __cplusplus
241 };
242 #endif
243 
248 #endif /* RDMNET_EPT_CLIENT_H_ */
API definitions used by RDMnet clients (controllers and devices)
Functions and definitions common to all RDMnet API modules.
etcpal_error_t
ept_status_code_t
EPT status code definitions.
Definition: common.h:76
rdmnet_disconnect_reason_t
Disconnect reason defines for the BrokerDisconnectMsg.
Definition: common.h:85
client_list_action_t
How to apply the client entries to the existing client list in a client_list_update_received callback...
Definition: client.h:50
int rdmnet_client_scope_t
A handle to a scope that an RDMnet client participates in.
Definition: client.h:41
etcpal_error_t rdmnet_ept_client_request_client_list(rdmnet_ept_client_t client_handle, rdmnet_client_scope_t scope_handle)
Request a client list from a broker.
Definition: ept_client.c:273
void rdmnet_ept_client_config_init(RdmnetEptClientConfig *config)
Initialize an RdmnetEptClientConfig with default values for the optional config options.
Definition: ept_client.c:39
void(* RdmnetEptClientDisconnectedCallback)(rdmnet_ept_client_t client_handle, rdmnet_client_scope_t scope_handle, const RdmnetClientDisconnectedInfo *info, void *context)
An EPT client which was previously connected to a broker has disconnected.
Definition: ept_client.h:88
etcpal_error_t rdmnet_ept_client_create(const RdmnetEptClientConfig *config, rdmnet_ept_client_t *handle)
Create a new instance of RDMnet EPT client functionality.
Definition: ept_client.c:96
struct RdmnetEptClientConfig RdmnetEptClientConfig
A set of information that defines the startup parameters of an EPT client.
void(* RdmnetEptClientDataReceivedCallback)(rdmnet_ept_client_t client_handle, rdmnet_client_scope_t scope_handle, const RdmnetEptData *data, RdmnetSyncEptResponse *response, void *context)
EPT data has been received addressed to an EPT client.
Definition: ept_client.h:116
void(* RdmnetEptClientConnectedCallback)(rdmnet_ept_client_t client_handle, rdmnet_client_scope_t scope_handle, const RdmnetClientConnectedInfo *info, void *context)
An EPT client has successfully connected to a broker.
Definition: ept_client.h:64
etcpal_error_t rdmnet_ept_client_remove_scope(rdmnet_ept_client_t client_handle, rdmnet_client_scope_t scope_handle, rdmnet_disconnect_reason_t disconnect_reason)
Remove a previously-added scope from an EPT client instance.
Definition: ept_client.c:191
etcpal_error_t rdmnet_ept_client_change_scope(rdmnet_ept_client_t client_handle, rdmnet_client_scope_t scope_handle, const RdmnetScopeConfig *new_scope_config, rdmnet_disconnect_reason_t disconnect_reason)
Change the configuration of a scope on an EPT client.
Definition: ept_client.c:218
etcpal_error_t rdmnet_ept_client_destroy(rdmnet_ept_client_t client_handle, rdmnet_disconnect_reason_t disconnect_reason)
Destroy an EPT client instance.
Definition: ept_client.c:117
etcpal_error_t rdmnet_ept_client_send_data(rdmnet_ept_client_t client_handle, rdmnet_client_scope_t scope_handle, const EtcPalUuid *dest_cid, uint16_t manufacturer_id, uint16_t protocol_id, const uint8_t *data, size_t data_len)
Send data from an EPT client on a scope.
Definition: ept_client.c:298
void(* RdmnetEptClientStatusReceivedCallback)(rdmnet_ept_client_t client_handle, rdmnet_client_scope_t scope_handle, const RdmnetEptStatus *status, void *context)
An EPT status message has been received in response to a previously-sent EPT data message.
Definition: ept_client.h:129
void(* RdmnetEptClientClientListUpdateReceivedCallback)(rdmnet_ept_client_t client_handle, rdmnet_client_scope_t scope_handle, client_list_action_t list_action, const RdmnetEptClientList *client_list, void *context)
A client list update has been received from a broker.
Definition: ept_client.h:102
struct RdmnetEptClientCallbacks RdmnetEptClientCallbacks
A set of notification callbacks received about an EPT client.
etcpal_error_t rdmnet_ept_client_add_scope(rdmnet_ept_client_t client_handle, const RdmnetScopeConfig *scope_config, rdmnet_client_scope_t *scope_handle)
Add a new scope to an EPT client instance.
Definition: ept_client.c:142
void rdmnet_ept_client_set_callbacks(RdmnetEptClientConfig *config, RdmnetEptClientConnectedCallback connected, RdmnetEptClientConnectFailedCallback connect_failed, RdmnetEptClientDisconnectedCallback disconnected, RdmnetEptClientClientListUpdateReceivedCallback client_list_update_received, RdmnetEptClientDataReceivedCallback data_received, RdmnetEptClientStatusReceivedCallback status_received, void *context)
Set the callbacks in an RDMnet EPT client configuration structure.
Definition: ept_client.c:61
etcpal_error_t rdmnet_ept_client_send_status(rdmnet_ept_client_t client_handle, rdmnet_client_scope_t scope_handle, const EtcPalUuid *dest_cid, ept_status_code_t status_code, const char *status_string)
Send a status message from an EPT client on a scope.
Definition: ept_client.c:331
etcpal_error_t rdmnet_ept_client_add_default_scope(rdmnet_ept_client_t client_handle, rdmnet_client_scope_t *scope_handle)
Add a new scope representing the default RDMnet scope to an EPT client instance.
Definition: ept_client.c:168
etcpal_error_t rdmnet_ept_client_get_scope(rdmnet_ept_client_t client_handle, rdmnet_client_scope_t scope_handle, char *scope_str_buf, EtcPalSockAddr *static_broker_addr)
Retrieve the scope string of a previously-added scope.
Definition: ept_client.c:247
void(* RdmnetEptClientConnectFailedCallback)(rdmnet_ept_client_t client_handle, rdmnet_client_scope_t scope_handle, const RdmnetClientConnectFailedInfo *info, void *context)
A connection attempt failed between an EPT client and a broker.
Definition: ept_client.h:76
int rdmnet_ept_client_t
A handle to an RDMnet EPT Client.
Definition: ept_client.h:53
Basic types for parsed RDMnet messages.
Information provided by the library about an unsuccessful RDMnet client connection.
Definition: client.h:164
Information provided by the library about a successful RDMnet client connection.
Definition: client.h:151
Information provided by the library about an RDMnet client connection that disconnected after a succe...
Definition: client.h:196
A set of notification callbacks received about an EPT client.
Definition: ept_client.h:136
RdmnetEptClientConnectFailedCallback connect_failed
Required.
Definition: ept_client.h:138
void * context
(optional) Pointer to opaque data passed back with each callback.
Definition: ept_client.h:143
RdmnetEptClientConnectedCallback connected
Required.
Definition: ept_client.h:137
RdmnetEptClientStatusReceivedCallback status_received
Required.
Definition: ept_client.h:142
RdmnetEptClientDataReceivedCallback data_received
Required.
Definition: ept_client.h:141
RdmnetEptClientDisconnectedCallback disconnected
Required.
Definition: ept_client.h:139
RdmnetEptClientClientListUpdateReceivedCallback client_list_update_received
Required.
Definition: ept_client.h:140
A set of information that defines the startup parameters of an EPT client.
Definition: ept_client.h:148
const RdmnetEptSubProtocol * protocols
The list of EPT sub-protocols that this EPT client supports.
Definition: ept_client.h:158
const char * search_domain
(optional) The EPT client's configured search domain for discovery.
Definition: ept_client.h:176
RdmnetEptClientCallbacks callbacks
A set of callbacks for the client to receive RDMnet notifications.
Definition: ept_client.h:156
uint8_t * response_buf
(optional) A data buffer to be used to respond synchronously to EPT data notifications.
Definition: ept_client.h:170
size_t num_protocols
The size of the protocols array.
Definition: ept_client.h:160
EtcPalUuid cid
The EPT client's CID.
Definition: ept_client.h:154
A structure that represents a list of EPT Client Entries.
Definition: message.h:414
An RDMnet EPT data message received by a local component.
Definition: message.h:270
An RDMnet EPT status message received by a local component.
Definition: message.h:309
A description of an EPT sub-protocol.
Definition: message.h:379
A set of configuration information for a single scope in which an RDMnet client is participating.
Definition: client.h:224
This structure should not be manipulated directly - use the macros to access it:
Definition: common.h:293