1 #ifndef REMOTE_MCH_DEVICEMANAGER_H
2 #define REMOTE_MCH_DEVICEMANAGER_H
7 namespace remote
{ namespace mch
{
9 typedef std::map
<std::string
, Mote
*> motemap_t
;
11 /** MCH Mote device manager.
13 * The device manager maintains a database of known motes and their
14 * status. The database consists of three mote maps: one containing
15 * newly discovered motes, one with motes that are no longer available,
16 * and a map containing all currently valid and operational motes.
17 * The database can be updated using #refresh().
22 motemap_t motes
; /**< The current valid motes. */
23 motemap_t newMotes
; /**< Motes that were just attached. */
24 motemap_t lostMotes
; /**< Motes that were just detached. */
26 /** Refresh the mote device database.
28 * Update the registered devices to match the existing system using a
29 * "mark and sweep" approach. First all motes are marked invalid
30 * after which the mote device hierarchy is iterated to revalidate all
31 * available mote. Finally, motes that are still invalid are moved to
34 * @param devicePath The path to the mote devices.
36 void refresh(std::string devicePath
);
39 /** Traverse and update all available motes.
41 * Traverses all mote device directories under the given
42 * device path and updates the mote.
44 * @param devicePath The path to the mote devices.
46 void readMoteDevices(std::string devicePath
);
48 /** Update mote information.
50 * If the mote already exists it is validated using
51 * #mch::Mote::validate else a new mote is created
52 * and placed in both #motes and #newMotes.
54 * @param mac The MAC address of the mote.
55 * @param directory The device directory of the mote.
57 void updateMote(std::string mac
, std::string directory
);