1 #ifndef REMOTE_MCH_MOTE_H
2 #define REMOTE_MCH_MOTE_H
4 #include "libutil/File.h"
5 #include "SerialControl.h"
7 namespace remote
{ namespace diku_mch
{
11 * This class is used for keeping track of information from the mote
12 * device directory and whether a mote is valid. A mote object is
13 * created for each mote attached to a mote host.
15 * All the lowlevel control of the serial connection to the mote is
16 * done via the subclassed #SerialControl class.
18 class Mote
: public SerialControl
21 /** Create a new mote.
23 * A newly created will automatically be validated using
26 * @param mac The mote's MAC address.
27 * @param directory The mote device directory.
29 Mote(std::string
& mac
, std::string
& directory
);
31 /** Is the mote valid?
33 * @return True if the mote is valid.
37 /** Mark the mote invalid. */
42 * When validating a mote, information from files in the mote
43 * device directory are reread in order to check if the mote is
50 * @return The MAC address.
52 const std::string
& getMac();
54 /** Get the physical device path.
56 * The physical device path contains information about where on
57 * the mote host the mote is attached. This includes information
58 * such as which PCI bus it uses, which USB interface etc, for
59 * example: "/devices/pci0000:00/0000:00:1d.0/usb1/1-1".
61 * This information is read from the "path" file in the mote
64 * @return The physical device path.
66 const std::string
& getDevicePath();
68 /** Get platform name.
70 * Contains the name of the mote platform, for example "MicaZ"
73 * This information is read from the "platform" file in the mote
76 * @return The name of the mote's platform.
78 const std::string
& getPlatform();
80 /** Get mote programmer path.
82 * When programming the mote this path should be used.
84 * The programmer path is derived "programmer" file in the mote
85 * device directory. It is a symlink pointing to a binary or
86 * script on the system capable of programming the mote.
88 * @return The path to the mote programmer binary.
90 std::string
getProgrammerPath();
92 /** Get path to flash image file.
94 * This path can be used to temporarily save flash images when a
95 * mote is being reprogrammed.
97 * @return Path to flash image file.
99 std::string
getImagePath();
102 std::string mac
; /**< MAC address. */
103 std::string directory
; /**< Device directory path. */
104 std::string path
; /**< Physical device path. */
105 std::string platform
; /**< Platform name. */
106 bool isvalid
; /**< Valid flag. */