Пример #1
0
addrs = subprocess.Popen(['i2cdetect','-y','1'],stdout=subprocess.PIPE,)

for i in range(0,9):
    line = str(addrs.stdout.readline())

    if "49" not in line:
        print("Iridium Modem not connected!")
        exit(1)

gps_port = "/dev/ttySC0"
gps_baud = 9600
modem_port = "/dev/ttySC1"
modem_baud = 19200

m1 = MinSat(gps_port,gps_baud,modem_port,modem_baud)

def display_gps_resp_struct(ret_info):
    print(
        "Successful Fix: {}/{}/{} {:02}:{:02}:{:02} -- {:.6f},{:06f}".format(
            ret_info.tm_mon,  # Grab parts of the time from the
            ret_info.tm_mday,  # struct_time object that holds
            ret_info.tm_year,  # the fix time.  Note you might
            ret_info.tm_hour,  # not get all data like year, day,
            ret_info.tm_min,  # month!
            ret_info.tm_sec,
            ret_info.latitude,
            ret_info.longitude,
        )
    )
Пример #2
0
import minsat
from minsat import MinSat

ex_msg = "Example 4 - Acquiring a GPS Position with enhanced verbosity"

print("-"*len(ex_msg))
print(ex_msg)
print("-"*len(ex_msg))

gps_port = "/dev/ttySC0"
gps_baud = 9600
modem_port = "/dev/ttySC1"
modem_baud = 19200

m1 = MinSat(gps_port,gps_baud,modem_port,modem_baud)

def display_gps_resp_struct(ret_info):
    print("="*50)
    print("Valid Position: " + str(ret_info.valid_position))
    print(
        "Fix timestamp: {}/{}/{} {:02}:{:02}:{:02}".format(
            ret_info.tm_mon,  # Grab parts of the time from the
            ret_info.tm_mday,  # struct_time object that holds
            ret_info.tm_year,  # the fix time.  Note you might
            ret_info.tm_hour,  # not get all data like year, day,
            ret_info.tm_min,  # month!
            ret_info.tm_sec,
        )
    )
    print("Latitude,Longitude: {:.6f},{:06f}".format(ret_info.latitude,ret_info.longitude))
    print("="*50)
Пример #3
0
import minsat
from minsat import MinSat
import time
import random

file = "/home/pi/Snocam_data/Finaldata.txt"
sent_entire_file = False
new_file_position = 0

gps_port = "/dev/ttySC0"
gps_baud = 9600
modem_port = "/dev/ttySC1"
modem_baud = 19200

m1 = MinSat(gps_port, gps_baud, modem_port, modem_baud)


def display_sbd_resp_struct(resp_struct):
    print("=" * 50)
    print("File Name: " + str(resp_struct.file_name))
    print("File Open Success: " + str(resp_struct.file_open_success))
    print("File Size: " + str(resp_struct.file_size))
    print("File Position Starting Point: " + str(resp_struct.start_file_loc))
    print("Number of SBD Sessions Required: " +
          str(resp_struct.xmt_num_sbd_req))
    print("Number of SBD Sessions Successfully Transmitted: " +
          str(resp_struct.xmt_num_sbd_success))
    print("Completed Sending File: " + str(resp_struct.xmt_file_complete))
    print(
        "Number of Bytes Transmitted: " + str(resp_struct.xmt_num_bytes)
    )  #Note that the transmitted number of bytes can be larger than the file size if num_hearder_lines > 0
Пример #4
0
import minsat
from minsat import MinSat
import time

ex_msg = "Example 16 - Powering the GPS On and Off"

print("-" * len(ex_msg))
print(ex_msg)
print("-" * len(ex_msg))

gps_port = "/dev/ttySC0"
gps_baud = 9600
modem_port = "/dev/ttySC1"
modem_baud = 19200

m1 = MinSat(gps_port, gps_baud, modem_port, modem_baud)

num_secs = 5

m1.gps_pwr(m1.dev_on)
print("GPS Power On.")
print("Waiting for " + str(num_secs) + " seconds...")
time.sleep(num_secs)
m1.gps_pwr(m1.dev_off)
print("GPS Power Off.")
Пример #5
0
import minsat
from minsat import MinSat

ex_msg = "Example 1 - Sending a message via Iridium when the message is 340 bytes or less"

print("-"*len(ex_msg))
print(ex_msg)
print("-"*len(ex_msg))

gps_port = "/dev/ttySC0"
gps_baud = 9600
modem_port = "/dev/ttySC1"
modem_baud = 19200

m1 = MinSat(gps_port,gps_baud,modem_port,modem_baud)

message1 = "Listen. Strange women lying in ponds distributing swords is no basis for a system of government. Supreme executive power derives from a mandate from the masses, not from some farcical aquatic ceremony."

resp = m1.sbd_send_message(message1)
print("resp = " + str(resp))