RDMnet  HEAD (unstable)
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 
89 typedef struct LlrpTargetConfig
90 {
91  /************************************************************************************************
92  * Required Values
93  ***********************************************************************************************/
94 
99 
100  /************************************************************************************************
101  * Optional Values
102  ***********************************************************************************************/
103 
108  uint8_t* response_buf;
109 
114  RdmUid uid;
116 
128 #define LLRP_TARGET_CONFIG_DEFAULT_INIT(manu_id) \
129  { \
130  {{0}}, {NULL, NULL}, NULL, { (0x8000 | manu_id), 0 } \
131  }
132 
133 void llrp_target_config_init(LlrpTargetConfig* config, uint16_t manufacturer_id);
134 
137 
139  const LlrpSavedRdmCommand* received_cmd,
140  const uint8_t* response_data,
141  uint8_t response_data_len);
143  const LlrpSavedRdmCommand* received_cmd,
144  rdm_nack_reason_t nack_reason);
145 
146 #ifdef __cplusplus
147 }
148 #endif
149 
154 #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:99
int llrp_target_t
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:79
struct LlrpTargetCallbacks LlrpTargetCallbacks
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:163
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:196
etcpal_error_t llrp_target_destroy(llrp_target_t handle)
Destroy an LLRP target instance.
Definition: llrp_target.c:134
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.
Definition: message.h:440
Definition: message.h:460
Definition: llrp_target.h:78
LlrpTargetRdmCommandReceivedCallback rdm_command_received
Definition: llrp_target.h:79
void * context
Definition: llrp_target.h:80
A set of information that defines the startup parameters of an LLRP Target.
Definition: llrp_target.h:90
EtcPalUuid cid
Definition: llrp_target.h:96
uint8_t * response_buf
Definition: llrp_target.h:108
LlrpTargetCallbacks callbacks
Definition: llrp_target.h:98
RdmUid uid
Definition: llrp_target.h:114
Definition: common.h:217