summaryrefslogtreecommitdiffhomepage
path: root/digital/beacon/src/network.h
blob: c9734df4dde86b6ed5ab88535c2fd69c0ae71a4d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/**************************************************************************//**
  \file Peer2Peer.h

  \brief Peer-2-peer sample application header file.

  \author
    Atmel Corporation: http://www.atmel.com \n
    Support email: avr@atmel.com

  Copyright (c) 2008 , Atmel Corporation. All rights reserved.
  Licensed under Atmel's Limited License Agreement (BitCloudTM).

  \internal
    History:
    14.10.09 A. Taradov - Added FIFO for received packets
******************************************************************************/

#ifndef _NETWORK_H
#define _NETWORK_H

// #define MAX_RETRIES_BEFORE_REJOIN 6

// typedef struct
// {
// 	uint8_t header[APS_ASDU_OFFSET];
// 	uint8_t data;
// 	uint8_t footer[APS_AFFIX_LENGTH - APS_ASDU_OFFSET];
// }buff_t;


typedef struct
{
  uint8_t messageId;                           // message ID
  uint8_t data[APP_MAX_PACKET_SIZE];           // data
}AppMessage_t;

// Application network messsage buffer descriptor
typedef struct
{
  uint8_t header[APS_ASDU_OFFSET];                    // Auxiliary header (required by stack)
  AppMessage_t message;                               // Application message
  uint8_t footer[APS_AFFIX_LENGTH - APS_ASDU_OFFSET]; // Auxiliary footer (required by stack)
}AppMessageBuffer_t;




void APS_DataIndication(APS_DataInd_t* dataInd);
void APS_DataConf(APS_DataConf_t* confInfo);
void ZDO_StartNetworkConf(ZDO_StartNetworkConf_t* confirmInfo);
void initNetwork(void);
void startNetwork(void);
void send_data(void);
void send_angle(int angle_degree);

#endif // ifndef _NETWORK_H

// eof network.h