MySensors Library & Examples  2.3.2-62-ge298769
StrategyLinkBase.h
1 
2 /* StrategyLinkBase
3 
4  Proposed and developed by Fred Larsen
5  ___________________________________________________________________________
6 
7  Copyright 2010-2020 Giovanni Blu Mitolo [email protected]
8 
9  Licensed under the Apache License, Version 2.0 (the "License");
10  you may not use this file except in compliance with the License.
11  You may obtain a copy of the License at
12 
13  http://www.apache.org/licenses/LICENSE-2.0
14 
15  Unless required by applicable law or agreed to in writing, software
16  distributed under the License is distributed on an "AS IS" BASIS,
17  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  See the License for the specific language governing permissions and
19  limitations under the License. */
20 
21 #pragma once
22 
24 {
25 public:
26 
27  /* Returns delay related to the attempts passed as parameter: */
28 
29  virtual uint32_t back_off(uint8_t attempts) = 0;
30 
31 
32  /* Begin method, to be called on initialization */
33 
34  virtual bool begin(uint8_t did = 0) = 0;
35 
36 
37  /* Check if the channel is free for transmission */
38 
39  virtual bool can_start() = 0;
40 
41 
42  /* Returns the maximum number of attempts for each transmission: */
43 
44  virtual uint8_t get_max_attempts() = 0;
45 
46  /* Returns the recommended receive time for this strategy: */
47 
48  virtual uint16_t get_receive_time() = 0;
49 
50  /* Handle a collision: */
51 
52  virtual void handle_collision() = 0;
53 
54 
55  /* Receive a frame: */
56 
57  virtual uint16_t receive_frame(uint8_t *data, uint16_t max_length) = 0;
58 
59 
60  /* Receive byte response: */
61 
62  virtual uint16_t receive_response() = 0;
63 
64 
65  /* Send byte response to package transmitter: */
66 
67  virtual void send_response(uint8_t response) = 0;
68 
69 
70  /* Send a frame: */
71 
72  virtual void send_frame(uint8_t *data, uint16_t length) = 0;
73 };
data
char data[MAX_PAYLOAD_SIZE+1]
Buffer for raw payload data.
Definition: MyMessage.h:654
StrategyLinkBase
Definition: StrategyLinkBase.h:23