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"
12 #include "DeviceManager.h"
14 #include "Configuration.h"
16 #include <sys/select.h>
21 namespace remote
{ namespace diku_mch
{
23 using namespace protocols
;
24 using namespace protocols::diku_host_server
;
25 using namespace protocols::motecontrol
;
30 static int main(int argc
,char** argv
);
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