Remove TODO file
[remote/remote-mci.git] / diku_mch / Mote.h
blob2be73b1681719c0c1e37f4bffc3021f996239463
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 {
9 /** MCH Mote
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
20 public:
21 /** Create a new mote.
23 * A newly created will automatically be validated using
24 * #validate().
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.
35 bool isValid();
37 /** Mark the mote invalid. */
38 void invalidate();
40 /** Validate mote.
42 * When validating a mote, information from files in the mote
43 * device directory are reread in order to check if the mote is
44 * still operational.
46 void validate();
48 /** Start programming a mote.
50 * This will fork a child process to do the actual programming.
52 * @param tos The tos address of the mote.
53 * @param image The flash image which to use.
54 * @param imagelen The length of the flash image data.
55 * @return SUCCESS if the programming was started.
57 result_t program(std::string tos, const uint8_t *image, uint32_t imagelen);
59 /** Get MAC address.
61 * @return The MAC address.
63 const std::string& getMac();
65 /** Get the physical device path.
67 * The physical device path contains information about where on
68 * the mote host the mote is attached. This includes information
69 * such as which PCI bus it uses, which USB interface etc, for
70 * example: "/devices/pci0000:00/0000:00:1d.0/usb1/1-1".
72 * This information is read from the "path" file in the mote
73 * device directory.
75 * @return The physical device path.
77 const std::string& getDevicePath();
79 /** Get platform name.
81 * Contains the name of the mote platform, for example "MicaZ"
82 * or "dig528-2".
84 * This information is read from the "platform" file in the mote
85 * device directory.
87 * @return The name of the mote's platform.
89 const std::string& getPlatform();
91 /** Get path to flash image file.
93 * This path can be used to temporarily save flash images when a
94 * mote is being reprogrammed.
96 * @return Path to flash image file.
98 std::string getImagePath();
100 private:
101 std::string mac; /**< MAC address. */
102 std::string directory; /**< Device directory path. */
103 std::string programmer; /**< Path to mote programmer binary. */
104 std::string path; /**< Physical device path. */
105 std::string platform; /**< Platform name. */
106 bool isvalid; /**< Valid flag. */
111 #endif