Skip to content

Commit

Permalink
add TI
Browse files Browse the repository at this point in the history
  • Loading branch information
andete committed Mar 3, 2014
1 parent 75a1b20 commit 5b3e7ac
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 55 deletions.
36 changes: 1 addition & 35 deletions ble.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,40 +10,6 @@
GAP_AD_TYPE_SLAVE_CON_INTERVAL_RANGE = 0x12
GAP_AD_TYPE_VENDOR = 0xFF

UUID = dict(

primary = ([0x28, 0x00], "Primary" ),
secundary = ([0x28, 0x01], "Secundary"),
include = ([0x28, 0x02], "Include"),
char = ([0x28, 0x03], "Characteristic"),

chr_e_pro = ([0x29, 0x00], "Characteristic Extented Properties"),
chr_u_dsc = ([0x29, 0x01], "Characteristic User Description"),
chr_c_cnf = ([0x29, 0x02], "Client Characteristic Configuration"),
chr_s_cnf = ([0x29, 0x03], "Server Characteristic Configuration"),
chr_p_for = ([0x29, 0x04], "Characteristic Presentation Format"),
chr_a_for = ([0x29, 0x05], "Characteristic Aggregate Format"),
chr_valid = ([0x29, 0x06], "Valid Range"),
chr_exter = ([0x29, 0x07], "External Report Reference"),
chr_repor = ([0x29, 0x08], "Report Reference"),

devi_name = ([0x2A, 0x00], "Device Name"),
appearanc = ([0x2A, 0x01], "Appearance"),
per_pri_f = ([0x2A, 0x02], "Peripheral Privacy Flag"),
reconnect = ([0x2A, 0x03], "Reconnection Address"),
per_pref_ = ([0x2A, 0x04], "Peripheral Preferred Connection Parameters"),

ti_st_1 = ([0xF0, 0x00, 0xAA, 0x00, 0x04, 0x51, 0x40, 0x00, 0xB0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], "TI IR Temperature Sensor"),
ti_st_2 = ([0xF0, 0x00, 0xAA, 0x10, 0x04, 0x51, 0x40, 0x00, 0xB0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], "TI Accelerometer"),
ti_st_3 = ([0xF0, 0x00, 0xAA, 0x20, 0x04, 0x51, 0x40, 0x00, 0xB0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], "TI Humidity Sensor"),
ti_st_4 = ([0xF0, 0x00, 0xAA, 0x30, 0x04, 0x51, 0x40, 0x00, 0xB0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], "TI Magnetometer"),
ti_st_5 = ([0xF0, 0x00, 0xAA, 0x40, 0x04, 0x51, 0x40, 0x00, 0xB0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], "TI Barometric Pressure"),
ti_st_6 = ([0xF0, 0x00, 0xAA, 0x50, 0x04, 0x51, 0x40, 0x00, 0xB0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], "TI Gyroscope"),
ti_st_7 = ([0xF0, 0x00, 0xAA, 0x60, 0x04, 0x51, 0x40, 0x00, 0xB0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], "TI Test"),

push_butt = ([0xFF, 0xE0], "TI Simple Key"),
)

class ActivityThread(QtCore.QThread):

def __init__(self, ble, parent=None):
Expand Down Expand Up @@ -219,7 +185,7 @@ def connect_direct(self, target):

def primary_service_discovery(self, handle):
# print "service discovery for %d ..." % handle
self.send_command(self.ble.ble_cmd_attclient_read_by_group_type(handle, 0x0001, 0xFFFF, list(reversed(UUID['primary'][0]))))
self.send_command(self.ble.ble_cmd_attclient_read_by_group_type(handle, 0x0001, 0xFFFF, list(reversed(self.uuid.attr['primary'][0]))))

def find_information(self, handle, start, end):
self.send_command(self.ble.ble_cmd_attclient_find_information(handle, start, end))
Expand Down
4 changes: 2 additions & 2 deletions data/__init__.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import services, productize
import services, productize, texas_instruments

class UUID:

def __init__(self):
self.service = {}
self.attr = {}
self.vendor = []
sources = [services, productize]
sources = [services, productize, texas_instruments]
for source in sources:
self.service.update(source.service)
self.attr.update(source.attr)
Expand Down
17 changes: 17 additions & 0 deletions data/texas_instruments.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
service = dict(
ti_st_1 = ([0xF0, 0x00, 0xAA, 0x00, 0x04, 0x51, 0x40, 0x00, 0xB0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], "TI IR Temperature Sensor"),
ti_st_2 = ([0xF0, 0x00, 0xAA, 0x10, 0x04, 0x51, 0x40, 0x00, 0xB0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], "TI Accelerometer"),
ti_st_3 = ([0xF0, 0x00, 0xAA, 0x20, 0x04, 0x51, 0x40, 0x00, 0xB0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], "TI Humidity Sensor"),
ti_st_4 = ([0xF0, 0x00, 0xAA, 0x30, 0x04, 0x51, 0x40, 0x00, 0xB0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], "TI Magnetometer"),
ti_st_5 = ([0xF0, 0x00, 0xAA, 0x40, 0x04, 0x51, 0x40, 0x00, 0xB0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], "TI Barometric Pressure"),
ti_st_6 = ([0xF0, 0x00, 0xAA, 0x50, 0x04, 0x51, 0x40, 0x00, 0xB0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], "TI Gyroscope"),
ti_st_7 = ([0xF0, 0x00, 0xAA, 0x60, 0x04, 0x51, 0x40, 0x00, 0xB0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], "TI Test"),

push_butt = ([0xFF, 0xE0], "TI Simple Key"),
)

attr = dict()

class Vendor:

ids = []
18 changes: 0 additions & 18 deletions productize.py

This file was deleted.

0 comments on commit 5b3e7ac

Please sign in to comment.