Skip to content

Commit fe30c42

Browse files
committed
include: add doxygen documentation
Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
1 parent b4fdab6 commit fe30c42

8 files changed

Lines changed: 208 additions & 0 deletions

File tree

include/pouch_gateway/bt/cert.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,9 @@
66

77
#pragma once
88

9+
/**
10+
* Start certificate exchange for the given Bluetooth connection.
11+
*
12+
* @param conn The Bluetooth connection.
13+
*/
914
void pouch_gateway_cert_exchange_start(struct bt_conn *conn);

include/pouch_gateway/bt/connect.h

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,31 @@
1010

1111
#include <pouch_gateway/types.h>
1212

13+
/**
14+
* Get the node info for the given Bluetooth connection.
15+
*
16+
* @param conn The Bluetooth connection.
17+
* @return Pointer to the node info structure.
18+
*/
1319
struct pouch_gateway_node_info *pouch_gateway_get_node_info(const struct bt_conn *conn);
1420

21+
/**
22+
* Start Bluetooth operations for the given connection.
23+
*
24+
* @param conn The Bluetooth connection.
25+
*/
26+
void pouch_gateway_bt_start(struct bt_conn *conn);
27+
28+
/**
29+
* Stop Bluetooth operations for the given connection.
30+
*
31+
* @param conn The Bluetooth connection.
32+
*/
33+
void pouch_gateway_bt_stop(struct bt_conn *conn);
34+
35+
/**
36+
* Finish Bluetooth operations for the given connection.
37+
*
38+
* @param conn The Bluetooth connection.
39+
*/
1540
void pouch_gateway_bt_finished(struct bt_conn *conn);

include/pouch_gateway/bt/downlink.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,17 @@
66

77
#pragma once
88

9+
/**
10+
* Start downlink for the given Bluetooth connection.
11+
*
12+
* @param conn The Bluetooth connection.
13+
* @return Pointer to the downlink context.
14+
*/
915
struct pouch_gateway_downlink_context *pouch_gateway_downlink_start(struct bt_conn *conn);
16+
17+
/**
18+
* Clean up downlink resources for the given Bluetooth connection.
19+
*
20+
* @param conn The Bluetooth connection.
21+
*/
1022
void pouch_gateway_downlink_cleanup(struct bt_conn *conn);

include/pouch_gateway/bt/scan.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,7 @@
66

77
#pragma once
88

9+
/**
10+
* Start Bluetooth scanning for devices.
11+
*/
912
void pouch_gateway_scan_start(void);

include/pouch_gateway/bt/uplink.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,16 @@
66

77
#pragma once
88

9+
/**
10+
* Start uplink for the given Bluetooth connection.
11+
*
12+
* @param conn The Bluetooth connection.
13+
*/
914
void pouch_gateway_uplink_start(struct bt_conn *conn);
15+
16+
/**
17+
* Clean up uplink resources for the given Bluetooth connection.
18+
*
19+
* @param conn The Bluetooth connection.
20+
*/
1021
void pouch_gateway_uplink_cleanup(struct bt_conn *conn);

include/pouch_gateway/cert.h

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,85 @@ struct pouch_gateway_server_cert_context;
1313
#include <stdbool.h>
1414
#include <stddef.h>
1515

16+
/**
17+
* Start device certificate handling.
18+
*
19+
* @return Pointer to the device certificate context.
20+
*/
1621
struct pouch_gateway_device_cert_context *pouch_gateway_device_cert_start(void);
22+
23+
/**
24+
* Push data to the device certificate context.
25+
*
26+
* @param context The device certificate context.
27+
* @param data The data to push.
28+
* @param len The length of the data.
29+
* @return 0 on success, negative on error.
30+
*/
1731
int pouch_gateway_device_cert_push(struct pouch_gateway_device_cert_context *context, const void *data, size_t len);
32+
33+
/**
34+
* Abort device certificate handling.
35+
*
36+
* @param context The device certificate context.
37+
*/
1838
void pouch_gateway_device_cert_abort(struct pouch_gateway_device_cert_context *context);
39+
40+
/**
41+
* Finish device certificate handling.
42+
*
43+
* @param context The device certificate context.
44+
* @return 0 on success, negative on error.
45+
*/
1946
int pouch_gateway_device_cert_finish(struct pouch_gateway_device_cert_context *context);
2047

48+
/**
49+
* Start server certificate handling.
50+
*
51+
* @return Pointer to the server certificate context.
52+
*/
2153
struct pouch_gateway_server_cert_context *pouch_gateway_server_cert_start(void);
54+
55+
/**
56+
* Abort server certificate handling.
57+
*
58+
* @param context The server certificate context.
59+
*/
2260
void pouch_gateway_server_cert_abort(struct pouch_gateway_server_cert_context *context);
61+
62+
/**
63+
* Check if the server certificate is the newest.
64+
*
65+
* @param context The server certificate context.
66+
* @return True if newest, false otherwise.
67+
*/
2368
bool pouch_gateway_server_cert_is_newest(const struct pouch_gateway_server_cert_context *context);
69+
70+
/**
71+
* Check if the server certificate is complete.
72+
*
73+
* @param context The server certificate context.
74+
* @return True if complete, false otherwise.
75+
*/
2476
bool pouch_gateway_server_cert_is_complete(const struct pouch_gateway_server_cert_context *context);
77+
78+
/**
79+
* Get data from the server certificate context.
80+
*
81+
* @param context The server certificate context.
82+
* @param dst Destination buffer.
83+
* @param dst_len Length of the destination buffer.
84+
* @param is_last True if this is the last chunk.
85+
* @return 0 on success, negative on error.
86+
*/
2587
int pouch_gateway_server_cert_get_data(struct pouch_gateway_server_cert_context *context,
2688
void *dst,
2789
size_t *dst_len,
2890
bool *is_last);
2991

