summaryrefslogtreecommitdiff
path: root/jsongen.py.in
diff options
context:
space:
mode:
Diffstat (limited to 'jsongen.py.in')
-rw-r--r--jsongen.py.in48
1 files changed, 35 insertions, 13 deletions
diff --git a/jsongen.py.in b/jsongen.py.in
index eeb2c83f..80ed8db8 100644
--- a/jsongen.py.in
+++ b/jsongen.py.in
@@ -30,18 +30,19 @@ ais_specs = (
"structname": "ais->type1",
"fieldmap":(
# fieldname type default
- ('status', 'uinteger', '0'),
- ('turn', 'integer', 'AIS_TURN_NOT_AVAILABLE'),
- ('speed', 'uinteger', 'AIS_SPEED_NOT_AVAILABLE'),
- ('accuracy', 'boolean', 'false'),
- ('lon', 'integer', 'AIS_LON_NOT_AVAILABLE'),
- ('lat', 'integer', 'AIS_LAT_NOT_AVAILABLE'),
- ('course', 'uinteger', 'AIS_COURSE_NOT_AVAILABLE'),
- ('heading', 'uinteger', 'AIS_HEADING_NOT_AVAILABLE'),
- ('second', 'uinteger', 'AIS_SEC_NOT_AVAILABLE'),
- ('maneuver', 'uinteger', 'AIS_SEC_INOPERATIVE'),
- ('raim', 'boolean', 'false'),
- ('radio', 'uinteger', '0'),
+ ('status', 'uinteger', '0'),
+ ('status_text','ignore', None),
+ ('turn', 'integer', 'AIS_TURN_NOT_AVAILABLE'),
+ ('speed', 'uinteger', 'AIS_SPEED_NOT_AVAILABLE'),
+ ('accuracy', 'boolean', 'false'),
+ ('lon', 'integer', 'AIS_LON_NOT_AVAILABLE'),
+ ('lat', 'integer', 'AIS_LAT_NOT_AVAILABLE'),
+ ('course', 'uinteger', 'AIS_COURSE_NOT_AVAILABLE'),
+ ('heading', 'uinteger', 'AIS_HEADING_NOT_AVAILABLE'),
+ ('second', 'uinteger', 'AIS_SEC_NOT_AVAILABLE'),
+ ('maneuver', 'uinteger', 'AIS_SEC_INOPERATIVE'),
+ ('raim', 'boolean', 'false'),
+ ('radio', 'uinteger', '0'),
),
},
# Message types 2 and 3 duplicate 1
@@ -56,6 +57,7 @@ ais_specs = (
('lon', 'integer', "AIS_LON_NOT_AVAILABLE"),
('lat', 'integer', "AIS_LAT_NOT_AVAILABLE"),
('epfd', 'uinteger', "0"),
+ ('epfd_text', 'ignore', None),
('raim', 'boolean', "false"),
('radio', 'uinteger', "0"),
),
@@ -72,11 +74,13 @@ ais_specs = (
('callsign', 'string', None),
('shipname', 'string', None),
('shiptype', 'uinteger', '0'),
+ ('shiptype_text', 'ignore', None),
('to_bow', 'uinteger', '0'),
('to_stern', 'uinteger', '0'),
('to_port', 'uinteger', '0'),
('to_starboard', 'uinteger', '0'),
('epfd', 'uinteger', '0'),
+ ('epfd_text', 'ignore', None),
('eta', 'string', None),
('draught', 'uinteger', '0'),
('destination', 'string', None),
@@ -104,7 +108,9 @@ ais_specs = (
('ana_ext1', 'uinteger', '0'),
('ana_ext2', 'uinteger', '0'),
('racon', 'uinteger', '0'),
+ ('racon_text', 'ignore', None),
('light', 'uinteger', '0'),
+ ('light_text', 'ignore', None),
('alarm', 'boolean', 'false'),
('stat_ext', 'uinteger', '0'),
('off_pos', 'boolean', 'false'),
@@ -262,6 +268,7 @@ ais_specs = (
('linkage', 'uinteger', '0'),
('sender', 'uinteger', '0'),
('rtype', 'uinteger', '0'),
+ ('rtype_text', 'ignore', None),
('start', 'string', None),
('duration', 'uinteger', '0'),
('waypoints', 'array', (
@@ -374,6 +381,7 @@ ais_specs = (
('seastate', 'uinteger', 'DAC1FID11_SEASTATE_NOT_AVAILABLE'),
('watertemp', 'uinteger', 'DAC1FID11_WATERTEMP_NOT_AVAILABLE'),
('preciptype', 'uinteger', 'DAC1FID11_PRECIPTYPE_NOT_AVAILABLE'),
+ ('preciptype_text', 'ignore', None),
('salinity', 'uinteger', 'DAC1FID11_SALINITY_NOT_AVAILABLE'),
('ice', 'uinteger', 'DAC1FID11_ICE_NOT_AVAILABLE'),
),
@@ -452,9 +460,11 @@ ais_specs = (
('lat', 'integer', 'AIS_LAT3_NOT_AVAILABLE'),
('status', 'uinteger', '0'),
('signal', 'uinteger', '0'),
+ ('signal_text','ignore', None),
('hour', 'uinteger', 'AIS_HOUR_NOT_AVAILABLE'),
('minute', 'uinteger', 'AIS_MINUTE_NOT_AVAILABLE'),
('nextsignal', 'uinteger', '0'),
+ ('nextsignal_type', 'ignore', None),
),
},
{
@@ -466,6 +476,7 @@ ais_specs = (
('linkage', 'uinteger', '0'),
('sender', 'uinteger', '0'),
('rtype', 'uinteger', '0'),
+ ('rtype_text', 'ignore', None),
('start', 'string', None),
('duration', 'uinteger', '0'),
('waypoints', 'array', (
@@ -526,6 +537,7 @@ ais_specs = (
('seastate', 'uinteger', 'DAC1FID31_SEASTATE_NOT_AVAILABLE'),
('watertemp', 'integer', 'DAC1FID31_WATERTEMP_NOT_AVAILABLE'),
('preciptype', 'uinteger', 'DAC1FID31_PRECIPTYPE_NOT_AVAILABLE'),
+ ('preciptype_text', 'ignore', None),
('salinity', 'uinteger', 'DAC1FID31_SALINITY_NOT_AVAILABLE'),
('ice', 'uinteger', 'DAC1FID31_ICE_NOT_AVAILABLE'),
),
@@ -665,11 +677,13 @@ ais_specs = (
('regional', 'uinteger', '0'),
('shipname', 'string', None),
('shiptype', 'uinteger', '0'),
+ ('shiptype_text', 'ignore', None),
('to_bow', 'uinteger', '0'),
('to_stern', 'uinteger', '0'),
('to_port', 'uinteger', '0'),
('to_starboard', 'uinteger', '0'),
('epfd', 'uinteger', '0'),
+ ('epfd_text', 'ignore', None),
('raim', 'boolean', 'false'),
('dte', 'uinteger', '1'),
('assigned', 'boolean', 'false'),
@@ -705,7 +719,8 @@ ais_specs = (
"structname": "ais->type21",
"fieldmap":(
# fieldname type default
- ('aid_type', 'uinteger', '0'),
+ ('aid_type', 'uinteger', '0'),
+ ('aid_type_text', 'ignore', None),
('name', 'string', None),
('accuracy', 'boolean', 'false'),
('lon', 'integer', 'AIS_LON_NOT_AVAILABLE'),
@@ -715,6 +730,7 @@ ais_specs = (
('to_port', 'uinteger', '0'),
('to_starboard', 'uinteger', '0'),
('epfd', 'uinteger', '0'),
+ ('epfd_text', 'ignore', None),
('second', 'uinteger', '0'),
('regional', 'uinteger', '0'),
('off_position', 'boolean', 'false'),
@@ -755,7 +771,9 @@ ais_specs = (
('sw_lon', 'integer', 'AIS_GNS_LON_NOT_AVAILABLE'),
('sw_lat', 'integer', 'AIS_GNS_LAT_NOT_AVAILABLE'),
('stationtype', 'uinteger', '0'),
+ ('stationtype_text', 'ignore', None),
('shiptype', 'uinteger', '0'),
+ ('shiptype_text', 'ignore', None),
('txrx', 'uinteger', '0'),
('interval', 'uinteger', '0'),
('quiet', 'uinteger', '0'),
@@ -769,6 +787,7 @@ ais_specs = (
# fieldname type default
('shipname', 'string', None), # Part A
('shiptype', 'uinteger', '0'), # Part B
+ ('shiptype_text', 'ignore', None),
('vendorid', 'string', None), # Part B
('model', 'uinteger', '0'), # Part B
('serial', 'uinteger', '0'), # Part B
@@ -891,6 +910,9 @@ def generate(spec):
target = structname + "." + attr
if "." in attr:
attr = attr[attr.rfind(".")+1:]
+ if itype == 'ignore':
+ report += '\t{"%s", t_ignore},\n' % attr
+ continue
report += '\t{"%s",%st_%s,%s.addr.%s = %s%s,\n' % \
(attr, " "*(14-len(attr)), itype, " "*(10-len(itype)), itype, deref, target)
if itype == "string":