Skip to content

Instantly share code, notes, and snippets.

@shyampurk
Created June 29, 2018 09:22
Show Gist options
  • Save shyampurk/890fd9ce5e65e07bd9879c57cb1fdf20 to your computer and use it in GitHub Desktop.
Save shyampurk/890fd9ce5e65e07bd9879c57cb1fdf20 to your computer and use it in GitHub Desktop.
def systemInit():
global port, loraM, client
obtain_port()
gpio_init()
emergencyVehicleState.setdefault("state",0)
#loraM handles all the loraEvents
loraM = MCLoRa(port)
success = loraM.testOK()
if success:
print "Traffic Controller Gateway Init Success"
print (success)
else:
print("Traffic Controller Gateway Init FAILURE")
loraM.pause()
#Twilio Client
client = mqtt.Client(client_id="rpi", clean_session=False)
client.tls_set(None, pem_location, key_location)
client.on_message = handleEmergencyMessage
#
# Use qos=1 to get your device caught up right away.
#
client.connect('mqtt-sync.us1.twilio.com', 8883, 60)
client.subscribe('sync/docs/gpsData', qos=1)
client.loop_start()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment