コード例 #1
0
def aprsgate_tcp():
    parser = argparse.ArgumentParser()

    parser.add_argument('-c', '--callsign', help='callsign', required=True)
    parser.add_argument('-r',
                        '--redis_server',
                        help='Redis Server',
                        required=True)
    parser.add_argument('-t',
                        '--tag',
                        help='Gate Tag',
                        required=False,
                        default='IGATE')

    parser.add_argument('-p', '--passcode', help='passcode', required=True)
    parser.add_argument('-f',
                        '--aprs_filter',
                        help='Filter',
                        required=False,
                        default='p/RS0ISS u/ARISS/RS0ISS')

    opts = parser.parse_args()

    aprsc = aprs.TCP(opts.callsign,
                     opts.passcode,
                     aprs_filter=opts.aprs_filter)

    start_aprsgate(aprsc, opts.callsign, opts.redis_server, opts.tag)
コード例 #2
0
def cli():
    """Command Line interface for APRS Cursor-on-Target Gateway."""

    parser = argparse.ArgumentParser()
    parser.add_argument('-d',
                        '--debug',
                        help='Enable debug logging',
                        action='store_true')
    parser.add_argument('-c', '--callsign', help='callsign', required=True)
    parser.add_argument('-p', '--passcode', help='passcode', required=True)
    parser.add_argument('-C',
                        '--cot_host',
                        help='Cursor-on-Target Host',
                        required=True)
    parser.add_argument('-f', '--filter', help='APRS Filter', default='m/10')
    opts = parser.parse_args()

    aprs_i = aprs.TCP(opts.callsign, opts.passcode, aprs_filter=opts.filter)
    aprscot_i = aprscot.APRSCOT(aprs_i, opts.cot_host)

    try:
        aprs_i.start()
        aprscot_i.start()

        while aprscot_i.is_alive():
            time.sleep(0.01)
    except KeyboardInterrupt:
        aprscot_i.stop()
    finally:
        aprscot_i.stop()
コード例 #3
0
ファイル: app.py プロジェクト: ampledata/automatic_aprs
def slash():
    post_data = json.loads(flask.request.data)

    if ('location' in post_data and 'vehicle' in post_data
            and 'id' in post_data['vehicle']):
        location = post_data['location']
        vehicle_id = post_data['vehicle']['id']
    else:
        print 'No location or vehicle data in POST.'
        print locals()
        return 'OK'

    callsign_map = json.load(open(CALLSIGN_MAP))

    if vehicle_id in callsign_map:
        callsign = callsign_map[vehicle_id]
    else:
        print 'No valid vehicle_id to callsign mapping found.'
        print locals()
        return 'OK'

    aprs_conn = aprs.TCP(os.environ.get('APRS_LOGIN', 'AUTOMATIC'),
                         os.environ.get('APRS_PORT'))
    aprs_conn.start()

    frame = aprs.Frame()
    frame.destination = 'APYSAU'
    frame.path = ['TCPIP']
    frame.source = callsign
    frame.text = (
        "!%s\\%s7Automatic-to-APRS gateway. http://ampledata.org" %
        (aprs.dec2dm_lat(location['lat']), aprs.dec2dm_lng(location['lon'])))

    print frame
    aprs_result = aprs_conn.send(frame)
    print aprs_result

    return 'OK'
コード例 #4
0
def main():
    #aprs_filter = 'r/35.7157886/-120.7675918/100'  # McMillian
    aprs_filter = 'r/37.76/-122.4975/100'  # Home
    aprs_client = aprs.TCP('W2GMD', '10141', aprs_filter=aprs_filter)
    aprs_client.start()
    aprs_client.receive(to_cot)
コード例 #5
0
ファイル: create_aprs_message.py プロジェクト: rosewoodxd/AIR
import aprs
#pip install aprs
frame = aprs.parse_frame('ZR6AIC>APRS:>Hello World!')

a = aprs.TCP('ZR6AIC', '12345')
a.start()

