19 #include "IDMessage.hpp"
20 #include <tobicore/TCException.hpp>
28 std::string IDMessage::TxtFamilyUndef(
"FamilyUndef");
29 std::string IDMessage::TxtFamilyBiosig(
"FamilyBiosig");
30 std::string IDMessage::TxtFamilyCustom(
"FamilyCustom");
32 IDMessage::IDMessage(
void) {
36 IDMessage::~IDMessage(
void) {
39 IDMessage::IDMessage(
IDMessage*
const other) {
46 this->_familyType = familyType;
48 this->_description =
"unset";
51 void IDMessage::Copy(
IDMessage*
const other) {
53 this->_event = other->GetEvent();
54 this->_familyType = other->GetFamilyType();
55 this->_description = other->GetDescription();
58 void IDMessage::Init(
void) {
60 this->_familyType = IDMessage::FamilyUndef;
61 this->_event = IDMessage::EventNull;
64 std::string IDMessage::GetDescription(
void)
const {
65 return this->_description;
68 void IDMessage::SetDescription(
const std::string& description) {
69 this->_description = description;
72 std::string IDMessage::GetSource(
void)
const {
73 return this->_description;
76 void IDMessage::SetSource(
const std::string& description) {
77 this->_description = description;
80 IDFvalue IDMessage::GetFamily(
void)
const {
82 switch(this->_familyType) {
83 case IDMessage::FamilyBiosig:
84 fvalue.assign(IDTYPES_FAMILY_BIOSIG);
86 case IDMessage::FamilyCustom:
87 fvalue.assign(IDTYPES_FAMILY_CUSTOM);
89 case IDMessage::FamilyUndef:
91 fvalue.assign(IDTYPES_FAMILY_UNDEF);
97 bool IDMessage::SetFamilyType(
const IDFtype type) {
98 if(type < IDMessage::FamilyUndef || type > IDMessage::FamilyCustom)
100 this->_familyType = type;
104 bool IDMessage::SetFamilyType(
const std::string& type) {
105 if(type.compare(IDMessage::TxtFamilyUndef) == 0)
106 this->_familyType = IDMessage::FamilyUndef;
107 else if(type.compare(IDMessage::TxtFamilyBiosig) == 0)
108 this->_familyType = IDMessage::FamilyBiosig;
109 else if(type.compare(IDMessage::TxtFamilyCustom) == 0)
110 this->_familyType = IDMessage::FamilyCustom;
116 IDFtype IDMessage::GetFamilyType(
void)
const {
117 return this->_familyType;
120 void IDMessage::SetEvent(
const IDevent event) {
121 this->_event = event;
124 IDevent IDMessage::GetEvent(
void)
const {
129 printf(
"[IDMessage::Dump] TOBI iD message for frame %d [%s]\n",
131 IDFvalue fvalue = this->GetFamily();
132 printf(
" + Event family %d/%s\n", this->GetFamilyType(), fvalue.c_str());
133 printf(
" + Event value %d\n", this->GetEvent());
138 if(family.compare(IDTYPES_FAMILY_BIOSIG) == 0)
139 return IDMessage::FamilyBiosig;
141 return IDMessage::FamilyUndef;