RDMnet  0.3.0
Implementation of ANSI E1.33 (RDMnet)
View other versions:
llrp_target.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_LLRP_TARGET_H_
26 #define RDMNET_LLRP_TARGET_H_
27 
28 #include <stdint.h>
29 #include "etcpal/common.h"
30 #include "etcpal/uuid.h"
31 #include "etcpal/error.h"
32 #include "etcpal/inet.h"
33 #include "rdm/uid.h"
34 #include "rdm/message.h"
35 #include "rdmnet/common.h"
36 #include "rdmnet/llrp.h"
37 #include "rdmnet/message.h"
38 
55 #ifdef __cplusplus
56 extern "C" {
57 #endif
58 
60 typedef int llrp_target_t;
62 #define LLRP_TARGET_INVALID -1
63 
72  const LlrpRdmCommand* cmd,
73  RdmnetSyncRdmResponse* response,
74  void* context);
75 
77 typedef struct LlrpTargetCallbacks
78 {
80  void* context;
82 
84 typedef struct LlrpTargetConfig
85 {
86  /************************************************************************************************
87  * Required Values
88  ***********************************************************************************************/
89 
94 
95  /************************************************************************************************
96  * Optional Values
97  ***********************************************************************************************/
98 
103  uint8_t* response_buf;
104 
109  RdmUid uid;
110 
118  size_t num_netints;
120 
132 #define LLRP_TARGET_CONFIG_DEFAULT_INIT(manu_id) \
133  { \
134  {{0}}, {NULL, NULL}, NULL, {(0x8000 | manu_id), 0}, NULL, 0 \
135  }
136 
137 void llrp_target_config_init(LlrpTargetConfig* config, uint16_t manufacturer_id);
138 
141 
143  const LlrpSavedRdmCommand* received_cmd,
144  const uint8_t* response_data,
145  uint8_t response_data_len);
147  const LlrpSavedRdmCommand* received_cmd,
148  rdm_nack_reason_t nack_reason);
149 
150 #ifdef __cplusplus
151 }
152 #endif
153 
158 #endif /* RDMNET_LLRP_TARGET_H_ */
Functions and definitions common to all RDMnet API modules.
etcpal_error_t
etcpal_error_t llrp_target_create(const LlrpTargetConfig *config, llrp_target_t *handle)
Create a new LLRP target instance.
Definition: llrp_target.c:94
int llrp_target_t
A handle for an instance of LLRP Target functionality.
Definition: llrp_target.h:60
struct LlrpTargetConfig LlrpTargetConfig
A set of information that defines the startup parameters of an LLRP Target.
void llrp_target_config_init(LlrpTargetConfig *config, uint16_t manufacturer_id)
Initialize an LlrpTargetConfig with default values for the optional config options.
Definition: llrp_target.c:74
struct LlrpTargetCallbacks LlrpTargetCallbacks
A set of notification callbacks received about an LLRP target.
etcpal_error_t llrp_target_send_ack(llrp_target_t handle, const LlrpSavedRdmCommand *received_cmd, const uint8_t *response_data, uint8_t response_data_len)
Send an RDM ACK response from an LLRP target.
Definition: llrp_target.c:155
etcpal_error_t llrp_target_send_nack(llrp_target_t handle, const LlrpSavedRdmCommand *received_cmd, rdm_nack_reason_t nack_reason)
Send an RDM NACK response from an LLRP target.
Definition: llrp_target.c:182
etcpal_error_t llrp_target_destroy(llrp_target_t handle)
Destroy an LLRP target instance.
Definition: llrp_target.c:129
void(* LlrpTargetRdmCommandReceivedCallback)(llrp_target_t handle, const LlrpRdmCommand *cmd, RdmnetSyncRdmResponse *response, void *context)
An RDM command has been received addressed to an LLRP target.
Definition: llrp_target.h:71
Functions and definitions common to LLRP Managers and Targets.
Basic types for parsed RDMnet messages.
An RDM command received from a remote LLRP Manager.
Definition: message.h:439
An RDM command received from a remote LLRP Manager.
Definition: message.h:459
A set of notification callbacks received about an LLRP target.
Definition: llrp_target.h:78
LlrpTargetRdmCommandReceivedCallback rdm_command_received
Required.
Definition: llrp_target.h:79
void * context
(optional) Pointer to opaque data passed back with each callback.
Definition: llrp_target.h:80
A set of information that defines the startup parameters of an LLRP Target.
Definition: llrp_target.h:85
uint8_t * response_buf
(optional) A data buffer to be used to respond synchronously to RDM commands.
Definition: llrp_target.h:103
RdmUid uid
(optional) The target's UID.
Definition: llrp_target.h:109
LlrpTargetCallbacks callbacks
A set of callbacks for the target to receive RDMnet notifications.
Definition: llrp_target.h:93
size_t num_netints
(optional) The size of the netints array.
Definition: llrp_target.h:118
const RdmnetMcastNetintId * netints
(optional) A set of network interfaces on which to operate this LLRP target.
Definition: llrp_target.h:116
EtcPalUuid cid
The target's CID.
Definition: llrp_target.h:91
A set of identifying information for a network interface, for multicast purposes.
Definition: common.h:364
This structure should not be manipulated directly - use the macros to access it:
Definition: common.h:214