ii
This commit is contained in:
parent
75c8241f1b
commit
c8f51ead7e
|
@ -1,7 +1,7 @@
|
||||||
from ant.core import message
|
from ant.core import message
|
||||||
from ant.core.constants import *
|
from ant.core.constants import *
|
||||||
from ant.core.exceptions import ChannelError
|
from ant.core.exceptions import ChannelError
|
||||||
from const import *
|
from iConst import *
|
||||||
import thread
|
import thread
|
||||||
from binascii import hexlify
|
from binascii import hexlify
|
||||||
import struct
|
import struct
|
||||||
|
|
18
README.md
18
README.md
|
@ -1,2 +1,18 @@
|
||||||
# iconsole
|
# iconsole
|
||||||
reverse engineering of the iconsole+ bike computer serial protocol
|
Reverse engineering of the iconsole+ bike computer serial protocol.
|
||||||
|
|
||||||
|
Broadcasts the power and speed on the ANT network.
|
||||||
|
|
||||||
|
## Requirements
|
||||||
|
|
||||||
|
```
|
||||||
|
$ pip install --user requirements.txt
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
```
|
||||||
|
$ python iConsole.py <ANT Network Key in ASCII Hex>
|
||||||
|
```
|
||||||
|
|
||||||
|
Use the ANT+ network key to record the data with ANT+ compatible devices, such as a bike computer or fitness watch.
|
|
@ -1,7 +1,7 @@
|
||||||
from ant.core import message
|
from ant.core import message
|
||||||
from ant.core.constants import *
|
from ant.core.constants import *
|
||||||
from ant.core.exceptions import ChannelError
|
from ant.core.exceptions import ChannelError
|
||||||
from const import *
|
from iConst import *
|
||||||
import thread
|
import thread
|
||||||
from binascii import hexlify
|
from binascii import hexlify
|
||||||
import struct
|
import struct
|
||||||
|
|
9
iconsole.py → iConsole.py
Normal file → Executable file
9
iconsole.py → iConsole.py
Normal file → Executable file
|
@ -1,3 +1,5 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
|
||||||
# f0:b2 01:01:04:06 03:11 01:3b 01:07 01:0d 01:01 0f:33 09 02
|
# f0:b2 01:01:04:06 03:11 01:3b 01:07 01:0d 01:01 0f:33 09 02
|
||||||
# T: 3:05 21.0km/h RPM58 D:0.6 cal 12 HF 0 W:1450 LVL8
|
# T: 3:05 21.0km/h RPM58 D:0.6 cal 12 HF 0 W:1450 LVL8
|
||||||
#
|
#
|
||||||
|
@ -42,13 +44,13 @@
|
||||||
|
|
||||||
import serial, struct, sys, hashlib, curses
|
import serial, struct, sys, hashlib, curses
|
||||||
from time import sleep
|
from time import sleep
|
||||||
from binascii import hexlify
|
from binascii import hexlify,unhexlify
|
||||||
from ant.core import driver
|
from ant.core import driver
|
||||||
from ant.core import node
|
from ant.core import node
|
||||||
from bluetooth import *
|
from bluetooth import *
|
||||||
from PowerMeterTx import PowerMeterTx
|
from PowerMeterTx import PowerMeterTx
|
||||||
from SpeedTx import SpeedTx
|
from SpeedTx import SpeedTx
|
||||||
from const import *
|
from iConst import *
|
||||||
|
|
||||||
INIT_A0 = struct.pack('BBBBB', 0xf0, 0xa0, 0x02, 0x02, 0x94)
|
INIT_A0 = struct.pack('BBBBB', 0xf0, 0xa0, 0x02, 0x02, 0x94)
|
||||||
PING = struct.pack('BBBBB', 0xf0, 0xa0, 0x01, 0x01, 0x92)
|
PING = struct.pack('BBBBB', 0xf0, 0xa0, 0x01, 0x01, 0x92)
|
||||||
|
@ -232,9 +234,10 @@ def main(win):
|
||||||
win.refresh()
|
win.refresh()
|
||||||
|
|
||||||
if __name__ =='__main__':
|
if __name__ =='__main__':
|
||||||
|
NETKEY = unhexlify(sys.argv[1])
|
||||||
stick = driver.USB1Driver(device="/dev/ttyANT", log=LOG, debug=DEBUG)
|
stick = driver.USB1Driver(device="/dev/ttyANT", log=LOG, debug=DEBUG)
|
||||||
antnode = node.Node(stick)
|
antnode = node.Node(stick)
|
||||||
print("Starting ANT node")
|
print("Starting ANT node on network %s" % sys.argv[1])
|
||||||
antnode.start()
|
antnode.start()
|
||||||
key = node.NetworkKey('N:ANT+', NETKEY)
|
key = node.NetworkKey('N:ANT+', NETKEY)
|
||||||
antnode.setNetworkKey(0, key)
|
antnode.setNetworkKey(0, key)
|
|
@ -1,4 +1,3 @@
|
||||||
NETKEY = '\xB9\xA5\x21\xFB\xBD\x72\xC3\x45'
|
|
||||||
CADENCE_DEVICE_TYPE = 0x7A
|
CADENCE_DEVICE_TYPE = 0x7A
|
||||||
SPEED_DEVICE_TYPE = 0x7B
|
SPEED_DEVICE_TYPE = 0x7B
|
||||||
SPEED_CADENCE_DEVICE_TYPE = 0x79
|
SPEED_CADENCE_DEVICE_TYPE = 0x79
|
2
requirements.txt
Normal file
2
requirements.txt
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
git+https://github.com/baderj/python-ant.git
|
||||||
|
pybluez
|
|
@ -1,20 +1,21 @@
|
||||||
import serial, struct, sys, hashlib, curses
|
import serial, struct, sys, hashlib, curses
|
||||||
from time import sleep
|
from time import sleep
|
||||||
from binascii import hexlify
|
from binascii import hexlify,unhexlify
|
||||||
from ant.core import driver
|
from ant.core import driver
|
||||||
from ant.core import node
|
from ant.core import node
|
||||||
from bluetooth import *
|
from bluetooth import *
|
||||||
from PowerMeterTx import PowerMeterTx
|
from PowerMeterTx import PowerMeterTx
|
||||||
from const import *
|
from iConst import *
|
||||||
|
|
||||||
power_meter = None
|
power_meter = None
|
||||||
|
|
||||||
POWER_SENSOR_ID = int(int(hashlib.md5(getserial()).hexdigest(), 16) & 0xfffe) + 1
|
POWER_SENSOR_ID = int(int(hashlib.md5(getserial()).hexdigest(), 16) & 0xfffe) + 1
|
||||||
|
|
||||||
if __name__ =='__main__':
|
if __name__ =='__main__':
|
||||||
|
NETKEY = unhexlify(sys.argv[1])
|
||||||
stick = driver.USB1Driver(device="/dev/ttyANT", log=None, debug=True)
|
stick = driver.USB1Driver(device="/dev/ttyANT", log=None, debug=True)
|
||||||
antnode = node.Node(stick)
|
antnode = node.Node(stick)
|
||||||
print("Starting ANT node")
|
print("Starting ANT node on network %s" % sys.argv[1])
|
||||||
antnode.start()
|
antnode.start()
|
||||||
key = node.NetworkKey('N:ANT+', NETKEY)
|
key = node.NetworkKey('N:ANT+', NETKEY)
|
||||||
antnode.setNetworkKey(0, key)
|
antnode.setNetworkKey(0, key)
|
||||||
|
|
|
@ -1,20 +1,21 @@
|
||||||
import serial, struct, sys, hashlib, curses
|
import serial, struct, sys, hashlib, curses
|
||||||
from time import sleep
|
from time import sleep
|
||||||
from binascii import hexlify
|
from binascii import hexlify,unhexlify
|
||||||
from ant.core import driver
|
from ant.core import driver
|
||||||
from ant.core import node
|
from ant.core import node
|
||||||
from bluetooth import *
|
from bluetooth import *
|
||||||
from SpeedTx import SpeedTx
|
from SpeedTx import SpeedTx
|
||||||
from const import *
|
from iConst import *
|
||||||
|
|
||||||
speed = None
|
speed = None
|
||||||
|
|
||||||
SPEED_SENSOR_ID = int(int(hashlib.md5(getserial()).hexdigest(), 16) & 0xfffe) + 2
|
SPEED_SENSOR_ID = int(int(hashlib.md5(getserial()).hexdigest(), 16) & 0xfffe) + 2
|
||||||
|
|
||||||
if __name__ =='__main__':
|
if __name__ =='__main__':
|
||||||
|
NETKEY = unhexlify(sys.argv[1])
|
||||||
stick = driver.USB1Driver(device="/dev/ttyANT", log=None, debug=True)
|
stick = driver.USB1Driver(device="/dev/ttyANT", log=None, debug=True)
|
||||||
antnode = node.Node(stick)
|
antnode = node.Node(stick)
|
||||||
print("Starting ANT node")
|
print("Starting ANT node on network %s" % sys.argv[1])
|
||||||
antnode.start()
|
antnode.start()
|
||||||
key = node.NetworkKey('N:ANT+', NETKEY)
|
key = node.NetworkKey('N:ANT+', NETKEY)
|
||||||
antnode.setNetworkKey(0, key)
|
antnode.setNetworkKey(0, key)
|
||||||
|
|
Loading…
Reference in a new issue