PicoWAN SDK Documentation
message_picowan.h
1 /*
2  * message_picowan - The PicoWAN message layer
3  *
4  * Copyright (c) 2018, Archos S.A.
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions are met:
9  *
10  * * Redistributions of source code must retain the above copyright
11  * notice, this list of conditions and the following disclaimer.
12  * * Redistributions in binary form must reproduce the above copyright
13  * notice, this list of conditions and the following disclaimer in the
14  * documentation and/or other materials provided with the distribution.
15  * * Neither the name of Archos nor the names of its contributors may be
16  * used to endorse or promote products derived from this software without
17  * specific prior written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND
20  * AND EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22  * DISCLAIMED. IN NO EVENT SHALL ARCHOS S.A. BE LIABLE FOR ANY
23  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
26  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29  */
30 
31 #ifndef _MESSAGE_PICOWAN_H_
32 #define _MESSAGE_PICOWAN_H_
33 
34 #include <message_common.h>
35 #include <message_interface.h>
36 
37 
38 // MHDR + address + fcnt
39 
40 #define MSG_PICOWAN_MHDR_LEN (sizeof(uint8_t))
41 #define MSG_PICOWAN_ADDR_LEN (sizeof(uint32_t))
42 #define MSG_PICOWAN_FCNT_LEN (sizeof(uint8_t))
43 
44 #define MSG_PICOWAN_MIC_LEN (sizeof(uint32_t))
45 
46 #define MSG_PICOWAN_HEADER_MIN_LEN (MSG_PICOWAN_MHDR_LEN + MSG_PICOWAN_ADDR_LEN + MSG_PICOWAN_FCNT_LEN)
47 
48 enum {
49  // Data frame format
50  MSG_PICOWAN_OFF_DAT_MHDR = 0,
51  MSG_PICOWAN_OFF_DAT_ADDR = 1,
52  MSG_PICOWAN_OFF_DAT_FCNT = 5,
53  MSG_PICOWAN_OFF_DAT_PAYLOAD = 6
54 };
55 
56 
57 enum { MSG_PICOWAN_VERSION_V1 = 0x00,
58 };
59 
60 typedef union {
61  uint8_t value;
62  struct {
63  uint8_t direction : 1;
64  uint8_t ack : 1;
65  uint8_t mac : 1;
66  uint8_t join : 1;
67  uint8_t rfu : 2;
68  uint8_t version : 2;
69  } bits;
71 
72 
73 typedef struct {
76 
77 extern message_interface_t message_picowan;
78 
79 #endif /* _MESSAGE_PICOWAN_H_ */
Definition: message_picowan.h:60
Definition: message_interface.h:37
Definition: message_picowan.h:73