-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathIrKey.cpp
More file actions
44 lines (30 loc) · 762 Bytes
/
IrKey.cpp
File metadata and controls
44 lines (30 loc) · 762 Bytes
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
/*
IrKey.cpp - Infrared data foreach key of device
Saul bertuccio 10 apr 2017
Released into the public domain.
*/
#include "IrKey.h"
const String IrKey::props_names[] = { "name", "code" };
const IsValidFnc IrKey::validations[] = {
&Validation::isValidDeviceName,
&Validation::isValidDeviceKeyHexCode
};
IrKey::IrKey(const String & key_name, const String & code)
: Key(key_name),
code(code)
{}
String IrKey::getCode() {
return code;
}
String IrKey::getPropertyById(int id) {
switch (id) {
case (0): return getName();
case (1): return code;
default: return String("");
}
}
String IrKey::getPropertyNameById(int id) {
if (id < 0 || id >= IrKey::props_num)
return String("");
return IrKey::props_names[id];
}