Initial commit
[remote/remote-mci.git] / diku_mch / MoteHost.h
blob1f5fec621ad1fbf7257ffce4bd5007885da8875e
1 #ifndef _MOTEHOST_H_
2 #define _MOTEHOST_H_
4 #include "types.h"
5 #include "tcputil.h"
6 #include "Message.h"
7 #include "motecontrol/MoteMsg.h"
8 #include "diku_host_server/HostMsg.h"
9 #include "diku_host_server/MsgMoteConnectionInfoList.h"
10 #include "diku_host_server/MsgMoteAddresses.h"
11 #include "macros.h"
12 #include "DeviceManager.h"
13 #include "Mote.h"
14 #include "Configuration.h"
16 #include <sys/select.h>
18 #include <string>
19 #include <unistd.h>
21 namespace remote { namespace diku_mch {
23 using namespace protocols;
24 using namespace protocols::diku_host_server;
25 using namespace protocols::motecontrol;
27 class MoteHost
29 public:
30 static int main(int argc,char** argv);
31 private:
32 static void lookForServer();
33 static bool makeMoteInfoList(motemap_t& motelist, MsgMoteConnectionInfoList& infolist);
34 static void serviceLoop();
35 static void handlePlugEvent();
36 static void handleMessage();
37 static void handleRequest(Mote* mote,MsgMoteAddresses& addresses, MsgRequest& request);
38 static void handleMoteData(Mote* p_mote);
39 static int rebuildFdSet(fd_set& fdset);
40 static bool program(Mote* p_mote, uint16_t tosAddress, MsgPayload& image);
41 static int clientsock; // port for the server connection
42 static int plugpipe; // pipe for plug events
43 static fd_set fdset;
44 static Message msg;
49 #endif