-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathL8SDecoder.hpp
More file actions
61 lines (47 loc) · 1.59 KB
/
L8SDecoder.hpp
File metadata and controls
61 lines (47 loc) · 1.59 KB
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
58
59
60
61
#pragma once
#include "core/core_defines.h"
#include "PagerDecoder.hpp"
// iBells ZJ-68 / L8S
// L8S — (L)ast (8) bits (S)traight order (non-reversed) (for pager number)
class L8SDecoder : public PagerDecoder {
private:
const uint32_t stationMask = 0b111111111111100000000000; // leading 13 bits (of 24) are station (let it be)
const uint32_t actionMask = 0b11100000000; // next 3 bits are action (possibly, just my guess, may be they are also station)
const uint32_t pagerMask = 0b11111111; // and the last 8 bits should be enough for pager number
const uint8_t stationOffset = 11;
const uint8_t actionOffset = 8;
public:
const char* GetShortName() {
return "L8S";
}
uint16_t GetStation(uint32_t data) {
return (data & stationMask) >> stationOffset;
}
uint16_t GetPager(uint32_t data) {
return data & pagerMask;
}
uint8_t GetActionValue(uint32_t data) {
return (data & actionMask) >> actionOffset;
}
PagerAction GetAction(uint32_t data) {
UNUSED(data);
return UNKNOWN;
}
uint32_t SetPager(uint32_t data, uint16_t pagerNum) {
return (data & ~pagerMask) | pagerNum;
}
uint32_t SetActionValue(uint32_t data, uint8_t actionValue) {
uint32_t actionCleared = data & ~actionMask;
return actionCleared | (actionValue << actionOffset);
}
uint32_t SetAction(uint32_t data, PagerAction action) {
UNUSED(action);
return data;
}
bool IsSupported(PagerAction) {
return false;
}
uint8_t GetActionsCount() {
return 8;
}
};