Skip to content

Commit

Permalink
Merge 29bef00 into 798a594
Browse files Browse the repository at this point in the history
  • Loading branch information
KD0NKS committed Mar 24, 2021
2 parents 798a594 + 29bef00 commit 8b97598
Show file tree
Hide file tree
Showing 8 changed files with 259 additions and 228 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
language: node_js
node_js:
- "stable"
- "10"
- "12"
- "13"
- "14"
- "15"

cache: npm

Expand Down
19 changes: 9 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"author": "afairhurst",
"license": "ISC",
"name": "js-aprs-fap",
"version": "1.0.1",
"version": "1.1.0-beta",
"homepage": "https://github.com/KD0NKS/js-aprs-fap",
"description": "NodeJs library for parsing APRS packets.",
"repository": {
Expand Down Expand Up @@ -43,20 +43,19 @@
"setup": "npm install",
"build": "npm run tsc",
"test": "nyc mocha",
"coverage": "nyc report --reporter=text-lcov | coveralls",
"prepare": "npm run build"
"coverage": "nyc report --reporter=text-lcov | coveralls"
},
"devDependencies": {
"@istanbuljs/nyc-config-typescript": "^1.0.1",
"@types/chai": "^4.2.12",
"@types/mocha": "^8.0.3",
"@types/node": "^14.10.1",
"chai": "^4.2.0",
"@types/chai": "^4.2.15",
"@types/mocha": "^8.2.2",
"@types/node": "^14.14.35",
"chai": "^4.3.4",
"coveralls": "^3.1.0",
"mocha": "^8.1.3",
"mocha": "^8.3.2",
"nyc": "^15.1.0",
"source-map-support": "^0.5.19",
"ts-node": "^9.0.0",
"typescript": "^4.0.2"
"ts-node": "^9.1.1",
"typescript": "^4.2.3"
}
}
57 changes: 57 additions & 0 deletions src/DSTSymbols.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/**
* A list of mappings from GPSxyz (or SPCxyz)
* to APRS symbols. Overlay characters (z) are
* not handled here
*/
export const DST_SYMBOLS: any = {
'BB': '/!', 'BC': '/"', 'BD': '/#', 'BE': '/$', 'BF': '/%', 'BG': '/&', 'BH': '/\'', 'BI': '/(!'
, 'BJ': '/)', 'BK': '/*', 'BL': '/+', 'BM': '/,)', 'BN': '/-', 'BO': '/.', 'BP': '//'
, 'P0': '/0', 'P1': '/1', 'P2': '/2', 'P3': '/3'
, 'P4': '/4', 'P5': '/5', 'P6': '/6', 'P7': '/7'
, 'P8': '/8', 'P9': '/9'
, 'MR': '/:', 'MS': '/;', 'MT': '/<', 'MU': '/='
, 'MV': '/>', 'MW': '/?', 'MX': '/@'
, 'PA': '/A', 'PB': '/B', 'PC': '/C', 'PD': '/D'
, 'PE': '/E', 'PF': '/F', 'PG': '/G', 'PH': '/H'
, 'PI': '/I', 'PJ': '/J', 'PK': '/K', 'PL': '/L'
, 'PM': '/M', 'PN': '/N', 'PO': '/O', 'PP': '/P'
, 'PQ': '/Q', 'PR': '/R', 'PS': '/S', 'PT': '/T'
, 'PU': '/U', 'PV': '/V', 'PW': '/W', 'PX': '/X'
, 'PY': '/Y', 'PZ': '/Z'
, 'HS': '/[', 'HT': '/\\', 'HU': '/]', 'HV': '/^'
, 'HW': '/_', 'HX': '/`'
, 'LA': '/a', 'LB': '/b', 'LC': '/c', 'LD': '/d'
, 'LE': '/e', 'LF': '/f', 'LG': '/g', 'LH': '/h'
, 'LI': '/i', 'LJ': '/j', 'LK': '/k', 'LL': '/l'
, 'LM': '/m', 'LN': '/n', 'LO': '/o', 'LP': '/p'
, 'LQ': '/q', 'LR': '/r', 'LS': '/s', 'LT': '/t'
, 'LU': '/u', 'LV': '/v', 'LW': '/w', 'LX': '/x'
, 'LY': '/y', 'LZ': '/z'
, 'J1': '/{', 'J2': '/|', 'J3': '/}', 'J4': '/~'
, 'OB': '\\!', 'OC': '\\"', 'OD': '\\#', 'OE': '\\$'
, 'OF': '\\%', 'OG': '\\&', 'OH': '\\\'', 'OI': '\\('
, 'OJ': '\\)', 'OK': '\\*', 'OL': '\\+', 'OM': '\\,'
, 'ON': '\\-', 'OO': '\\.', 'OP': '\\/'
, 'A0': '\\0', 'A1': '\\1', 'A2': '\\2', 'A3': '\\3'
, 'A4': '\\4', 'A5': '\\5', 'A6': '\\6', 'A7': '\\7'
, 'A8': '\\8', 'A9': '\\9'
, 'NR': '\\:', 'NS': '\\;', 'NT': '\\<', 'NU': '\\='
, 'NV': '\\>', 'NW': '\\?', 'NX': '\\@'
, 'AA': '\\A', 'AB': '\\B', 'AC': '\\C', 'AD': '\\D'
, 'AE': '\\E', 'AF': '\\F', 'AG': '\\G', 'AH': '\\H'
, 'AI': '\\I', 'AJ': '\\J', 'AK': '\\K', 'AL': '\\L'
, 'AM': '\\M', 'AN': '\\N', 'AO': '\\O', 'AP': '\\P'
, 'AQ': '\\Q', 'AR': '\\R', 'AS': '\\S', 'AT': '\\T'
, 'AU': '\\U', 'AV': '\\V', 'AW': '\\W', 'AX': '\\X'
, 'AY': '\\Y', 'AZ': '\\Z'
, 'DS': '\\[', 'DT': '\\\\', 'DU': '\\]', 'DV': '\\^'
, 'DW': '\\_', 'DX': '\\`'
, 'SA': '\\a', 'SB': '\\b', 'SC': '\\c', 'SD': '\\d'
, 'SE': '\\e', 'SF': '\\f', 'SG': '\\g', 'SH': '\\h'
, 'SI': '\\i', 'SJ': '\\j', 'SK': '\\k', 'SL': '\\l'
, 'SM': '\\m', 'SN': '\\n', 'SO': '\\o', 'SP': '\\p'
, 'SQ': '\\q', 'SR': '\\r', 'SS': '\\s', 'ST': '\\t'
, 'SU': '\\u', 'SV': '\\v', 'SW': '\\w', 'SX': '\\x'
, 'SY': '\\y', 'SZ': '\\z'
, 'Q1': '\\{', 'Q2': '\\|', 'Q3': '\\}', 'Q4': '\\~'
}
62 changes: 62 additions & 0 deletions src/ResultMessages.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
export const RESULT_MESSAGES: any = {
'unknown': 'Unsupported packet format'
, 'packet_no': 'No packet given to parse'
, 'packet_short': 'Too short packet'
, 'packet_nobody': 'No body in packet'
, 'srccall_noax25': 'Source callsign is not a valid AX.25 call'
, 'srccall_badchars': 'Source callsign contains bad characters'
, 'dstpath_toomany': 'Too many destination path components to be AX.25'
, 'dstcall_none': 'No destination field in packet'
, 'dstcall_noax25': 'Destination callsign is not a valid AX.25 call'
, 'digicall_noax25': 'Digipeater callsign is not a valid AX.25 call'
, 'digicall_badchars': 'Digipeater callsign contains bad characters'
, 'timestamp_inv_loc': 'Invalid timestamp in location'
, 'timestamp_inv_obj': 'Invalid timestamp in object'
, 'timestamp_inv_sta': 'Invalid timestamp in status'
, 'timestamp_inv_gpgga': 'Invalid timestamp in GPGGA sentence'
, 'timestamp_inv_gpgll': 'Invalid timestamp in GPGLL sentence'
, 'packet_invalid': 'Invalid packet'
, 'nmea_inv_cval': 'Invalid coordinate value in NMEA sentence'
, 'nmea_large_ew': 'Too large value in NMEA sentence (east/west)'
, 'nmea_large_ns': 'Too large value in NMEA sentence (north/south)'
, 'nmea_inv_sign': 'Invalid lat/long sign in NMEA sentence'
, 'nmea_inv_cksum': 'Invalid checksum in NMEA sentence'
, 'gprmc_fewfields': 'Less than ten fields in GPRMC sentence '
, 'gprmc_nofix': 'No GPS fix in GPRMC sentence'
, 'gprmc_inv_time': 'Invalid timestamp in GPRMC sentence'
, 'gprmc_inv_date': 'Invalid date in GPRMC sentence'
, 'gprmc_date_out': 'GPRMC date does not fit in an Unix timestamp'
, 'gpgga_fewfields': 'Less than 11 fields in GPGGA sentence'
, 'gpgga_nofix': 'No GPS fix in GPGGA sentence'
, 'gpgll_fewfields': 'Less than 5 fields in GPGLL sentence'
, 'gpgll_nofix': 'No GPS fix in GPGLL sentence'
, 'nmea_unsupp': 'Unsupported NMEA sentence type'
, 'obj_short': 'Too short object' // This cannot be hit by the perl parser
, 'obj_inv': 'Invalid object'
, 'obj_dec_err': 'Error in object location decoding'
, 'item_short': 'Too short item' // This cannot be hit by the perl parser
, 'item_inv': 'Invalid item'
, 'item_dec_err': 'Error in item location decoding'
, 'loc_short': 'Too short uncompressed location'
, 'loc_inv': 'Invalid uncompressed location'
, 'loc_large': 'Degree value too large'
, 'loc_amb_inv': 'Invalid position ambiguity'
, 'mice_short': 'Too short mic-e packet'
, 'mice_inv': 'Invalid characters in mic-e packet'
, 'mice_inv_info': 'Invalid characters in mic-e information field'
, 'mice_amb_large': 'Too much position ambiguity in mic-e packet'
, 'mice_amb_inv': 'Invalid position ambiguity in mic-e packet'
, 'mice_amb_odd': 'Odd position ambiguity in mic-e packet'
, 'comp_inv': 'Invalid compressed packet'
, 'msg_inv': 'Invalid message packet'
, 'wx_unsupp': 'Unsupported weather format'
// , 'user_unsupp': 'Unsupported user format' // Not Used
, 'dx_inv_src': 'Invalid DX spot source callsign'
, 'dx_inf_freq': 'Invalid DX spot frequency'
, 'dx_no_dx': 'No DX spot callsign found'
, 'tlm_inv': 'Invalid telemetry packet'
, 'tlm_large': 'Too large telemetry value'
, 'tlm_unsupp': 'Unsupported telemetry'
, 'exp_unsupp': 'Unsupported experimental'
, 'sym_inv_table': 'Invalid symbol table or overlay'
}
95 changes: 50 additions & 45 deletions src/aprsPacket.ts
Original file line number Diff line number Diff line change
@@ -1,49 +1,54 @@
import digipeater from './digipeater';
import telemetry from './telemetry';
import wx from './wx';
import digipeater from './digipeater'
import telemetry from './telemetry'
import wx from './wx'

