Skip to content

Commit 6c845eb

Browse files
committed
Hologram Python SDK v0.8.3 release
1 parent 5965489 commit 6c845eb

18 files changed

+100
-48
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# What's New in Hologram Python SDK
22

3+
## v0.8.3
4+
5+
2019-08-27 Hologram <[email protected]>
6+
* New command to view IMEI: `hologram modem imei`
7+
* New command to get modem module firmware version: `hologram modem version`
8+
* Make dependencies a little more flexible to prevent some problems on some systems
9+
* Unit tests weren't properly checking some exceptions
10+
311
## v0.8.2
412

513
2018-11-16 Hologram <[email protected]>

Hologram/Cloud.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
from Network import NetworkManager
1414
from Authentication import *
1515

16-
__version__ = '0.8.2'
16+
__version__ = '0.8.3'
1717

1818
class Cloud(object):
1919

Hologram/Network/Ethernet.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,6 @@ def getConnectionStatus(self):
3535

3636
def getSignalStrength(self):
3737
raise Exception('Ethernet mode doesn\'t support this call')
38+
39+
def getAvgSignalStrength(self):
40+
raise Exception('Ethernet mode doesn\'t support this call')

Hologram/Network/Modem/Modem.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -869,3 +869,13 @@ def localIPAddress(self):
869869
@property
870870
def remoteIPAddress(self):
871871
return self._mode.remoteIPAddress
872+
873+
874+
@property
875+
def version(self):
876+
raise NotImplementedError('This modem does not support this property')
877+
878+
@property
879+
def imei(self):
880+
return self._basic_command('+GSN')
881+

Hologram/Network/Modem/Nova.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,8 @@ def __init__(self, device_name=None, baud_rate='9600',
2323

2424
def disable_at_sockets_mode(self):
2525
self._at_sockets_available = False
26+
27+
@property
28+
def version(self):
29+
return self._basic_command('I9')
30+

Hologram/Network/Network.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,12 @@ def reconnect(self):
4444
def getConnectionStatus(self):
4545
raise NotImplementedError('Must instantiate a defined Network type')
4646

47+
def getSignalStrength(self):
48+
raise NotImplementedError('Must instantiate a defined Network type')
49+
50+
def getAvgSignalStrength(self):
51+
raise NotImplementedError('Must instantiate a defined Network type')
52+
4753
def is_connected(self):
4854
return False
4955

requirements.txt

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
enum34==1.1.6
2-
hjson==2.0.2
3-
mock==2.0.0
4-
pyroute2==0.4.21
5-
pytest==3.0.5
6-
python-wifi==0.6.1
7-
pyserial==3.3
1+
enum34~=1.1.6
2+
hjson~=3.0.0
3+
mock~=3.0.5
4+
pyroute2==0.5.*
5+
pytest~=4.6.5
6+
python-wifi~=0.6.1
7+
pyserial~=3.4.0
88
python-pppd==1.0.3
9-
python-sdk-auth==0.2.1
10-
pyudev==0.21.0
11-
pyusb==1.0.0
12-
psutil==5.3.1
13-
requests==2.20.1
9+
python-sdk-auth~=0.2.2
10+
pyudev~=0.21.0
11+
pyusb~=1.0.2
12+
psutil~=5.6.3
13+
requests~=2.22.0

scripts/hologram_modem.py

Lines changed: 35 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -26,28 +26,27 @@
2626
help_sim = '''This subcommand prints the IMSI value of the attached SIM.\n
2727
'''
2828

29-
help_type = '''This subcommand prints the modem name if it is supported and attached to the device.\n
29+
help_type = '''Prints the modem name if it is supported and attached to the device.\n
3030
'''
3131

32-
help_operator = '''This subcommand prints the operator name.\n
32+
help_operator = '''Print the name of the operator the modem is attached to\n
3333
'''
3434

35-
help_signal = '''This subcommand prints the RSSI signal strength values.\n
35+
help_imei = '''Print the IMEI of the modem\n
3636
'''
3737

38-
help_location = '''This subcommand prints the encoded location of the modem.\n
39-
'''
38+
help_signal = '''Print the RSSI signal strength values.\n'''
4039

41-
help_reset = '''This subcommand causes the modem to restart itself.\n
40+
help_location = '''Print the location of the modem based on cell towers if supported\n
4241
'''
4342

44-
help_radio_off = '''This subcommand causes the modem to turn off the cellular
45-
radio\n
46-
'''
43+
help_reset = '''Restart the modem\n'''
4744

48-
help_radio_on = '''This subcommand causes the modem to turn on the cellular
49-
radio\n
50-
'''
45+
help_radio_off = '''Turn off the cellular radio on the modem\n'''
46+
47+
help_radio_on = '''Turn on the cellular radio\n'''
48+
49+
help_version = '''Print the firmware version of the modem\n'''
5150

5251
def run_modem_connect(args):
5352
print 'Note: "hologram modem connect" is deprecated '\
@@ -86,6 +85,16 @@ def run_modem_signal(args):
8685
else:
8786
print 'Signal strength: ' + str(cloud.network.signal_strength)
8887

88+
def run_modem_version(args):
89+
cloud = CustomCloud(None, network='cellular')
90+
version = cloud.network.modem.version
91+
print 'Modem version: ' + version
92+
93+
def run_modem_imei(args):
94+
cloud = CustomCloud(None, network='cellular')
95+
imei = cloud.network.modem.imei
96+
print 'IMEI: ' + imei
97+
8998
def run_modem_reset(args):
9099
cloud = CustomCloud(None, network='cellular')
91100
cloud.network.modem.reset()
@@ -138,7 +147,9 @@ def run_modem_location(args):
138147
'modem_location': run_modem_location,
139148
'modem_reset': run_modem_reset,
140149
'modem_radio_on': run_modem_radio_on,
141-
'modem_radio_off': run_modem_radio_off
150+
'modem_radio_off': run_modem_radio_off,
151+
'modem_version': run_modem_version,
152+
'modem_imei': run_modem_imei
142153
}
143154

144155
# EFFECTS: Parses the CLI arguments as options to the hologram modem subcommand.
@@ -189,15 +200,24 @@ def parse_hologram_modem_args(parser):
189200
parser_reset.add_argument('-v', nargs='?', action=VAction, dest='verbose', required=False)
190201

191202
# radio-on
192-
parser_radio_on = subparsers.add_parser('radio-on', help=help_reset)
203+
parser_radio_on = subparsers.add_parser('radio-on', help=help_radio_on)
193204
parser_radio_on.set_defaults(command_selected='modem_radio_on')
194205
parser_radio_on.add_argument('-v', nargs='?', action=VAction, dest='verbose', required=False)
195206

196207
# radio-off
197-
parser_radio_off = subparsers.add_parser('radio-off', help=help_reset)
208+
parser_radio_off = subparsers.add_parser('radio-off', help=help_radio_off)
198209
parser_radio_off.set_defaults(command_selected='modem_radio_off')
199210
parser_radio_off.add_argument('-v', nargs='?', action=VAction, dest='verbose', required=False)
200211

212+
# version
213+
parser_version = subparsers.add_parser('version', help=help_version)
214+
parser_version.set_defaults(command_selected='modem_version')
215+
parser_version.add_argument('-v', nargs='?', action=VAction, dest='verbose', required=False)
216+
217+
# imei
218+
parser_imei = subparsers.add_parser('imei', help=help_version)
219+
parser_imei.set_defaults(command_selected='modem_imei')
220+
parser_imei.add_argument('-v', nargs='?', action=VAction, dest='verbose', required=False)
201221

202222
# EFFECTS: Runs the hologram modem interfaces.
203223
def run_hologram_modem(args):

tests/Authentication/test_CSRPSKAuthentication.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,5 @@ def test_invalid_device_key_length(self):
3939
credentials = {'devicekey': '12345678'}
4040
auth = CSRPSKAuthentication(credentials)
4141
auth.credentials['devicekey'] = '12345'
42-
with pytest.raises(Exception, message = 'AuthenticationError: Device key must be 8 characters long'):
42+
with pytest.raises(Exception, match = 'Device key must be 8 characters long'):
4343
auth.buildPayloadString('test invalid device key')

tests/Authentication/test_HologramAuthentication.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,17 @@ def test_create(self):
2424

2525
def test_invalid_auth_string(self):
2626
auth = HologramAuthentication(credentials)
27-
with pytest.raises(Exception, message = 'Must instantiate a subclass of HologramAuthentication'):
27+
with pytest.raises(Exception, match = 'Must instantiate a subclass of HologramAuthentication'):
2828
auth.buildPayloadString('test msg', 'test topic')
2929

3030
def test_invalid_topic_string(self):
3131
auth = HologramAuthentication(credentials)
32-
with pytest.raises(Exception, message = 'Must instantiate a subclass of HologramAuthentication'):
32+
with pytest.raises(Exception, match = 'Must instantiate a subclass of HologramAuthentication'):
3333
auth.buildTopicString('test topic')
3434

3535
def test_invalid_msg_string(self):
3636
auth = HologramAuthentication(credentials)
37-
with pytest.raises(Exception, message = 'Must instantiate a subclass of HologramAuthentication'):
37+
with pytest.raises(Exception, match = 'Must instantiate a subclass of HologramAuthentication'):
3838
auth.buildMessageString('test msg')
3939

4040
def test_build_modem_type_id_str(self):

0 commit comments

Comments
 (0)