2018-12-14 17:04:42 +01:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2018 dimercur
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __MESSAGES_H__
|
|
|
|
#define __MESSAGES_H__
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include "img.h"
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Message ID defined for system communication
|
|
|
|
*
|
|
|
|
* @brief List of available message ID
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
typedef enum {
|
|
|
|
//Generic messages
|
|
|
|
MESSAGE_EMPTY = 0,
|
|
|
|
MESSAGE_LOG,
|
|
|
|
|
|
|
|
// Message containing answer (after robot command, or for monitor)
|
2018-12-21 16:36:52 +01:00
|
|
|
MESSAGE_ANSWER_ACK,
|
|
|
|
MESSAGE_ANSWER_NACK,
|
|
|
|
MESSAGE_ANSWER_ROBOT_TIMEOUT,
|
|
|
|
MESSAGE_ANSWER_ROBOT_UNKNOWN_COMMAND,
|
|
|
|
MESSAGE_ANSWER_ROBOT_ERROR,
|
|
|
|
MESSAGE_ANSWER_COM_ERROR,
|
2019-01-04 16:55:48 +01:00
|
|
|
|
|
|
|
// Messages specific to server
|
|
|
|
MESSAGE_MONITOR_LOST,
|
|
|
|
|
2018-12-14 17:04:42 +01:00
|
|
|
// messages for serial communication with robot
|
2018-12-21 16:36:52 +01:00
|
|
|
MESSAGE_ROBOT_COM_OPEN,
|
|
|
|
MESSAGE_ROBOT_COM_CLOSE,
|
2018-12-19 09:15:42 +01:00
|
|
|
|
2019-04-11 12:29:21 +02:00
|
|
|
// Messages for camera from Monitor to Supervisor
|
2018-12-14 17:04:42 +01:00
|
|
|
MESSAGE_CAM_OPEN,
|
|
|
|
MESSAGE_CAM_CLOSE,
|
2018-12-21 16:36:52 +01:00
|
|
|
MESSAGE_CAM_ASK_ARENA,
|
|
|
|
MESSAGE_CAM_ARENA_CONFIRM,
|
|
|
|
MESSAGE_CAM_ARENA_INFIRM,
|
|
|
|
MESSAGE_CAM_POSITION_COMPUTE_START,
|
|
|
|
MESSAGE_CAM_POSITION_COMPUTE_STOP,
|
2019-04-11 12:29:21 +02:00
|
|
|
|
|
|
|
// Messages for camera from Supervisor to Monitor
|
2018-12-21 16:36:52 +01:00
|
|
|
MESSAGE_CAM_POSITION,
|
|
|
|
MESSAGE_CAM_IMAGE,
|
2018-12-14 17:04:42 +01:00
|
|
|
|
|
|
|
// Messages for robot
|
|
|
|
MESSAGE_ROBOT_PING,
|
|
|
|
MESSAGE_ROBOT_RESET,
|
|
|
|
MESSAGE_ROBOT_START_WITH_WD,
|
|
|
|
MESSAGE_ROBOT_START_WITHOUT_WD,
|
|
|
|
MESSAGE_ROBOT_RELOAD_WD,
|
|
|
|
MESSAGE_ROBOT_MOVE,
|
|
|
|
MESSAGE_ROBOT_TURN,
|
|
|
|
MESSAGE_ROBOT_GO_FORWARD,
|
2018-12-21 16:36:52 +01:00
|
|
|
MESSAGE_ROBOT_GO_BACKWARD,
|
2018-12-14 17:04:42 +01:00
|
|
|
MESSAGE_ROBOT_GO_LEFT,
|
|
|
|
MESSAGE_ROBOT_GO_RIGHT,
|
|
|
|
MESSAGE_ROBOT_STOP,
|
|
|
|
MESSAGE_ROBOT_POWEROFF,
|
2018-12-21 16:36:52 +01:00
|
|
|
MESSAGE_ROBOT_BATTERY_GET,
|
2018-12-14 17:04:42 +01:00
|
|
|
MESSAGE_ROBOT_BATTERY_LEVEL,
|
2018-12-21 16:36:52 +01:00
|
|
|
MESSAGE_ROBOT_STATE_GET,
|
|
|
|
MESSAGE_ROBOT_STATE_NOT_BUSY,
|
|
|
|
MESSAGE_ROBOT_STATE_BUSY
|
2018-12-14 17:04:42 +01:00
|
|
|
} MessageID;
|
|
|
|
|
|
|
|
typedef enum {
|
2018-12-19 09:15:42 +01:00
|
|
|
BATTERY_UNKNOWN=-1,
|
2018-12-14 17:04:42 +01:00
|
|
|
BATTERY_EMPTY=0,
|
|
|
|
BATTERY_LOW,
|
|
|
|
BATTERY_FULL
|
|
|
|
} BatteryLevel;
|
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Base class for messaging
|
|
|
|
*
|
|
|
|
* @brief Base class for messaging
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
class Message {
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
* Create a new, empty message
|
|
|
|
*/
|
|
|
|
Message();
|
|
|
|
|
2018-12-19 09:15:42 +01:00
|
|
|
/**
|
|
|
|
* Create a new, empty message
|
|
|
|
*/
|
|
|
|
Message(MessageID id);
|
|
|
|
|
2018-12-14 17:04:42 +01:00
|
|
|
/**
|
|
|
|
* Destroy message
|
|
|
|
*/
|
|
|
|
virtual ~Message();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Translate content of message into a string that can be displayed
|
|
|
|
* @return A string describing message contents
|
|
|
|
*/
|
|
|
|
virtual string ToString();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Allocate a new mesage and copy contents of current message
|
|
|
|
* @return A message, copy of current
|
|
|
|
*/
|
|
|
|
virtual Message* Copy();
|
|
|
|
|
2018-12-21 16:36:52 +01:00
|
|
|
/**
|
|
|
|
* Compare message ID
|
|
|
|
* @param id Id to compare message to
|
|
|
|
* @return true if id is equal to message id, false otherwise
|
|
|
|
*/
|
|
|
|
bool CompareID(MessageID id) {
|
|
|
|
return (this->messageID == id) ? true:false;
|
|
|
|
}
|
|
|
|
|
2018-12-14 17:04:42 +01:00
|
|
|
/**
|
|
|
|
* Get message ID
|
|
|
|
* @return Current message ID
|
|
|
|
*/
|
|
|
|
MessageID GetID() {
|
|
|
|
return messageID;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set message ID
|
|
|
|
* @param id Message ID
|
|
|
|
*/
|
2018-12-19 09:15:42 +01:00
|
|
|
virtual void SetID(MessageID id);
|
2018-12-14 17:04:42 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Comparison operator
|
|
|
|
* @param msg Message to be compared
|
|
|
|
* @return true if message are equal, false otherwise
|
|
|
|
*/
|
|
|
|
virtual bool operator==(const Message& msg) {
|
|
|
|
return (messageID == msg.messageID);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Difference operator
|
|
|
|
* @param msg Message to be compared
|
|
|
|
* @return true if message are different, false otherwise
|
|
|
|
*/
|
|
|
|
virtual bool operator!=(const Message& msg) {
|
|
|
|
return !(messageID == msg.messageID);
|
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
|
|
|
/**
|
|
|
|
* Message identifier (@see MessageID)
|
|
|
|
*/
|
|
|
|
MessageID messageID;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Verify if message ID is compatible with current message type
|
|
|
|
* @param id Message ID
|
|
|
|
* @return true, if message ID is acceptable, false otherwise
|
|
|
|
*/
|
|
|
|
virtual bool CheckID(MessageID id);
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Message class for holding float value, based on Message class
|
|
|
|
*
|
|
|
|
* @brief Float message class
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
class MessageInt : public Message {
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
* Create a new, empty float message
|
|
|
|
*/
|
|
|
|
MessageInt();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Create a new float message, with given ID and value
|
|
|
|
* @param id Message ID
|
|
|
|
* @param val Message value
|
|
|
|
* @throw std::runtime_error if message ID is incompatible with float data
|
|
|
|
*/
|
|
|
|
MessageInt(MessageID id, int val);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set message ID
|
|
|
|
* @param id Message ID
|
|
|
|
* @throw std::runtime_error if message ID is incompatible with float data
|
|
|
|
*/
|
|
|
|
void SetID(MessageID id);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get message value (int)
|
|
|
|
* @return int value
|
|
|
|
*/
|
|
|
|
int GetValue() {
|
|
|
|
return value;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set message value (int)
|
|
|
|
* @param val int value to store in message
|
|
|
|
*/
|
|
|
|
void SetValue(int val) {
|
|
|
|
this->value = val;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Translate content of message into a string that can be displayed
|
|
|
|
* @return A string describing message contents
|
|
|
|
*/
|
|
|
|
string ToString();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Allocate a new mesage and copy contents of current message
|
|
|
|
* @return A message, copy of current
|
|
|
|
*/
|
|
|
|
Message* Copy();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Comparison operator
|
|
|
|
* @param msg Message to be compared
|
|
|
|
* @return true if message are equal, false otherwise
|
|
|
|
*/
|
|
|
|
virtual bool operator==(const MessageInt& msg) {
|
|
|
|
return ((messageID == msg.messageID) && (value == msg.value));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Difference operator
|
|
|
|
* @param msg Message to be compared
|
|
|
|
* @return true if message are different, false otherwise
|
|
|
|
*/
|
|
|
|
virtual bool operator!=(const MessageInt& msg) {
|
|
|
|
return !((messageID == msg.messageID) && (value == msg.value));
|
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
|
|
|
/**
|
|
|
|
* Message integer value
|
|
|
|
*/
|
|
|
|
int value;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Verify if message ID is compatible with current message type
|
|
|
|
* @param id Message ID
|
|
|
|
* @return true, if message ID is acceptable, false otherwise
|
|
|
|
*/
|
|
|
|
bool CheckID(MessageID id);
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Message class for holding string value, based on Message class
|
|
|
|
*
|
|
|
|
* @brief String message class
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
class MessageString : public Message {
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
* Create a new, empty string message
|
|
|
|
*/
|
|
|
|
MessageString();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Create a new string message, with given ID and string
|
|
|
|
* @param id Message ID
|
|
|
|
* @param s Message string
|
|
|
|
* @throw std::runtime_error if message ID is incompatible with string data
|
|
|
|
*/
|
|
|
|
MessageString(MessageID id, string s);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set message ID
|
|
|
|
* @param id Message ID
|
|
|
|
* @throw std::runtime_error if message ID is incompatible with string data
|
|
|
|
*/
|
|
|
|
void SetID(MessageID id);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get message string
|
|
|
|
* @return String
|
|
|
|
*/
|
|
|
|
string GetString() {
|
|
|
|
return s;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set message string
|
|
|
|
* @param s String to store in message
|
|
|
|
*/
|
|
|
|
void SetString(string s) {
|
|
|
|
this->s = s;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Translate content of message into a string that can be displayed
|
|
|
|
* @return A string describing message contents
|
|
|
|
*/
|
|
|
|
string ToString();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Allocate a new message and copy contents of current message
|
|
|
|
* @return A message, copy of current
|
|
|
|
*/
|
|
|
|
Message* Copy();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Comparison operator
|
|
|
|
* @param msg Message to be compared
|
|
|
|
* @return true if message are equal, false otherwise
|
|
|
|
*/
|
|
|
|
virtual bool operator==(const MessageString& msg) {
|
|
|
|
return ((messageID == msg.messageID) && (s == msg.s));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Difference operator
|
|
|
|
* @param msg Message to be compared
|
|
|
|
* @return true if message are different, false otherwise
|
|
|
|
*/
|
|
|
|
virtual bool operator!=(const MessageString& msg) {
|
|
|
|
return !((messageID == msg.messageID) && (s == msg.s));
|
|
|
|
}
|
|
|
|
protected:
|
|
|
|
/**
|
|
|
|
* Message content
|
|
|
|
*/
|
|
|
|
string s;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Verify if message ID is compatible with current message type
|
|
|
|
* @param id Message ID
|
|
|
|
* @return true, if message ID is acceptable, false otherwise
|
|
|
|
*/
|
|
|
|
bool CheckID(MessageID id);
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Message class for holding image, based on Message class
|
|
|
|
*
|
|
|
|
* @brief Image message class
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
class MessageImg : public Message {
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
* Create a new, empty image message
|
|
|
|
*/
|
|
|
|
MessageImg();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Create a new image message, with given ID and boolean value
|
|
|
|
* @param id Message ID
|
|
|
|
* @param image Pointer to image
|
|
|
|
* @throw std::runtime_error if message ID is incompatible with image message
|
|
|
|
*/
|
2019-01-04 16:55:48 +01:00
|
|
|
MessageImg(MessageID id, Img *image);
|
2018-12-14 17:04:42 +01:00
|
|
|
|
2018-12-19 09:15:42 +01:00
|
|
|
/**
|
|
|
|
* Destroy Image message
|
|
|
|
*/
|
|
|
|
virtual ~MessageImg();
|
|
|
|
|
2018-12-14 17:04:42 +01:00
|
|
|
/**
|
|
|
|
* Set message ID
|
|
|
|
* @param id Message ID
|
2019-01-15 16:25:48 +01:00
|
|
|
* @throw std::runtime_error if message ID is incompatible with image message
|
2018-12-14 17:04:42 +01:00
|
|
|
*/
|
|
|
|
void SetID(MessageID id);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get message image
|
|
|
|
* @return Pointer to image
|
|
|
|
*/
|
|
|
|
Img* GetImage() {
|
|
|
|
return image;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set message image
|
|
|
|
* @param image Pointer to image object
|
|
|
|
*/
|
2018-12-19 09:15:42 +01:00
|
|
|
void SetImage(Img* image);
|
2018-12-14 17:04:42 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Translate content of message into a string that can be displayed
|
|
|
|
* @return A string describing message contents
|
|
|
|
*/
|
|
|
|
string ToString();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Allocate a new message and copy contents of current message
|
|
|
|
* @return A message, copy of current
|
|
|
|
*/
|
|
|
|
Message* Copy();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
/**
|
|
|
|
* Message image
|
|
|
|
*/
|
|
|
|
Img* image;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Verify if message ID is compatible with current message type
|
|
|
|
* @param id Message ID
|
|
|
|
* @return true, if message ID is acceptable, false otherwise
|
|
|
|
*/
|
|
|
|
bool CheckID(MessageID id);
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Message class for holding position, based on Message class
|
|
|
|
*
|
|
|
|
* @brief Position message class
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
class MessagePosition : public Message {
|
|
|
|
public:
|
|
|
|
/**
|
2019-01-15 16:25:48 +01:00
|
|
|
* Create a new, empty position message
|
2018-12-14 17:04:42 +01:00
|
|
|
*/
|
|
|
|
MessagePosition();
|
|
|
|
|
|
|
|
/**
|
2019-01-15 16:25:48 +01:00
|
|
|
* Create a new position message, with given ID and position
|
2018-12-14 17:04:42 +01:00
|
|
|
* @param id Message ID
|
2018-12-19 09:15:42 +01:00
|
|
|
* @param pos Position
|
2018-12-14 17:04:42 +01:00
|
|
|
* @throw std::runtime_error if message ID is incompatible with image message
|
|
|
|
*/
|
2018-12-19 09:15:42 +01:00
|
|
|
MessagePosition(MessageID id, Position& pos);
|
2018-12-14 17:04:42 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Set message ID
|
|
|
|
* @param id Message ID
|
2019-01-15 16:25:48 +01:00
|
|
|
* @throw std::runtime_error if message ID is incompatible with position message
|
2018-12-14 17:04:42 +01:00
|
|
|
*/
|
|
|
|
void SetID(MessageID id);
|
|
|
|
|
|
|
|
/**
|
2019-01-15 16:25:48 +01:00
|
|
|
* Get position
|
|
|
|
* @return Position
|
2018-12-14 17:04:42 +01:00
|
|
|
*/
|
|
|
|
Position GetPosition() {
|
|
|
|
return pos;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2019-01-15 16:25:48 +01:00
|
|
|
* Set position
|
|
|
|
* @param pos Reference to position
|
2018-12-14 17:04:42 +01:00
|
|
|
*/
|
2018-12-19 09:15:42 +01:00
|
|
|
void SetPosition(Position& pos);
|
2018-12-14 17:04:42 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Translate content of message into a string that can be displayed
|
|
|
|
* @return A string describing message contents
|
|
|
|
*/
|
|
|
|
string ToString();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Allocate a new message and copy contents of current message
|
|
|
|
* @return A message, copy of current
|
|
|
|
*/
|
|
|
|
Message* Copy();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
/**
|
2019-01-15 16:25:48 +01:00
|
|
|
* Position
|
2018-12-14 17:04:42 +01:00
|
|
|
*/
|
|
|
|
Position pos;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Verify if message ID is compatible with current message type
|
|
|
|
* @param id Message ID
|
|
|
|
* @return true, if message ID is acceptable, false otherwise
|
|
|
|
*/
|
|
|
|
bool CheckID(MessageID id);
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Message class for holding battery level, based on Message class
|
|
|
|
*
|
2019-01-15 16:25:48 +01:00
|
|
|
* @brief Battery message class
|
2019-04-11 12:29:21 +02:00
|
|
|
* How to use:
|
|
|
|
* 1. Ask the battery level to the robot:
|
|
|
|
* MessageBattery * msg;
|
|
|
|
* msg = (MessageBattery*)robot.Write(new Message(MESSAGE_ROBOT_BATTERY_GET));
|
|
|
|
* 2. Send the message, for example:
|
|
|
|
* monitor.send(msg);
|
|
|
|
* or
|
|
|
|
* WriteInQueue(&q_messageToMon, msg);
|
2018-12-14 17:04:42 +01:00
|
|
|
*/
|
|
|
|
class MessageBattery : public Message {
|
|
|
|
public:
|
|
|
|
/**
|
2019-01-15 16:25:48 +01:00
|
|
|
* Create a new, empty battery message
|
2018-12-14 17:04:42 +01:00
|
|
|
*/
|
|
|
|
MessageBattery();
|
|
|
|
|
|
|
|
/**
|
2019-01-15 16:25:48 +01:00
|
|
|
* Create a new battery message, with given ID and battery level
|
2018-12-14 17:04:42 +01:00
|
|
|
* @param id Message ID
|
2019-01-15 16:25:48 +01:00
|
|
|
* @param level Battery level
|
|
|
|
* @throw std::runtime_error if message ID is incompatible with battery message
|
2018-12-14 17:04:42 +01:00
|
|
|
*/
|
|
|
|
MessageBattery(MessageID id, BatteryLevel level);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set message ID
|
|
|
|
* @param id Message ID
|
2019-01-15 16:25:48 +01:00
|
|
|
* @throw std::runtime_error if message ID is incompatible with battery message
|
2018-12-14 17:04:42 +01:00
|
|
|
*/
|
|
|
|
void SetID(MessageID id);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get message image
|
2019-01-15 16:25:48 +01:00
|
|
|
* @return Battery level
|
2018-12-14 17:04:42 +01:00
|
|
|
*/
|
|
|
|
BatteryLevel GetLevel() {
|
|
|
|
return level;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2019-01-15 16:25:48 +01:00
|
|
|
* Set battery level
|
|
|
|
* @param level Battery level
|
2018-12-14 17:04:42 +01:00
|
|
|
*/
|
2018-12-19 09:15:42 +01:00
|
|
|
void SetLevel(BatteryLevel level);
|
2018-12-14 17:04:42 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Translate content of message into a string that can be displayed
|
|
|
|
* @return A string describing message contents
|
|
|
|
*/
|
|
|
|
string ToString();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Allocate a new message and copy contents of current message
|
|
|
|
* @return A message, copy of current
|
|
|
|
*/
|
|
|
|
Message* Copy();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
/**
|
2019-01-15 16:25:48 +01:00
|
|
|
* Battery level
|
2018-12-14 17:04:42 +01:00
|
|
|
*/
|
|
|
|
BatteryLevel level;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Verify if message ID is compatible with current message type
|
|
|
|
* @param id Message ID
|
|
|
|
* @return true, if message ID is acceptable, false otherwise
|
|
|
|
*/
|
|
|
|
bool CheckID(MessageID id);
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* __MESSAGES_H__ */
|
|
|
|
|