export default class aprsPacket {
constructor() { }
constructor() {
this.receivedTime = Date.now()
}

public alive?: boolean;
public altitude?: number;
public body?: string;
public checksumok?: boolean;
public comment?: string;
public course?: number;
public daodatumbyte?: string;
public destCallsign?: string;
public destination?: string;
public digipeaters?: digipeater[];
public format?: string;
public gpsfixstatus?: boolean;
public header?: string;
public itemname?: string;
public latitude?: number;
public longitude?: number;
public mbits?: string;
public message?: string;
public messageAck?: string;
public messageId?: string;
public messageReject?: string;
public messaging?: boolean;
public mice_mangled?: boolean;
public objectname?: string;
public origpacket?: string;
public phg?: string;
public posambiguity?: number;
public posresolution?: number;
public radiorange?: number;
public resultCode?: string;
public resultMessage?: string;
public sourceCallsign?: string;
public speed?: number;
public status?: string;
public symbolcode?: string;
public symboltable?: string;
public telemetry?: telemetry;
public timestamp?: number;
public type?: string;
public warningCodes?: string[];
public wx?: wx;
public id: string

public alive?: boolean
public altitude?: number
public body?: string
public checksumok?: boolean
public comment?: string
public course?: number
public daodatumbyte?: string
public destCallsign?: string
public destination?: string
public digipeaters?: digipeater[]
public format?: string
public gpsfixstatus?: boolean
public header?: string
public itemname?: string
public latitude?: number
public longitude?: number
public mbits?: string
public message?: string
public messageAck?: string
public messageId?: string
public messageReject?: string
public messaging?: boolean
public mice_mangled?: boolean
public objectname?: string
public origpacket?: string
public phg?: string
public posambiguity?: number
public posresolution?: number
public receivedTime: number
public radiorange?: number
public resultCode?: string
public resultMessage?: string
public sourceCallsign?: string
public speed?: number
public status?: string
public symbolcode?: string
public symboltable?: string
public telemetry?: telemetry
public timestamp?: number
public type?: string
public warningCodes?: string[]
public wx?: wx
}
Loading

0 comments on commit 8b97598

Please sign in to comment.