merged private server and console to private-cloud
This commit is contained in:
128
console/ir_encoder/ir_command_encode.py
Normal file
128
console/ir_encoder/ir_command_encode.py
Normal file
@@ -0,0 +1,128 @@
|
||||
#!/usr/bin/env python
|
||||
# coding = utf-8
|
||||
#
|
||||
# created by strawmanbobi 2016-11-10
|
||||
|
||||
import sys
|
||||
import xml.dom.minidom
|
||||
import struct
|
||||
|
||||
keymap_dict_empty = ()
|
||||
|
||||
keymap_dict_ac = ()
|
||||
|
||||
keymap_dict_tv = ("POWER", "MUTE", "UP", "DOWN", "LEFT", "RIGHT", "OK", "VOL+", "VOL-", "BACK", "INPUT", "MENU", "HOME",
|
||||
"SET", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9")
|
||||
|
||||
keymap_dict_stb = ("POWER", "MUTE", "UP", "DOWN", "LEFT", "RIGHT", "OK", "VOL+", "VOL-", "BACK", "INPUT", "MENU",
|
||||
"UP_PAGE", "DOWN_PAGE", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9")
|
||||
|
||||
keymap_dict_nw = ("POWER", "UP", "DOWN", "LEFT", "RIGHT", "OK", "VOL+", "VOL-", "BACK", "MENU", "HOME", "0", "1", "2",
|
||||
"3", "4", "5", "6", "7", "8", "9")
|
||||
|
||||
keymap_dict_iptv = ("POWER", "MUTE", "UP", "DOWN", "LEFT", "RIGHT", "OK", "VOL+", "VOL-", "BACK", "INPUT", "MENU",
|
||||
"UP_PAGE", "DOWN_PAGE", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9")
|
||||
|
||||
keymap_dict_dvd = ("POWER", "UP", "DOWN", "LEFT", "RIGHT", "OK", "VOL+", "VOL-", "PLAY", "PAUSE", "EJECT", "BACK",
|
||||
"FOR", "MENU", "SWITCH")
|
||||
|
||||
keymap_dict_fan = ("POWER", "UP", "DOWN", "LEFT", "RIGHT", "OK", "SPEED+", "SPEED-", "SWING", "SPEED", "MODE", "BACK",
|
||||
"HOME", "MENU", "SWITCH")
|
||||
|
||||
keymap_dict_stereo = ("POWER1", "UP", "DOWN", "LEFT", "RIGHT", "OK", "VOL+", "VOL-", "MUTE", "MENU1", "POWER2", "BACK",
|
||||
"HOME", "MENU2", "SWITCH")
|
||||
|
||||
keymap_dict_projector = ("POWER", "UP", "DOWN", "LEFT", "RIGHT", "OK", "VOL+", "VOL-", "ZOOM+", "MENU1", "ZOOM-",
|
||||
"BACK", "HOME", "MENU2", "SWITCH")
|
||||
|
||||
keymap_dict_light = ("POWER", "COLOR_1", "COLOR_2", "COLOR_3", "COLOR_4", "COLOR_0", "BRIGHT", "DARK", "POWER_ON",
|
||||
"RAINBOW", "POWER_OFF", "BACK", "HOME", "MENU", "SWITCH")
|
||||
|
||||
keymap_dict_bstb = ("POWER", "MUTE", "UP", "DOWN", "LEFT", "RIGHT", "OK", "VOL+", "VOL-", "BACK", "INPUT", "MENU",
|
||||
"UP_PAGE", "DOWN_PAGE", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9")
|
||||
|
||||
keymap_dict_clean_robot = ("POWER", "UP", "DOWN", "LEFT", "RIGHT", "START", "PLUS", "MINUS", "AUTO", "SPOT", "SPEED",
|
||||
"TIMING", "CHARGE", "PLAN", "SWITCH")
|
||||
|
||||
keymap_dict_air_cleaner = ("POWER", "UP", "DOWN", "LEFT", "RIGHT", "ION", "PLUS", "MINUS", "AUTO", "SPEED", "MODE",
|
||||
"TIMING", "LIGHT", "FORCE", "SWITCH")
|
||||
|
||||
keymap_dict_dyson = ("POWER", "WIND_SPEED_PLUS", "WIND_SPEED_MINUS", "TIMER_MINUS", "TIMER_PLUS", "AUTO",
|
||||
"TEMP_PLUS", "TEMP_MINUS", "SWING", "DIFFUSION", "FAV", "TIMING", "SLEEP", "COOL", "SWITCH")
|
||||
|
||||
keymap_dicts = [keymap_dict_empty,
|
||||
keymap_dict_ac, keymap_dict_tv, keymap_dict_stb, keymap_dict_nw, keymap_dict_iptv, keymap_dict_dvd,
|
||||
keymap_dict_fan, keymap_dict_stereo, keymap_dict_projector, keymap_dict_light, keymap_dict_bstb,
|
||||
keymap_dict_clean_robot, keymap_dict_ac, keymap_dict_dyson]
|
||||
|
||||
class CKeyMap:
|
||||
def __init__(self, name, value):
|
||||
self.name = name
|
||||
self.value = value
|
||||
|
||||
def print_info(self):
|
||||
print self.name, self.value
|
||||
|
||||
def pack_key(self, output_file):
|
||||
for i in range(len(self.value)):
|
||||
output_file.write(struct.pack('B', self.value[i]))
|
||||
|
||||
def pack_null(self, output_file):
|
||||
for i in range(len(self.value)):
|
||||
output_file.write(struct.pack('B', 0))
|
||||
|
||||
def pack_length(self, output_file):
|
||||
output_file.write(struct.pack('B', len(self.value)))
|
||||
print len(self.value)
|
||||
|
||||
|
||||
def print_remote(input_file, real_path, real_name, category):
|
||||
print input_file
|
||||
dom = xml.dom.minidom.parse(input_file)
|
||||
root = dom.documentElement
|
||||
protocol_node = root.getElementsByTagName('protocol')
|
||||
protocol = protocol_node[0].firstChild.data
|
||||
|
||||
filename = real_name.split('.')
|
||||
|
||||
binary = open(real_path + "/" + protocol + "#" + filename[0] + ".bin", 'wb')
|
||||
tag = struct.pack('4s', 'irda')
|
||||
binary.write(tag)
|
||||
|
||||
print protocol
|
||||
keymap = root.getElementsByTagName('key-map')
|
||||
key = []
|
||||
empty_value = []
|
||||
for i in keymap[0].childNodes:
|
||||
if i.nodeType == i.ELEMENT_NODE:
|
||||
key_map_str = i.firstChild.data.encode('ascii').split(' ')
|
||||
value = []
|
||||
empty_value = []
|
||||
for m in range(len(key_map_str)):
|
||||
value.append(int(key_map_str[m], 16))
|
||||
empty_value.append(int('0', 16))
|
||||
name = i.getAttribute('name').encode('ascii')
|
||||
data = CKeyMap(name, value)
|
||||
key.append(data)
|
||||
|
||||
key[0].pack_length(binary)
|
||||
for j in range(len(keymap_dicts[int(category)])):
|
||||
empty_key = CKeyMap(keymap_dicts[int(category)][j], empty_value)
|
||||
find = 0
|
||||
for n in range(len(key)):
|
||||
if cmp(keymap_dicts[int(category)][j], key[n].name) == 0:
|
||||
key[n].print_info()
|
||||
key[n].pack_key(binary)
|
||||
find = 1
|
||||
break
|
||||
if find == 0:
|
||||
print "Don't file this key %s" % (keymap_dicts[int(category)][j])
|
||||
empty_key.pack_key(binary)
|
||||
|
||||
fileName = sys.argv[1]
|
||||
realName = sys.argv[2]
|
||||
realPath = sys.argv[3]
|
||||
inCategory = sys.argv[4]
|
||||
fileType = fileName.split('.')
|
||||
if cmp(fileType[1], "xml") == 0:
|
||||
print_remote(fileName, realPath, realName, inCategory)
|
||||
33
console/ir_encoder/ir_command_merge.py
Normal file
33
console/ir_encoder/ir_command_merge.py
Normal file
@@ -0,0 +1,33 @@
|
||||
#!/usr/bin/env python
|
||||
# coding=utf-8
|
||||
#
|
||||
# created by strawmanbobi 2016-11-10
|
||||
|
||||
import sys
|
||||
import os
|
||||
|
||||
for root, dirs, files in os.walk(sys.argv[1]):
|
||||
for i in files:
|
||||
fileType = i.split('.')
|
||||
if cmp(fileType[1], 'bin') == 0:
|
||||
print root + i
|
||||
|
||||
print "========================list==========================="
|
||||
|
||||
remotePath = sys.argv[2]
|
||||
fileType2 = remotePath.split('.')
|
||||
if cmp(fileType2[-1], 'bin') == 0:
|
||||
protocolType = fileType2[0].split('#')
|
||||
print(protocolType[0])
|
||||
print(fileType[0])
|
||||
if cmp(protocolType[0].split('/')[-1], fileType[0]) == 0:
|
||||
outName = remotePath.split('#')
|
||||
binary = open(sys.argv[3] + "/irda_" + outName[0].split('/')[-1] + "_" + outName[1], 'wb')
|
||||
prot_file = open(root + i, "rb")
|
||||
remote_file = open(remotePath, "rb")
|
||||
binary.write(prot_file.read())
|
||||
binary.write(remote_file.read())
|
||||
binary.close()
|
||||
prot_file.close()
|
||||
remote_file.close()
|
||||
print remotePath
|
||||
130
console/ir_encoder/ir_command_protocol.py
Normal file
130
console/ir_encoder/ir_command_protocol.py
Normal file
@@ -0,0 +1,130 @@
|
||||
#!/usr/bin/env python
|
||||
# coding=utf-8
|
||||
#
|
||||
# created by strawmanbobi 2016-11-10
|
||||
|
||||
import struct
|
||||
import sys
|
||||
import xml.dom.minidom
|
||||
|
||||
flag_tab = ("boot", "stop", "separator", "one", "zero", "flip", "two", "three")
|
||||
|
||||
class IRDAData:
|
||||
def __init__(self, bits, lsb, mode, index):
|
||||
self.bits = bits
|
||||
self.lsb = lsb
|
||||
self.mode = mode
|
||||
self.index = index
|
||||
|
||||
def printf(self):
|
||||
print "%d %d %d %d" % (self.bits, self.lsb, self.mode, self.index)
|
||||
|
||||
def packIRData(self):
|
||||
return struct.pack("BBBB", self.bits, self.lsb, self.mode, self.index)
|
||||
|
||||
class IRDAFlag:
|
||||
def __init__(self, name, mask, space):
|
||||
self.name = name
|
||||
self.mask = mask
|
||||
self.space = space
|
||||
|
||||
def printf(self):
|
||||
print "%s %d %d" % (self.name, self.mask, self.space)
|
||||
|
||||
def packFlag(self):
|
||||
return struct.pack("HH", self.mask, self.space)
|
||||
|
||||
|
||||
def printProtocol(file):
|
||||
print file
|
||||
dom = xml.dom.minidom.parse(file)
|
||||
root = dom.documentElement
|
||||
freqnode = root.getElementsByTagName('frequency')
|
||||
freq = freqnode[0].firstChild.data
|
||||
inverseflag = 0
|
||||
|
||||
protnode = root.getAttribute('name')
|
||||
|
||||
print protnode
|
||||
protname = protnode.split('_')
|
||||
|
||||
binary = open(sys.argv[2], 'wb')
|
||||
|
||||
bytes = struct.pack('20s', protnode.encode("ascii"))
|
||||
binary.write(bytes)
|
||||
|
||||
bit = root.getElementsByTagName('bit')
|
||||
for n in range(len(flag_tab)):
|
||||
for b in range(len(bit)):
|
||||
name = bit[b].getAttribute('name')
|
||||
cycles = bit[b].getAttribute('cycles')
|
||||
if name and cycles:
|
||||
if cmp(flag_tab[n], name) == 0:
|
||||
bytes = struct.pack('B', int(cycles))
|
||||
binary.write(bytes)
|
||||
break
|
||||
if b == (len(bit) - 1):
|
||||
bytes = struct.pack('B', 0)
|
||||
binary.write(bytes)
|
||||
for m in range(len(flag_tab)):
|
||||
found = 0
|
||||
for i in range(len(bit)):
|
||||
name = bit[i].getAttribute('name')
|
||||
cycles = bit[i].getAttribute('cycles')
|
||||
if name and cycles and cmp(flag_tab[m], name) == 0:
|
||||
found = 1
|
||||
cycle = bit[i].getElementsByTagName('cycle')
|
||||
for c in range(len(cycle)):
|
||||
normal = cycle[c].getAttribute('flag')
|
||||
mask = cycle[c].getAttribute('mask')
|
||||
space = cycle[c].getAttribute('space')
|
||||
if cmp(normal, "normal") == 0:
|
||||
inverseflag = 0
|
||||
else:
|
||||
inverseflag = 1
|
||||
print "{\"%s\", \"cycle:%s\", 0x%04x, 0x%04x, 0x%02x}" % (
|
||||
name, c, int(mask), int(space), int(cycles))
|
||||
bytes = struct.pack('B', inverseflag)
|
||||
binary.write(bytes)
|
||||
bytes = struct.pack('HH', int(mask), int(space))
|
||||
binary.write(bytes)
|
||||
|
||||
frame = root.getElementsByTagName('frame')
|
||||
|
||||
index = 0
|
||||
lsb = 0
|
||||
mode = 0
|
||||
flag = 0
|
||||
irda_frame = []
|
||||
flag_tab_dict = {"boot": 0, "stop": 1, "separator": 2, "one": 3, "zero": 4, "flip": 5, "two": 6, "three": 7}
|
||||
for i in frame[0].childNodes:
|
||||
if i.nodeType == i.ELEMENT_NODE:
|
||||
index += 1
|
||||
if i.getAttribute('type'):
|
||||
print "{%d, \"%s\", 0, 0, 0}" % (index, i.getAttribute('type'))
|
||||
flag = IRDAData(1, 0, 0, flag_tab_dict[i.getAttribute('type').encode("ascii")])
|
||||
irda_frame.append(flag)
|
||||
if i.getAttribute('bits'):
|
||||
if cmp(i.getAttribute('ending'), "lsb") == 0:
|
||||
lsb = 0
|
||||
else:
|
||||
lsb = 1
|
||||
|
||||
if cmp(i.getAttribute('mode'), "normal") == 0:
|
||||
mode = 0
|
||||
else:
|
||||
mode = 1
|
||||
|
||||
print "{%d, \"%s\", %d, %d, %s}" % (index, i.getAttribute('bits'),
|
||||
lsb, mode, i.firstChild.data)
|
||||
flag = IRDAData(int(i.getAttribute('bits')), lsb, mode, int(i.firstChild.data))
|
||||
irda_frame.append(flag)
|
||||
|
||||
binary.write(struct.pack("B", len(irda_frame)))
|
||||
|
||||
for i in range(len(irda_frame)):
|
||||
irda_frame[i].printf()
|
||||
binary.write(irda_frame[i].packIRData())
|
||||
binary.close()
|
||||
|
||||
printProtocol(sys.argv[1])
|
||||
133
console/ir_encoder/ir_command_protocol_hex.py
Normal file
133
console/ir_encoder/ir_command_protocol_hex.py
Normal file
@@ -0,0 +1,133 @@
|
||||
#!/usr/bin/env python
|
||||
# coding=utf-8
|
||||
#
|
||||
# created by strawmanbobi 2016-11-10
|
||||
|
||||
import struct
|
||||
import sys
|
||||
import xml.dom.minidom
|
||||
|
||||
flag_tab = ("boot", "stop", "separator", "one", "zero", "flip", "two", "three", "four", "five", "six", "seven",
|
||||
"eight", "nine", "A", "B", "C", "D", "E", "F")
|
||||
|
||||
class IRDAData:
|
||||
def __init__(self, bits, lsb, mode, index):
|
||||
self.bits = bits
|
||||
self.lsb = lsb
|
||||
self.mode = mode
|
||||
self.index = index
|
||||
|
||||
def printf(self):
|
||||
print "%d %d %d %d" % (self.bits, self.lsb, self.mode, self.index)
|
||||
|
||||
def packIRData(self):
|
||||
return struct.pack("BBBB", self.bits, self.lsb, self.mode, self.index)
|
||||
|
||||
class IRDAFlag:
|
||||
def __init__(self, name, mask, space):
|
||||
self.name = name
|
||||
self.mask = mask
|
||||
self.space = space
|
||||
|
||||
def printf(self):
|
||||
print "%s %d %d" % (self.name, self.mask, self.space)
|
||||
|
||||
def packFlag(self):
|
||||
return struct.pack("HH", self.mask, self.space)
|
||||
|
||||
|
||||
def printProtocol(file):
|
||||
print file
|
||||
dom = xml.dom.minidom.parse(file)
|
||||
root = dom.documentElement
|
||||
freqnode = root.getElementsByTagName('frequency')
|
||||
freq = freqnode[0].firstChild.data
|
||||
inverseflag = 0
|
||||
|
||||
protnode = root.getAttribute('name')
|
||||
|
||||
print protnode
|
||||
protname = protnode.split('_')
|
||||
|
||||
binary = open(sys.argv[2], 'wb')
|
||||
|
||||
bytes = struct.pack('20s', protnode.encode("ascii"))
|
||||
binary.write(bytes)
|
||||
|
||||
bit = root.getElementsByTagName('bit')
|
||||
for n in range(len(flag_tab)):
|
||||
for b in range(len(bit)):
|
||||
name = bit[b].getAttribute('name')
|
||||
cycles = bit[b].getAttribute('cycles')
|
||||
if name and cycles:
|
||||
if cmp(flag_tab[n], name) == 0:
|
||||
bytes = struct.pack('B', int(cycles))
|
||||
binary.write(bytes)
|
||||
break
|
||||
if b == (len(bit) - 1):
|
||||
bytes = struct.pack('B', 0)
|
||||
binary.write(bytes)
|
||||
for m in range(len(flag_tab)):
|
||||
found = 0
|
||||
for i in range(len(bit)):
|
||||
name = bit[i].getAttribute('name')
|
||||
cycles = bit[i].getAttribute('cycles')
|
||||
if name and cycles and cmp(flag_tab[m], name) == 0:
|
||||
found = 1
|
||||
cycle = bit[i].getElementsByTagName('cycle')
|
||||
for c in range(len(cycle)):
|
||||
normal = cycle[c].getAttribute('flag')
|
||||
mask = cycle[c].getAttribute('mask')
|
||||
space = cycle[c].getAttribute('space')
|
||||
if cmp(normal, "normal") == 0:
|
||||
inverseflag = 0
|
||||
else:
|
||||
inverseflag = 1
|
||||
print "{\"%s\", \"cycle:%s\", 0x%04x, 0x%04x, 0x%02x}" % (
|
||||
name, c, int(mask), int(space), int(cycles))
|
||||
bytes = struct.pack('B', inverseflag)
|
||||
binary.write(bytes)
|
||||
bytes = struct.pack('HH', int(mask), int(space))
|
||||
binary.write(bytes)
|
||||
|
||||
frame = root.getElementsByTagName('frame')
|
||||
|
||||
index = 0
|
||||
lsb = 0
|
||||
mode = 0
|
||||
flag = 0
|
||||
irda_frame = []
|
||||
flag_tab_dict = {"boot": 0, "stop": 1, "separator": 2, "one": 3, "zero": 4, "flip": 5, "two": 6, "three": 7,
|
||||
"four": 8, "five": 9, "six": 10, "seven": 11, "eight": 12, "nine": 13,
|
||||
"A": 14, "B": 15, "C": 16, "D": 17, "E": 18, "F": 19}
|
||||
for i in frame[0].childNodes:
|
||||
if i.nodeType == i.ELEMENT_NODE:
|
||||
index += 1
|
||||
if i.getAttribute('type'):
|
||||
print "{%d, \"%s\", 0, 0, 0}" % (index, i.getAttribute('type'))
|
||||
flag = IRDAData(1, 0, 0, flag_tab_dict[i.getAttribute('type').encode("ascii")])
|
||||
irda_frame.append(flag)
|
||||
if i.getAttribute('bits'):
|
||||
if cmp(i.getAttribute('ending'), "lsb") == 0:
|
||||
lsb = 0
|
||||
else:
|
||||
lsb = 1
|
||||
|
||||
if cmp(i.getAttribute('mode'), "normal") == 0:
|
||||
mode = 0
|
||||
else:
|
||||
mode = 1
|
||||
|
||||
print "{%d, \"%s\", %d, %d, %s}" % (index, i.getAttribute('bits'),\
|
||||
lsb, mode, i.firstChild.data)
|
||||
flag = IRDAData(int(i.getAttribute('bits')), lsb, mode, int(i.firstChild.data))
|
||||
irda_frame.append(flag)
|
||||
|
||||
binary.write(struct.pack("B", len(irda_frame)))
|
||||
|
||||
for i in range(len(irda_frame)):
|
||||
irda_frame[i].printf()
|
||||
binary.write(irda_frame[i].packIRData())
|
||||
binary.close()
|
||||
|
||||
printProtocol(sys.argv[1])
|
||||
112
console/ir_encoder/ir_status_encode.py
Normal file
112
console/ir_encoder/ir_status_encode.py
Normal file
@@ -0,0 +1,112 @@
|
||||
# !/usr/bin/env python
|
||||
# coding=utf-8
|
||||
# for protocol version V1.0
|
||||
# 29 tags are supported
|
||||
#
|
||||
# created by strawmanbobi 2016-11-10
|
||||
|
||||
import sys
|
||||
import xml.dom.minidom
|
||||
import struct
|
||||
|
||||
|
||||
alltags = [1, 2, 3, 4, 5, 6, 7,
|
||||
21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
|
||||
41, 42, 43, 44, 45, 46, 47, 48]
|
||||
|
||||
tags_max_size = [0 for x in range(0, len(alltags))]
|
||||
|
||||
# Definition of ac tag class
|
||||
# (tag:value)
|
||||
|
||||
|
||||
class ACTag:
|
||||
def __init__(self, tag, value):
|
||||
self.tag = tag
|
||||
self.value = value
|
||||
self.len = len(self.value)
|
||||
|
||||
def __lt__(self, other):
|
||||
return self.tag < other.tag
|
||||
|
||||
def printf(self):
|
||||
print "[%d] %s len:%d" % (self.tag, self.value, len(self.value))
|
||||
|
||||
# Definition of Remote_control class
|
||||
# device id:(tag:value)...(tag:value)
|
||||
|
||||
|
||||
class ACRemoteControl:
|
||||
def __init__(self, device_id):
|
||||
self.device_id = device_id
|
||||
self.tags = []
|
||||
|
||||
def add(self, tag):
|
||||
self.tags.append(tag)
|
||||
|
||||
def sort(self):
|
||||
self.tags.sort()
|
||||
|
||||
def printf(self):
|
||||
print "==========Device id:%d===========" % self.device_id
|
||||
for j in range(len(self.tags)):
|
||||
self.tags[j].printf()
|
||||
|
||||
|
||||
def create_binary(ac_device):
|
||||
find = 0
|
||||
offset = 0
|
||||
|
||||
f_content = open(sys.argv[2] + str(ac_device.device_id) + "_tmp.bin", "wb")
|
||||
f_head = open(sys.argv[2] + "irda_new_ac_" + str(ac_device.device_id) + ".bin", "wb")
|
||||
f_head.write(struct.pack("B", 29))
|
||||
for i in range(len(alltags)):
|
||||
find = 0
|
||||
for j in range(len(ac_device.tags)):
|
||||
if alltags[i] == ac_device.tags[j].tag:
|
||||
f_content.write(ac_device.tags[j].value)
|
||||
|
||||
f_head.write(struct.pack("H", offset))
|
||||
offset = offset + ac_device.tags[j].len
|
||||
|
||||
# Find Max length
|
||||
if tags_max_size[i] < ac_device.tags[j].len:
|
||||
tags_max_size[i] = ac_device.tags[j].len;
|
||||
find = 1
|
||||
break
|
||||
|
||||
if find == 0:
|
||||
f_head.write(struct.pack("H", 0xffff))
|
||||
# f.write(ac_device)
|
||||
f_content.close()
|
||||
f_tmp = open(sys.argv[2] + str(ac_device.device_id) + "_tmp.bin", "rb")
|
||||
f_head.write(f_tmp.read())
|
||||
f_tmp.close()
|
||||
f_head.close()
|
||||
|
||||
dom = xml.dom.minidom.parse(sys.argv[1])
|
||||
device = dom.documentElement
|
||||
# devices = root.getElementsByTagName('remote_controller')
|
||||
|
||||
print "============================"
|
||||
print "AC data:"
|
||||
print "============================"
|
||||
ac_device_arrary=[]
|
||||
id = device.getElementsByTagName('id')
|
||||
idnum = int(id[0].firstChild.data.encode('ascii'), 10)
|
||||
|
||||
g_ac_device = ACRemoteControl(idnum)
|
||||
print "------------AC Device ID: %d-------------" % idnum
|
||||
exts = device.getElementsByTagName('exts')
|
||||
for n in range(len(exts)):
|
||||
ext = exts[n].getElementsByTagName('ext')
|
||||
for j in range(len(ext)):
|
||||
tag_index=ext[j].getElementsByTagName('tag')
|
||||
tag_index_data = int(tag_index[0].firstChild.data.encode('ascii'), 10)
|
||||
tag_value=ext[j].getElementsByTagName('value')
|
||||
tag_value_data = tag_value[0].firstChild.data.encode('ascii')
|
||||
g_ac_device.add(ACTag(tag_index_data, tag_value_data))
|
||||
g_ac_device.sort()
|
||||
g_ac_device.printf()
|
||||
create_binary(g_ac_device)
|
||||
ac_device_arrary.append(g_ac_device)
|
||||
Reference in New Issue
Block a user