forked from fbeek/pimatic-maxcul
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathculpacket.coffee
67 lines (50 loc) · 1.82 KB
/
culpacket.coffee
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
62
63
64
65
66
67
module.exports = (env) ->
class CulPacket
constructor: () ->
@length = 0
@messageCount = 0
@flag = 0
@groupid = 0
@source = ''
@dest = ''
@rawType = ''
@rawPayload = ''
@forMe = false
@command = ''
@status = 'new'
#contains a hole packet
@rawPacket = ''
#contains only the payload
@rawPayload = ''
@sendTries = 0
@decodedPayload = null
getLength: () -> return @length
setLength: (length) -> @length = length
getMessageCount: () -> return @messageCount
setMessageCount: (messageCount) -> @messageCount = messageCount
getFlag: () -> return @flag
setFlag: (flag) -> @flag = flag
getGroupId: () -> return @groupid
setGroupId: (groupid) -> @groupid = groupid
getSource: () -> return @source
setSource: (source) -> @source = source.toLowerCase()
getDest: () -> return @dest
setDest: (dest) -> @dest = dest.toLowerCase()
getRawType: () -> return @rawType
setRawType: (rawType) -> @rawType = rawType
getRawPayload: () -> return @rawPayload
setRawPayload: (rawPayload) -> @rawPayload = rawPayload
getForMe: () -> return @forMe
setForMe: (forMe) -> @forMe = forMe
getCommand: () -> return @command
setCommand: (command) -> @command = command
getStatus: () -> return @status
setStatus: (status) -> @status = status
getRawPacket : () -> return @rawPacket
setRawPacket : (rawPacket) -> @rawPacket = rawPacket
getRawPayload : () -> return @rawPayload
setRawPayload: (rawPayload) -> @rawPayload = rawPayload.toUpperCase()
getSendTries : () -> return @sendTries
setSendTries : (sendTries) -> @sendTries = sendTries
getDecodedPayload : () -> return @decodedPayload
setDecodedPayload : (decodedPayload) -> @decodedPayload = decodedPayload