APM:Libraries
RCInput_SoloLink.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2017 Intel Corporation. All rights reserved.
3  *
4  * This file is free software: you can redistribute it and/or modify it
5  * under the terms of the GNU General Public License as published by the
6  * Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * This file is distributed in the hope that it will be useful, but
10  * WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12  * See the GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License along
15  * with this program. If not, see <http://www.gnu.org/licenses/>.
16  */
17 #pragma once
18 
19 #include <unistd.h>
20 
21 #include <AP_HAL/utility/Socket.h>
23 
24 #include "RCInput.h"
25 
26 namespace Linux {
27 
28 class RCInput_SoloLink : public RCInput
29 {
30 public:
32 
33  void init();
34  void _timer_tick();
35 
36 private:
37  static const unsigned int PACKET_LEN = 26;
38  static const unsigned int PORT = 5005;
39 
40  union packet {
41  struct PACKED {
42  uint64_t timestamp_usec;
45  };
46  uint8_t buf[PACKET_LEN];
47  };
48 
49  bool _check_hdr(ssize_t len);
50 
51  SocketAPM _socket{true};
52  uint64_t _last_usec = 0;
53  uint16_t _last_seq = 0;
54  union packet _packet;
55 };
56 
57 }
uint16_t __ap_bitwise le16_t
Definition: sparse-endian.h:35