Host Communication Protocol  2.0
fpc_hcp.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2020 Fingerprint Cards AB
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  * https://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 
22 #ifndef FPC_HCP_H
23 #define FPC_HCP_H
24 
25 #include <stdbool.h>
26 #include <stdint.h>
27 
28 #include "fpc_hcp_common.h"
29 #include "fpc_com_chain.h"
30 
31 #ifdef __cplusplus
32 extern "C" {
33 #endif /* __cplusplus */
34 
43 
52 
66 bool fpc_hcp_arg_add(fpc_hcp_packet_t *packet, fpc_hcp_arg_t arg, uint16_t size, bool free_data,
67  void *data);
68 
77 
86 
101 bool fpc_hcp_arg_copy_data(fpc_hcp_packet_t *packet, fpc_hcp_arg_t arg, uint16_t data_size,
102  uint8_t *data);
103 
110 void fpc_hcp_free(fpc_com_chain_t *chain, fpc_hcp_packet_t *packet);
111 
119 uint16_t fpc_hcp_get_size(fpc_hcp_packet_t *packet, uint16_t *num_args);
120 
121 #ifdef __cplusplus
122 }
123 #endif /* __cplusplus */
124 
125 #endif /* FPC_HCP_H */
bool fpc_hcp_arg_check(fpc_hcp_packet_t *packet, fpc_hcp_arg_t arg)
Check if command contains selected argument key.
Definition: fpc_hcp.c:169
Application Command Packet.
fpc_hcp_arg_data_t * fpc_hcp_arg_get(fpc_hcp_packet_t *packet, fpc_hcp_arg_t arg)
Get Argument with specified key.
Definition: fpc_hcp.c:173
Communication chain type definitions.
Command Argument.
bool fpc_hcp_arg_add(fpc_hcp_packet_t *packet, fpc_hcp_arg_t arg, uint16_t size, bool free_data, void *data)
Add argument to packet.
Definition: fpc_hcp.c:145
fpc_com_result_t fpc_hcp_receive(fpc_hcp_packet_t *packet, fpc_com_chain_t *chain)
Receives an application packet through the supplied transmit chain.
Definition: fpc_hcp.c:117
uint16_t fpc_hcp_arg_t
uint16_t fpc_hcp_get_size(fpc_hcp_packet_t *packet, uint16_t *num_args)
Calculate serialized packet size.
Definition: fpc_hcp.c:64
bool fpc_hcp_arg_copy_data(fpc_hcp_packet_t *packet, fpc_hcp_arg_t arg, uint16_t data_size, uint8_t *data)
Copy data from an argument with specified key.
Definition: fpc_hcp.c:183
fpc_com_result_t fpc_hcp_transmit(fpc_hcp_packet_t *packet, fpc_com_chain_t *chain)
Transmits an application packet through the supplied transmit chain.
Definition: fpc_hcp.c:89
uint8_t fpc_com_result_t
Host Communication Protocol common type definitions.
void fpc_hcp_free(fpc_com_chain_t *chain, fpc_hcp_packet_t *packet)
Frees the resources held by the packet i.e. the dynamic data held in the arguments.
Definition: fpc_hcp.c:198