92+
/**
93+
* Callback when connected to Golioth client for certificate module.
94+
*
95+
* @param client The Golioth client.
96+
*/
3097
void pouch_gateway_cert_module_on_connected(struct golioth_client *client);

include/pouch_gateway/downlink.h

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,73 @@
1111
struct pouch_gateway_downlink_context;
1212
typedef void (*pouch_gateway_downlink_data_available_cb)(void *);
1313

14+
/**
15+
* Initialize the downlink module with the Golioth client.
16+
*
17+
* @param client The Golioth client.
18+
*/
1419
void pouch_gateway_downlink_module_init(struct golioth_client *client);
20+
21+
/**
22+
* Initialize a downlink context.
23+
*
24+
* @param data_available_cb Callback for when data is available.
25+
* @param arg Argument for the callback.
26+
* @return Pointer to the downlink context.
27+
*/
1528
struct pouch_gateway_downlink_context *pouch_gateway_downlink_init(pouch_gateway_downlink_data_available_cb data_available_cb, void *arg);
29+
30+
/**
31+
* Finish the downlink context.
32+
*
33+
* @param downlink The downlink context.
34+
*/
1635
void pouch_gateway_downlink_finish(struct pouch_gateway_downlink_context *downlink);
36+
37+
/**
38+
* Abort the downlink context.
39+
*
40+
* @param downlink The downlink context.
41+
*/
1742
void pouch_gateway_downlink_abort(struct pouch_gateway_downlink_context *downlink);
43+
44+
/**
45+
* Get data from the downlink context.
46+
*
47+
* @param downlink The downlink context.
48+
* @param dst Destination buffer.
49+
* @param dst_len Length of the destination buffer.
50+
* @param is_last true if this is the last chunk.
51+
* @return 0 on success, negative on error.
52+
*/
1853
int pouch_gateway_downlink_get_data(struct pouch_gateway_downlink_context *downlink, void *dst, size_t *dst_len, bool *is_last);
54+
55+
/**
56+
* Check if the downlink is complete.
57+
*
58+
* @param downlink The downlink context.
59+
* @return true if complete, false otherwise.
60+
*/
1961
bool pouch_gateway_downlink_is_complete(const struct pouch_gateway_downlink_context *downlink);
2062

63+
/**
64+
* Block callback for downlink data.
65+
*
66+
* @param data The data received.
67+
* @param len The length of the data.
68+
* @param is_last True if this is the last block.
69+
* @param arg User argument.
70+
* @return Golioth status.
71+
*/
2172
enum golioth_status pouch_gateway_downlink_block_cb(const uint8_t *data, size_t len, bool is_last, void *arg);
73+
74+
/**
75+
* End callback for downlink.
76+
*
77+
* @param status Golioth status.
78+
* @param coap_rsp_code CoAP response code.
79+
* @param arg User argument.
80+
*/
2281
void pouch_gateway_downlink_end_cb(enum golioth_status status,
2382
const struct golioth_coap_rsp_code *coap_rsp_code,
2483
void *arg);

include/pouch_gateway/uplink.h

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,38 @@ struct pouch_block;
1818

1919
struct pouch_gateway_uplink;
2020

21+
/**
22+
* Write data to the uplink.
23+
*
24+
* @param uplink The uplink context.
25+
* @param payload The payload to write.
26+
* @param len The length of the payload.
27+
* @param is_last true if this is the last chunk.
28+
* @return 0 on success, negative on error.
29+
*/
2130
int pouch_gateway_uplink_write(struct pouch_gateway_uplink *uplink,
2231
const uint8_t *payload,
2332
size_t len,
2433
bool is_last);
2534

35+
/**
36+
* Open an uplink for the given downlink context.
37+
*
38+
* @param downlink The downlink context.
39+
* @return Pointer to the uplink context.
40+
*/
2641
struct pouch_gateway_uplink *pouch_gateway_uplink_open(struct pouch_gateway_downlink_context *downlink);
42+
43+
/**
44+
* Close the uplink.
45+
*
46+
* @param uplink The uplink context.
47+
*/
2748
void pouch_gateway_uplink_close(struct pouch_gateway_uplink *uplink);
2849

50+
/**
51+
* Initialize the uplink module with the Golioth client.
52+
*
53+
* @param c The Golioth client.
54+
*/
2955
void pouch_gateway_uplink_init(struct golioth_client *c);

0 commit comments

Comments
 (0)