-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathVirtualButton.cpp
58 lines (48 loc) · 931 Bytes
/
VirtualButton.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#include "Arduino.h"
#include "VirtualButton.h"
VirtualButton::VirtualButton()
{
setup();
}
VirtualButton::VirtualButton(byte buttonType)
{
this->setup();
this->setType(buttonType);
}
void VirtualButton::setup()
{
//this->_value = 0;
}
void VirtualButton::setup(byte buttonType)
{
this->setup();
this->setType(buttonType);
}
void VirtualButton::setType(byte buttonType)
{
this->_type = buttonType;
}
byte VirtualButton::getType()
{
return this->_type;
}
void VirtualButton::setSound(const char *sound)
{
strcpy(this->_sound, sound);
}
char *VirtualButton::getSound(char sound[])
{
strcpy(sound, this->_sound);
return sound;
}
char *VirtualButton::getSettings()
{
char * buf = (char *) malloc (16);
//memset(settings, 0, sizeof(settings));
sprintf(buf, "%d", this->_type);
if (strcasecmp(this->_sound, "") != 0) {
strcat(buf, ",");
strcat(buf, this->_sound);
}
return buf;
}