fix bug for emergency function
This commit is contained in:
parent
24909bcdc1
commit
3ac23db9b1
@ -187,10 +187,12 @@ def dashboard_bb_write(call, dmr_id, time, bulletin):
|
|||||||
def sos_write(dmr_id, time, message):
|
def sos_write(dmr_id, time, message):
|
||||||
user_settings = ast.literal_eval(os.popen('cat ./user_settings.txt').read())
|
user_settings = ast.literal_eval(os.popen('cat ./user_settings.txt').read())
|
||||||
try:
|
try:
|
||||||
sos_call = user_settings[dmr_id][0]['call'] + '-' + user_settings[dmr_id][1]['ssid']
|
if user_settings[dmr_id][1]['ssid'] == '':
|
||||||
|
sos_call = user_settings[dmr_id][0]['call'] + '-' + user_ssid
|
||||||
|
else:
|
||||||
|
sos_call = user_settings[dmr_id][0]['call'] + '-' + user_settings[dmr_id][1]['ssid']
|
||||||
except:
|
except:
|
||||||
sos_call = str(get_alias((dmr_id), subscriber_ids))
|
sos_call = str(get_alias((dmr_id), subscriber_ids)) sos_info = {'call': sos_call, 'dmr_id': dmr_id, 'time': time, 'message':message}
|
||||||
sos_info = {'call': sos_call, 'dmr_id': dmr_id, 'time': time, 'message':message}
|
|
||||||
with open("/tmp/gps_data_user_sos.txt", 'w') as sos_file:
|
with open("/tmp/gps_data_user_sos.txt", 'w') as sos_file:
|
||||||
sos_file.write(str(sos_info))
|
sos_file.write(str(sos_info))
|
||||||
sos_file.close()
|
sos_file.close()
|
||||||
@ -277,7 +279,9 @@ def process_sms(_rf_src, sms):
|
|||||||
logger.info(error_exception)
|
logger.info(error_exception)
|
||||||
logger.info(str(traceback.extract_tb(error_exception.__traceback__)))
|
logger.info(str(traceback.extract_tb(error_exception.__traceback__)))
|
||||||
elif '@SOS' in sms:
|
elif '@SOS' in sms:
|
||||||
sos_write(int_id(_rf_src), 'time', sms)
|
sos_write(int_id(_rf_src), time.strftime('%H:%M:%S - %m/%d/%y'), sms)
|
||||||
|
logger.info('Removing SOS')
|
||||||
|
|
||||||
elif '@REM SOS' == sms:
|
elif '@REM SOS' == sms:
|
||||||
os.remove('/tmp/gps_data_user_sos.txt')
|
os.remove('/tmp/gps_data_user_sos.txt')
|
||||||
logger.info('Removing SOS')
|
logger.info('Removing SOS')
|
||||||
|
Loading…
Reference in New Issue
Block a user