Example #1
0
def main():
#Intitialize the MQTT Client and subscriptions
  MQTTClient = functionalizedAWSIOT.AWS_MQTT_Initialize()
#Initialize AWS access keys
  AWSCredentials = helpers.getAWSCredentials()
#  print(AWSCredentials)
  #subscriptionFunctions.picture(None, None, None)
  while(1):
    sleep(5)
def main_func():
    MQTTClient = functionalizedAWSIOT.AWS_MQTT_Initialize()
    if functionalizedAWSIOT.AWS_MQTT_subscribe(
            MQTTClient, "testing", subscriptionFunctions.testCallbackFunction):
        sleep(5)
        functionalizedAWSIOT.AWS_MQTT_publish(MQTTClient, "testing",
                                              "testing message boop beep")
        sleep(5)
        return subscriptionFunctions.GLOBAL_TEST_VARIABLE
    return -1
Example #3
0
    # for windows
    if name == 'nt':
        _ = system('cls')

    # for mac and linux(here, os.name is 'posix')
    else:
        _ = system('clear')


# main function-----------------------------------------------
# ------------------------------------------------------------
if __name__ == "__main__":

    try:
        # initialize AWS MQTT----------------------------------
        myMQTTClient = functionalizedAWSIOT.AWS_MQTT_Initialize()
        print("MQTT Client Initialized")

        # initialize radio transceiver------------------------------------------------------------
        # ---------------------------------------------------------------------------------------
        radio = functionalizedRadio.initializeRadio()

        #prime the network -> workaround for strange inability to detect radios until subscription happens?
        radio.send(
            1, "1", attempts=1, waitTime=100
        )  #hack to overcome new issue - radios dead until radio.send!?

        clear()
        print("RADIO NETWORK INITIALIZED:\n\n")

        while True: