Skip to content

Commit

Permalink
Test the CSV array prior to building a response message
Browse files Browse the repository at this point in the history
  • Loading branch information
Daisuke Baba committed May 24, 2018
1 parent 61b3246 commit e65750f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/candy_board_qws/__init__.py
Expand Up @@ -911,6 +911,12 @@ def gnss_locate(self, cmd={}):
status, result = self.send_at("AT+QGPSLOC=%s" % (format))
if status == "OK":
csv = result.split(':')[1].strip().split(',')
if len(csv) < 11:
message = {
'status': 'ERROR',
'result': 'Temporary I/O Error',
}
return json.dumps(message)
latitude = csv[1]
if format == '1':
latitude = '%s %s' % (latitude, csv[2])
Expand Down

0 comments on commit e65750f

Please sign in to comment.