Created
June 29, 2018 09:22
-
-
Save shyampurk/890fd9ce5e65e07bd9879c57cb1fdf20 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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