Beispiel #1
0
def main(commands, serial_port=None, **kwargs):

    commands = {
        'on': cmd_on,
        'unlock': cmd_unlock,
        'off': cmd_off,
        'info': cmd_device_info,
        'connect': cmd_connect,
    }

    log.info("Commands to run: {0}".format(' '.join(args.commands)))

    if serial_port == None:
        raise Exception("serial_port not set")

    # Verify commands
    for cmd in args.commands:
        if cmd not in commands.keys():
            raise Exception("Command not found {0}".format(cmd))

    # Setup node object
    node = cellulariot.CellularIoT(serial_port=serial_port)
    node.setupGPIO()

    # Call commands
    for cmd in args.commands:
        cmd_def = commands[cmd]
        log.info('Calling command \'{0}\''.format(cmd))
        cmd_def(node, **kwargs)
Beispiel #2
0
def init_cellulariot():
    node = cellulariot.CellularIoT()  # for Sixfab CellularIoT HAT
    node.setupGPIO()

    node.disable()
    time.sleep(1)
    node.enable()
    time.sleep(1)
    node.powerUp()
Beispiel #3
0
def main():
    node = cellulariot.CellularIoT()
    node.setupGPIO()

    print("Power up sequence - disabling first")
    node.disable()
    print("Disable done\n")
    time.sleep(1)
    print("Starting enable")
    node.enable()
    print("Enable done\n")
    time.sleep(1)
    print("Starting power up")
    node.powerUp()
    print("Power up done\n")

    time.sleep(0.5)
    node.sendATComm("ATE0", "OK")
    time.sleep(0.5)
    node.sendATComm("AT+CMEE=2", "OK")
    time.sleep(0.5)

    print("Turning GNSS on")
    node.turnOnGNSS()
    time.sleep(1)

    node.sendATComm("AT+QGPSCFG=\"nmeasrc\",1", "OK")

    print("Starting loop")
    while True:
        try:

            time.sleep(1)
            print(node.getNMEAGGA())
            '''
            time.sleep(1)
            print(node.getNMEARMC())
            '''
            time.sleep(1)
            print(node.getNMEAGSV())
            time.sleep(1)
            print(node.getNMEAGSA())
            '''
            time.sleep(1)
            print(node.getNMEAVTG())
            #ime.sleep(1)
            #rint(node.getFixedLocation())
            '''
            print()

        except KeyboardInterrupt:
            break

    print("\nExited loop, will turn GNSS off and quit.")
    node.turnOffGNSS()
    print("Done. Quiting.\n")
Beispiel #4
0
def main():
    node = cellulariot.CellularIoT()
    node.setupGPIO()

    print("Power up sequence - disabling first")
    node.disable()
    print("Disable done\n")
    time.sleep(1)

    print("Starting enable")
    node.enable()
    print("Enable done\n")
    time.sleep(1)

    print("Starting power up")
    node.powerUp()
    print("Power up done\n")

    print("Getting HW info")
    node.getHardwareInfo()
    print("Done")
    time.sleep(1)
    #rint("Sending ATE1 command")
    #ode.sendATComm("ATE1", "OK")

    print("Enabling gpsOneXTRA Assistance")
    node.sendATComm("AT+QGPSXTRA=1", "OK")
    node.sendATCommOnce("AT+QGPSXTRADATA?")
    print("Enabled\n")
    time.sleep(0.5)

    print("Turning GNSS on")
    node.turnOnGNSS()
    time.sleep(1)

    print("Starting loop")
    ctr = 0
    while ctr < 1000:
        ctr += 1
        try:
            #ode.sendATCommOnce("AT+QGPSXTRADATA?")
            node.getFixedLocation()
            time.sleep(1)

        except KeyboardInterrupt:
            break

    print("\nExited loop, will turn GNSS off and quit.")
    node.turnOffGNSS()
    print("Done. Quiting.\n")
Beispiel #5
0
def init_sixfab_cellulariot():
    """[summary]

    Returns:
        [type]: [description]
    """
    node = cellulariot.CellularIoT()
    node.setupGPIO()

    print("Power up sequence - disabling first")
    node.disable()
    print("Disable done\n")
    time.sleep(1)
    print("Starting enable")
    node.enable()
    print("Enable done\n")
    time.sleep(1)
    print("Starting power up")
    node.powerUp()
    print("Power up done\n")

    time.sleep(0.5)
    node.sendATComm("ATE0", "OK")
    time.sleep(0.5)
    node.sendATComm("AT+CMEE=2", "OK")
    time.sleep(0.5)

    print("Turning GNSS on")
    node.turnOnGNSS()
    time.sleep(1)

    node.sendATComm("AT+QGPSCFG=\"galileonmeatype\",1", "OK")
    time.sleep(0.5)
    node.sendATComm("AT+QGPSCFG=\"nmeasrc\",1", "OK")
    time.sleep(0.5)

    return node
Beispiel #6
0
from cellulariot import cellulariot
import time


node = cellulariot.CellularIoT()

node.setupGPIO()

node.disable()
time.sleep(1)
node.enable()
time.sleep(1)
node.powerUp()
Beispiel #7
0
def main():
    node = cellulariot.CellularIoT()
    node.setupGPIO()

    print("Power up sequence - disabling first")
    node.disable()
    print("Disable done\n")
    time.sleep(1)
    print("Starting enable")
    node.enable()
    print("Enable done\n")
    time.sleep(1)
    print("Starting power up")
    node.powerUp()
    print("Power up done\n")

    print("Sending ATE1 command")
    node.sendATComm("ATE1", "OK")

    print("Getting IMEI")
    node.getIMEI()
    print()
    time.sleep(0.5)

    print("Getting Firmware")
    node.getFirmwareInfo()
    time.sleep(0.5)

    print("Getting HW Info")
    node.getHardwareInfo()
    time.sleep(0.5)

    print("Enabling gpsOneXTRA Assistance")
    node.sendATComm("AT+QGPSXTRA=1", "OK")
    print("Enabled\n")
    time.sleep(0.5)
    '''
    print("Uploading gpsOneXTRA file via QCOM")
    node.sendATCommOnce("AT+QFUPL=\"UFS:xtra2.bin\",60831,60")
    print("Uploaded?\n")
    time.sleep(60)
    node.sendATCommOnce("AT+QFUPL=?")
    time.sleep(5)

    print("Injecting gpsOneXTRA time to GNSS engine")
    one_xtra_time = time.strftime("%Y/%m/%d,%H:%M:%S",time.gmtime())
    node.sendATComm("AT+QGPSXTRATIME=0,\"" + one_xtra_time + "\",1,1,5", "OK")
    print("Done\n")
    time.sleep(0.5)

    print("Injecting gpsOneXTRA data to GNSS engine")
    node.sendATComm("AT+QGPSXTRADATA=\"UFS:xtra2.bin\"", "OK")
    print("Done\n")
    time.sleep(0.5)

    print("Deleting gpsOneXTRA file from UFS file")
    node.sendATComm("AT+QFDEL=\"UFS:xtra2.bin\"", "OK")
    print("Done\n")
    time.sleep(0.5)
    '''
    print("Turning GNSS on")
    node.turnOnGNSS()
    time.sleep(1)

    print("Starting loop")
    while True:
        try:
            print(node.getLongitude())
            time.sleep(1)

        except KeyboardInterrupt:
            break

    print("\nExited loop, will turn GNSS off and quit.")
    node.turnOffGNSS()
    print("Done. Quiting.\n")
def main():
    node = cellulariot.CellularIoT()
    node.setupGPIO()

    print("Power up sequence - disabling first")
    node.disable()
    print("Disable done\n")
    time.sleep(1)

    print("Starting enable")
    node.enable()
    print("Enable done\n")
    time.sleep(1)
    
    print("Starting power up")
    node.powerUp()
    print("Power up done\n")

    '''
    print("Getting HW info")
    node.getHardwareInfo()
    print("Done")
    time.sleep(1)
    #rint("Sending ATE1 command")
    #ode.sendATComm("ATE1", "OK")
    '''

    print("Enabling gpsOneXTRA Assistance")
    node.sendATComm("AT+QGPSXTRA=1", "OK")
    node.sendATComm("AT+QGPSXTRADATA?","QGPSXTRADATA")
    print("Enabled\n")
    time.sleep(0.5)
    
    geofence_lat = 46.529303
    geofence_lon = 6.601181
    geofence_rad0 = 100
    geofence_rad1 = 500
    geofence_rad2 = 1000
    geofence_rad3 = 5000

    print("Setting a circular geo-fence centered around "+str(geofence_lat)+"N, "+str(geofence_lon)+"E of radius "+str(geofence_rad0)+"[m]")
    node.sendATComm("AT+QCFGEXT=\"addgeo\",0,3,0,"+str(geofence_lat)+","+str(geofence_lon)+","+str(geofence_rad0), "OK")
    time.sleep(0.5)
    print("Checking it")
    node.sendATComm("AT+QCFGEXT=\"addgeo\",0", "QCFGEXT")
    print("Geo-fence 0 set")

    print("Setting a circular geo-fence centered around "+str(geofence_lat)+"N, "+str(geofence_lon)+"E of radius "+str(geofence_rad1)+"[m]")
    node.sendATComm("AT+QCFGEXT=\"addgeo\",1,3,0,"+str(geofence_lat)+","+str(geofence_lon)+","+str(geofence_rad1), "OK")
    time.sleep(0.5)
    print("Checking it")
    node.sendATComm("AT+QCFGEXT=\"addgeo\",1", "QCFGEXT")
    print("Geo-fence 1 set")
    
    print("Setting a circular geo-fence centered around "+str(geofence_lat)+"N, "+str(geofence_lon)+"E of radius "+str(geofence_rad2)+"[m]")
    node.sendATComm("AT+QCFGEXT=\"addgeo\",2,3,0,"+str(geofence_lat)+","+str(geofence_lon)+","+str(geofence_rad2), "OK")
    time.sleep(0.5)
    print("Checking it")
    node.sendATComm("AT+QCFGEXT=\"addgeo\",2", "QCFGEXT")
    print("Geo-fence 2 set")

    print("Setting a circular geo-fence centered around "+str(geofence_lat)+"N, "+str(geofence_lon)+"E of radius "+str(geofence_rad3)+"[m]")
    node.sendATComm("AT+QCFGEXT=\"addgeo\",3,3,0,"+str(geofence_lat)+","+str(geofence_lon)+","+str(geofence_rad3), "OK")
    time.sleep(0.5)
    print("Checking it")
    node.sendATComm("AT+QCFGEXT=\"addgeo\",3", "QCFGEXT")
    print("Geo-fence 3 set")

    print("Turning GNSS on")
    node.turnOnGNSS()
    time.sleep(1)
    
    print("Starting loop")
    ctr = 0
    while ctr<1000:
        ctr+=1
        try:
            node.getFixedLocation()
            time.sleep(0.5)
            node.sendATComm("AT+QCFGEXT=\"querygeo\",0", "QCFGEXT")
            node.sendATComm("AT+QCFGEXT=\"querygeo\",1", "QCFGEXT")
            node.sendATComm("AT+QCFGEXT=\"querygeo\",2", "QCFGEXT")
            node.sendATComm("AT+QCFGEXT=\"querygeo\",3", "QCFGEXT")
            time.sleep(0.5)

        except KeyboardInterrupt:
            break

    print("\nExited loop, will turn GNSS off and quit.")
    node.turnOffGNSS()
    time.sleep(0.5)
    node.sendATComm("AT+QCFGEXT=\"deletegeo\",0", "OK")
    node.sendATComm("AT+QCFGEXT=\"deletegeo\",1", "OK")
    node.sendATComm("AT+QCFGEXT=\"deletegeo\",2", "OK")
    node.sendATComm("AT+QCFGEXT=\"deletegeo\",3", "OK")
    print("Done. Quiting.\n")
Beispiel #9
0
'''
  basicUDP.py - This is basic UDP example.
  Created by Yasin Kaya (selengalp), August 28, 2018.
'''
from cellulariot import cellulariot
import time

# your_ip = "xx.xx.xx.xx" # change with your ip
# your_port = "xxxx" # change with your port

node = cellulariot.CellularIoT()  # for Sixfab CellularIoT HAT
#node = cellulariot.CellularIoTApp() # for Sixfab CellularIoT App. Shield
node.setupGPIO()

node.disable()
time.sleep(1)
node.enable()
time.sleep(1)
node.powerUp()

node.sendATComm("ATE1", "OK\r\n")
node.sendATComm('AT+CGDCONT=1,"IP","sakura"', "OK\r\n")

node.getIMEI()
time.sleep(0.5)
node.getFirmwareInfo()
time.sleep(0.5)
node.getHardwareInfo()
time.sleep(0.5)

# node.setIPAddress(your_ip)
Beispiel #10
0
from cellulariot import cellulariot
node = cellulariot.CellularIoT(serial_port="/dev/ttyUSB2",
                               board="Sixfab Raspberry Pi Base HAT")

node.sendATComm("AT+CSQ", "\n")