a.send(frame)
コード例 #6
0
ファイル: cmd.py プロジェクト: nzerolbg/aprstracker
def cli():
    """Tracker Command Line interface for APRS."""

    parser = argparse.ArgumentParser()
    parser.add_argument('-d',
                        '--debug',
                        help='Enable debug logging',
                        action='store_true')
    parser.add_argument('-c', '--callsign', help='callsign', required=True)
    parser.add_argument('-p', '--passcode', help='passcode', required=True)
    parser.add_argument('-s',
                        '--serial_port',
                        help='serial_port',
                        required=True)
    parser.add_argument('-b',
                        '--serial_speed',
                        help='serial_speed',
                        default=9600)
    parser.add_argument('-i', '--interval', help='interval', default=0)

    opts = parser.parse_args()

    gps_p = aprstracker.SerialGPSPoller(opts.serial_port, opts.serial_speed)
    gps_p.start()
    time.sleep(aprstracker.GPS_WARM_UP)

    aprs_i = aprs.TCP(opts.callsign, opts.passcode)
    aprs_i.start()

    try:
        while 1:
            aprs_latitude = None
            aprs_longitude = None
            gps_latitude = gps_p.gps_props['latitude']
            gps_longitude = gps_p.gps_props['longitude']

            if gps_latitude is not None:
                aprs_latitude = aprs.dec2dm_lat(gps_latitude)
            if gps_longitude is not None:
                aprs_longitude = aprs.dec2dm_lng(gps_longitude)

            if aprs_latitude is not None and aprs_longitude is not None:
                frame = aprstracker.LocationFrame()
                frame.source = aprs.Callsign(opts.callsign)
                frame.destination = aprs.Callsign('APYSTR')
                frame.latitude = aprs_latitude
                frame.longitude = aprs_longitude
                frame.course = 0
                frame.speed = 0
                frame.altitude = gps_p.gps_props.get('altitude', 0)
                frame.symboltable = '/'
                frame.symbolcode = '>'
                frame.make_frame()

                aprs_i.send(frame)

                if opts.interval == 0:
                    break
                else:
                    time.sleep(opts.interval)

    except KeyboardInterrupt:
        gps_p.stop()
    finally:
        gps_p.stop()
コード例 #7
0
ファイル: aprs.py プロジェクト: mjwaxios/APRS_PY
#!/usr/bin/python
import aprs


def p(x):
    try:
        print "Source: %-10s Dest: %-10s Path: %-50s Text: %s" % (
            x.source, x.destination, x.path, x.text)
    except Exception as e:
        print e


a = aprs.TCP('nocall', '-1', None, 'r/0/0/65535')
a.start()

a.receive(callback=p)
コード例 #8
0
ファイル: js8aprsis.py プロジェクト: punk-kaos/JS8TNC
      js8string = targetcall + " MSG FROM " + fromcall +"via APRS:" + sendmsg
      print("Final out:" + js8string.rstrip())
      jsonout= "{\"params\": {\"_ID\": "+str(int(time.time()*1000))+"}, \"type\": \"TX.SEND_MESSAGE\", \"value\": \"" + js8string.rstrip() + "\"}"
      print("Jsonout:" + jsonout)
      print("Sending to JS8!")
      sock.sendto(bytes(jsonout,"utf8"), js8sock)
  else:
     frame = callsign +'>APRS::'+fromcall.ljust(9, ' ')+':JS8 Callsign '+targetcall+' not heard.'
     #frame = "KI7WKZ>APRS:>Hello World!"
     aprs.send(bytes(frame,"utf8"))

print("APRS-IS to JS8 Gateway. V0.1")
print("Waiting for JS8 to connect...")
rec, js8sock = sock.recvfrom(1024)
print ("JS8 Connected " + str(js8sock))
#Get Callsign from JS8
jsonout= "{\"params\": {\"_ID\": "+str(int(time.time()*1000))+"}, \"type\": \"STATION.GET_CALLSIGN\", \"value\": \"\"}"
sock.sendto(bytes(jsonout,"utf8"), js8sock)
rec = sock.recv(1024)
json_object = json.loads(rec)
print ("Callsign:"+ json_object['value'])
callsign=json_object['value']

print("Connecting to APRS-IS...")
aprs_prepass = getPass(callsign)
aprs_pass = str(aprs_prepass)
aprs = aprs.TCP(bytes(callsign, 'utf8'),aprs_pass,False,"d/JS8*")
aprs.start()
aprs.receive(callback=callback)