Skip to content

Commit d48d45d

Browse files
committed
Use core socket library instead of pybluez
Removes an unnecessary dependecy and simplifies move to Python3. Signed-off-by: David Gibson <[email protected]>
1 parent def16a7 commit d48d45d

File tree

3 files changed

+3
-9
lines changed

3 files changed

+3
-9
lines changed

.travis.yml

-5
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,6 @@ sudo: false
55
python:
66
- "2.7"
77

8-
addons:
9-
apt:
10-
packages:
11-
- libbluetooth-dev
12-
138
install:
149
- "pip install -r requirements.txt"
1510

requirements.txt

-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
python-dateutil
22
coverage
3-
PyBluez

smadata2/inverter/smabluetooth.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@
2323
import sys
2424
import getopt
2525
import time
26-
27-
import bluetooth
26+
import socket
2827

2928
import base
3029
from base import Error
@@ -156,7 +155,8 @@ class Connection(base.InverterConnection):
156155
BROADCAST2 = bytearray('\xff\xff\xff\xff\xff\xff')
157156

158157
def __init__(self, addr):
159-
self.sock = bluetooth.BluetoothSocket(bluetooth.RFCOMM)
158+
self.sock = socket.socket(socket.AF_BLUETOOTH, socket.SOCK_STREAM,
159+
socket.BTPROTO_RFCOMM)
160160
self.sock.connect((addr, 1))
161161

162162
self.remote_addr = addr

0 commit comments

Comments
 (0)