embkernel
 All Classes Functions Variables Typedefs Groups Pages
NetRemoteConfiguration.hpp
1 //------------------------------------------------------------------------------
2 //This file is part of embKernel.
3 //See license.txt for the full license governing this code.
4 //------------------------------------------------------------------------------
5 
6 #ifndef NET_REMOTE_CONFIGURATION_HPP_
7 #define NET_REMOTE_CONFIGURATION_HPP_
8 
9 #include "NetDefs.hpp"
10 
11 class NetRemoteConfiguration {
12  friend class NetUdp;
13 private:
14  const static uint8_t KEY = 0x5A;
15 
16  typedef enum
17  :uint16_t {
18  READ_CONFIG = 0x10,
19  READ_CONFIG_REPLY = 0x11,
20  WRITE_CONFIG = 0x12,
21  WRITE_CONFIG_REPLY = 0x13,
22  WRITE_MAC = 0x14,
23  WRITE_MAC_REPLY = 0x15,
24  } CMD;
25 
26  typedef struct {
27  CMD cmd;
28  uint16_t id;
29  NetDefs::MAC_ADDR macAddr;
30  uint8_t key;
31  uint8_t len;
32  } HEADER;
33 
34  typedef union {
35  struct {
36  HEADER hdr;
37  uint8_t data[256];
38  } generic;
39  struct {
40  HEADER hdr;
41  NetDefs::NET_CONFIG config;
42  } writeConfig;
43  struct {
44  HEADER hdr;
45  NetDefs::MAC_ADDR macAddr;
46  } writeMac;
47  } PKT;
48 
49  static void processFrame(NetDefs::FRAME& frame, int len);
50  static void sendReply(NetDefs::FRAME& frame, PKT* pkt);
51 };
52 
53 #endif /* NET_REMOTE_CONFIGURATION_HPP_ */