wireless.h
Go to the documentation of this file.
1 /*
2  * SocialLedge.com - Copyright (C) 2013
3  *
4  * This file is part of free software framework for embedded processors.
5  * You can use it and/or distribute it as long as this copyright header
6  * remains unmodified. The code is free for personal use and requires
7  * permission to use in a commercial product.
8  *
9  * THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED
10  * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
11  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
12  * I SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
13  * CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
14  *
15  * You can reach the author of this software at :
16  * p r e e t . w i k i @ g m a i l . c o m
17  */
18 
25 #ifndef WIRELESS_H__
26 #define WIRELESS_H__
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30 #include <stdbool.h>
31 #include "src/mesh.h"
32 #include "src/mesh_typedefs.h"
33 
34 
35 
41 bool wireless_init(void);
42 
50 void wireless_service(void);
51 
53 static inline bool wireless_is_ack_required(mesh_packet_t *pkt) {
54  return mesh_is_ack_required(pkt);
55 }
56 
58 static inline bool wireless_send(uint8_t dst_addr, mesh_protocol_t protocol, const void *data, uint8_t len, uint8_t max_hops) {
59  return mesh_send(dst_addr, protocol, data, len, max_hops);
60 }
61 
63 static inline bool wireless_send_formed_pkt(mesh_packet_t *pkt) {
64  return mesh_send_formed_pkt(pkt);
65 }
66 
68 #define wireless_form_pkt(pkt, dst, protocol, max_hops, num_ptrs, args...)\
69  mesh_form_pkt(pkt, dst, protocol, max_hops, num_ptrs, args)
70 
72 #define wireless_deform_pkt(pkt, num_ptrs, args...)\
73  mesh_deform_pkt(pkt, num_ptrs, args)
74 
92 char wireless_get_rx_pkt (mesh_packet_t *pkt, const uint32_t timeout_ms);
93 
95 char wireless_get_ack_pkt(mesh_packet_t *pkt, const uint32_t timeout_ms);
96 
99 int wireless_flush_rx(void);
100 
101 
102 
103 #ifdef __cplusplus
104 }
105 #endif
106 #endif /* WIRELESS_H__ */
Simple Mesh Network Algorithm.VERSION:
unsigned int unsigned int len
Definition: startup.cpp:197
void wireless_service(void)
Definition: wireless.c:113
bool wireless_init(void)
Definition: wireless.c:80
char wireless_get_rx_pkt(mesh_packet_t *pkt, const uint32_t timeout_ms)
Definition: wireless.c:93
Mesh type defines.
bool mesh_send_formed_pkt(mesh_packet_t *pkt)
Definition: mesh.c:1053
int wireless_flush_rx(void)
Definition: wireless.c:103
bool mesh_send(const uint8_t dst, const mesh_protocol_t type, const void *pData, const uint8_t len, const uint8_t hop_count_max)
Definition: mesh.c:928
mesh_protocol_t
Mesh packet type.
Definition: mesh_typedefs.h:86
char wireless_get_ack_pkt(mesh_packet_t *pkt, const uint32_t timeout_ms)
Same as wireless_get_rx_pkt(), except this will retrieve an ACK response.
Definition: wireless.c:98