-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathKeyset.cpp
More file actions
executable file
·61 lines (46 loc) · 1.06 KB
/
Keyset.cpp
File metadata and controls
executable file
·61 lines (46 loc) · 1.06 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
#include <string.h>
#include "Global.h"
#include "Keyset.h"
static Keyset_t KeysetTable[256] = {
0xff,
};
s32
BCAS::Keyset::Register (const Keyset_t * Keyset)
{
if (Keyset == NULL)
return -1;
KeysetTable[Keyset->BroadcastGroupID] = *Keyset;
return 0;
}
void
BCAS::Keyset::Unregister (u8 BroadcasterGroupID)
{
KeysetTable[BroadcasterGroupID].BroadcastGroupID =
BroadcasterGroupID ^ 0xff;
}
s32
BCAS::Keyset::GetKey (u8 BroadcasterGroupID, u8 WorkKeyID, u8 * Key)
{
if (Key == NULL)
return -1;
Keyset_t *
Set = &KeysetTable[BroadcasterGroupID];
int
Index = WorkKeyID & 1;
if (Set->BroadcastGroupID != BroadcasterGroupID)
return -2;
if (Set->Keys[Index].WorkKeyID != WorkKeyID)
return -3;
memcpy (Key, Set->Keys[Index].Key, 8);
return 0;
}
s32
BCAS::Keyset::GetKeyset (u8 BroadcasterGroupID, Keyset_t & KS)
{
Keyset_t *
Set = &KeysetTable[BroadcasterGroupID];
if (Set->BroadcastGroupID != BroadcasterGroupID)
return -1;
KS = *Set;
return 0;
}