NewAskSin
Main Page
Related Pages
Modules
Classes
Files
File List
File Members
All
Classes
Files
Functions
Variables
Groups
Pages
Send.h
1
//- -----------------------------------------------------------------------------------------------------------------------
2
// AskSin driver implementation
3
// 2013-08-03 <trilu@gmx.de> Creative Commons - http://creativecommons.org/licenses/by-nc-sa/3.0/de/
4
//- -----------------------------------------------------------------------------------------------------------------------
5
//- AskSin send function --------------------------------------------------------------------------------------------------
6
//- with a lot of support from martin876 at FHEM forum
7
//- -----------------------------------------------------------------------------------------------------------------------
8
9
#ifndef _SN_H
10
#define _SN_H
11
12
#include "HAL.h"
13
#define MaxDataLen 60 // maximum length of received bytes
14
15
16
class
SN
{
17
friend
class
AS
;
18
19
private
:
//---------------------------------------------------------------------------------------------------------
20
21
struct
s_mFlg {
22
uint8_t WKUP :1;
// 0x01: send initially to keep the device awake
23
uint8_t WKMEUP :1;
// 0x02: awake - hurry up to send messages
24
uint8_t CFG :1;
// 0x04: Device in Config mode
25
uint8_t :1;
26
uint8_t BURST :1;
// 0x10: set if burst is required by device
27
uint8_t BIDI :1;
// 0x20: response is expected
28
uint8_t RPTED :1;
// 0x40: repeated (repeater operation)
29
uint8_t RPTEN :1;
// 0x80: set in every message. Meaning?
30
};
31
32
struct
s_msgBody {
33
uint8_t mLen;
// message length
34
uint8_t mCnt;
// counter, if it is an answer counter has to reflect the answered message, otherwise own counter has to be used
35
struct
s_mFlg mFlg;
// see structure of message flags
36
uint8_t mTyp;
// type of message
37
uint8_t reID[3];
// sender ID
38
uint8_t toID[3];
// receiver id, broadcast for 0
39
uint8_t by10;
// type of message
40
uint8_t by11;
// type of message
41
uint8_t pyLd[MaxDataLen-12];
// payload
42
};
43
44
45
uint8_t retrCnt;
// variable to count how often a message was already send
46
uint8_t maxRetr;
// how often a message has to be send until ACK
47
uint8_t lastMsgCnt;
// store of message counter, needed to identify ACK
48
49
class
AS
*pHM;
// pointer to main class for function calls
50
51
protected
:
//---------------------------------------------------------------------------------------------------------
52
public
:
//---------------------------------------------------------------------------------------------------------
53
struct
s_msgBody mBdy;
// structure for easier message creation
54
uint8_t *buf;
// cast to byte array
55
56
uint8_t msgCnt;
// message counter for standard sends, while not answering something
57
58
uint8_t active :1;
// is send module active, 1 indicates yes
59
uint8_t timeOut :1;
// was last message a timeout
60
61
public
:
//---------------------------------------------------------------------------------------------------------
62
protected
:
//---------------------------------------------------------------------------------------------------------
63
private
:
//---------------------------------------------------------------------------------------------------------
64
65
SN
();
66
void
init(
AS
*ptrMain);
67
void
poll(
void
);
68
};
69
70
#endif
AS
Main class for implementation of the AskSin protocol stack. Every device needs exactly one instance o...
Definition:
AS.h:39
SN
Definition:
Send.h:16
Generated on Tue Jul 7 2015 21:39:16 for NewAskSin by
1.8.6