import_remotecontrol 0.2.2 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +8 -8
- data/lib/get_code_list.rb +26 -7
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MWNmMDliNjg1ZGI0NGI2NjQ0NzcwY2RkMDZlNGY2YTM3NjQyZWIxNQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MzBlMmJmMmRiNmU1NDc5ZjFiOTZjY2IwZjBiODA2ZGNhNDE2Y2Q2Yg==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NDU0MTgwMjUzNjg1MGVlODJhMTJjNDg1NDEwNjM3ZDFlZWMyZWVkN2FkNmFi
|
10
|
+
MmMxNmVlYTgxNGZiYzE2MGI3OWNkYmY0Y2M5Zjc4MDE1MDgwYzBmOTI0NzZj
|
11
|
+
NTg1NDhlMTFkNDY0NmRhMGZkYzIwM2ZkNjk3YzU4MThkMTUxMDI=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
OTBlYmVjNzU3ZWI2N2EzOWMzM2IzMjA4ZTMyYzQyMDk4OTliNTk0NGJlNjkx
|
14
|
+
ZTUxMWUwMWZmNTA1OTI2ZWRhODQ5YTY1OTBiNzNhOWI1MGQyMWRhYzQ1MjJl
|
15
|
+
N2RjODc3MmE0MmI0NTc3MGJjNWE5MjBjODQ5YWFhZjI1ZjQzMjc=
|
data/lib/get_code_list.rb
CHANGED
@@ -6,6 +6,7 @@ module GetCodeList
|
|
6
6
|
PROTOCOLNAME="protocol_name"
|
7
7
|
CODE = "code"
|
8
8
|
METHOD_NAME = "method_name"
|
9
|
+
DEFAULT_PROTOCOL = {"EXT_NEC"=>NEC,"CUT_NEC"=>NEC_MINI}
|
9
10
|
|
10
11
|
#获取错误信息用于抛出错误
|
11
12
|
def self.get_error_msg(error,options={})
|
@@ -20,7 +21,16 @@ module GetCodeList
|
|
20
21
|
ret
|
21
22
|
end
|
22
23
|
|
23
|
-
|
24
|
+
NEC=0x01
|
25
|
+
RC5=0x02
|
26
|
+
SIRC=0x03
|
27
|
+
JVC=0x04
|
28
|
+
NRC17=0x05
|
29
|
+
RCA=0x06
|
30
|
+
SHARP=0x07
|
31
|
+
X_SET=0x08
|
32
|
+
NEC_MINI=0x41
|
33
|
+
SX=0x09
|
24
34
|
|
25
35
|
|
26
36
|
|
@@ -36,17 +46,24 @@ module GetCodeList
|
|
36
46
|
codes.each do |key,value|
|
37
47
|
_codes.merge!({key=>chuangWei(value)})
|
38
48
|
end
|
49
|
+
else
|
50
|
+
codes.each do |key,value|
|
51
|
+
_codes.merge!({key=>default(value)})
|
52
|
+
end
|
39
53
|
end
|
40
54
|
data["codes"] = _codes
|
41
55
|
data
|
42
56
|
end
|
43
57
|
|
58
|
+
def self.default(code)
|
59
|
+
code[CODE]
|
60
|
+
end
|
44
61
|
|
45
62
|
def self.changHong(code)
|
46
63
|
ret = ""
|
47
64
|
case code[PROTOCOLNAME]
|
48
65
|
when "EXT_NEC"
|
49
|
-
ret = changHongExtNec(code[CODE])
|
66
|
+
ret = changHongExtNec(code[PROTOCOLNAME],code[CODE])
|
50
67
|
end
|
51
68
|
ret
|
52
69
|
end
|
@@ -55,7 +72,7 @@ module GetCodeList
|
|
55
72
|
ret = ""
|
56
73
|
case code[PROTOCOLNAME]
|
57
74
|
when "CUT_NEC"
|
58
|
-
ret =
|
75
|
+
ret = chuangWeiCutNec(code[PROTOCOLNAME],code[CODE])
|
59
76
|
end
|
60
77
|
ret
|
61
78
|
end
|
@@ -63,10 +80,10 @@ module GetCodeList
|
|
63
80
|
|
64
81
|
|
65
82
|
#对长虹的扩展NEC编码类型的编码数组进行处理
|
66
|
-
def self.changHongExtNec(code)
|
83
|
+
def self.changHongExtNec(prtotoname,code)
|
67
84
|
begin
|
68
85
|
codes = code.split(":")
|
69
|
-
ret = "#{codes[0]}:#{codes[1]}:#{codes[2]}:"
|
86
|
+
ret = "#{prtotoname}:#{codes[0]}:#{codes[1]}:#{codes[2]}:"
|
70
87
|
__code = Integer("0x#{codes[2].to_s}")
|
71
88
|
__code = (~__code)&Integer(0b1111)
|
72
89
|
ret = ret + __code.to_s(16)
|
@@ -76,10 +93,12 @@ module GetCodeList
|
|
76
93
|
end
|
77
94
|
|
78
95
|
#对创维的精简NEC编码类型的编码数组进行处理
|
79
|
-
def self.chuangWeiCutNec(code)
|
96
|
+
def self.chuangWeiCutNec(prtotoname,code)
|
80
97
|
begin
|
81
98
|
codes = code.split(":")
|
82
|
-
|
99
|
+
p "Codes : #{codes}"
|
100
|
+
ret = "#{prtotoname}:#{codes[0]}:#{codes[0]}:#{codes[1]}:"
|
101
|
+
p ret
|
83
102
|
__code = Integer("0x#{codes[1].to_s}")
|
84
103
|
__code = (~__code)&Integer(0b1111)
|
85
104
|
ret = ret + __code.to_s(16)
|