@aircast-4g/mavlink 1.1.2 → 1.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dialects/ardupilotmega/index.d.ts +6373 -5
- package/dist/dialects/ardupilotmega/index.js +17515 -0
- package/dist/dialects/ardupilotmega/index.js.map +1 -0
- package/dist/dialects/common/index.d.ts +4817 -5
- package/dist/dialects/common/index.js +13420 -0
- package/dist/dialects/common/index.js.map +1 -0
- package/dist/dialects/minimal/index.d.ts +295 -5
- package/dist/dialects/minimal/index.js +570 -0
- package/dist/dialects/minimal/index.js.map +1 -0
- package/dist/dialects/paparazzi/index.d.ts +4851 -0
- package/dist/dialects/paparazzi/index.js +13518 -0
- package/dist/dialects/paparazzi/index.js.map +1 -0
- package/dist/dialects/python_array_test/index.d.ts +4886 -0
- package/dist/dialects/python_array_test/index.js +13665 -0
- package/dist/dialects/python_array_test/index.js.map +1 -0
- package/dist/dialects/standard/index.d.ts +301 -0
- package/dist/dialects/standard/index.js +578 -0
- package/dist/dialects/standard/index.js.map +1 -0
- package/dist/dialects/test/index.d.ts +53 -0
- package/dist/dialects/test/index.js +120 -0
- package/dist/dialects/test/index.js.map +1 -0
- package/dist/index.d.ts +345 -8
- package/dist/{index.js → mavlink.cjs.js} +8 -18
- package/dist/mavlink.cjs.js.map +1 -0
- package/dist/mavlink.esm.js +11 -0
- package/dist/mavlink.esm.js.map +1 -0
- package/dist/mavlink.iife.js +17 -0
- package/dist/mavlink.iife.js.map +1 -0
- package/package.json +52 -18
- package/dist/cli.d.ts +0 -3
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js +0 -174
- package/dist/cli.js.map +0 -1
- package/dist/dialects/ardupilotmega/decoder.js +0 -11930
- package/dist/dialects/ardupilotmega/enums.d.ts +0 -4631
- package/dist/dialects/ardupilotmega/messages.d.ts +0 -8088
- package/dist/dialects/ardupilotmega/types.d.ts +0 -2833
- package/dist/dialects/common/decoder.js +0 -9098
- package/dist/dialects/common/enums.d.ts +0 -3632
- package/dist/dialects/common/messages.d.ts +0 -6114
- package/dist/dialects/common/types.d.ts +0 -2159
- package/dist/dialects/minimal/decoder.js +0 -67
- package/dist/dialects/minimal/enums.d.ts +0 -494
- package/dist/dialects/minimal/messages.d.ts +0 -62
- package/dist/dialects/minimal/types.d.ts +0 -272
- package/dist/generator/batch-processor.d.ts +0 -17
- package/dist/generator/batch-processor.d.ts.map +0 -1
- package/dist/generator/batch-processor.js +0 -141
- package/dist/generator/batch-processor.js.map +0 -1
- package/dist/generator/generator.d.ts +0 -16
- package/dist/generator/generator.d.ts.map +0 -1
- package/dist/generator/generator.js +0 -136
- package/dist/generator/generator.js.map +0 -1
- package/dist/generator/template-engine.d.ts +0 -14
- package/dist/generator/template-engine.d.ts.map +0 -1
- package/dist/generator/template-engine.js +0 -270
- package/dist/generator/template-engine.js.map +0 -1
- package/dist/generator/type-converter.d.ts +0 -15
- package/dist/generator/type-converter.d.ts.map +0 -1
- package/dist/generator/type-converter.js +0 -179
- package/dist/generator/type-converter.js.map +0 -1
- package/dist/generator/xml-parser.d.ts +0 -13
- package/dist/generator/xml-parser.d.ts.map +0 -1
- package/dist/generator/xml-parser.js +0 -170
- package/dist/generator/xml-parser.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/parser/crc.d.ts +0 -7
- package/dist/parser/crc.d.ts.map +0 -1
- package/dist/parser/crc.js +0 -182
- package/dist/parser/crc.js.map +0 -1
- package/dist/parser/frame-parser.d.ts +0 -15
- package/dist/parser/frame-parser.d.ts.map +0 -1
- package/dist/parser/frame-parser.js +0 -82
- package/dist/parser/frame-parser.js.map +0 -1
- package/dist/parser/index.d.ts +0 -6
- package/dist/parser/index.d.ts.map +0 -1
- package/dist/parser/index.js +0 -28
- package/dist/parser/index.js.map +0 -1
- package/dist/parser/mavlink-parser.d.ts +0 -35
- package/dist/parser/mavlink-parser.d.ts.map +0 -1
- package/dist/parser/mavlink-parser.js +0 -215
- package/dist/parser/mavlink-parser.js.map +0 -1
- package/dist/parser/message-decoder.d.ts +0 -47
- package/dist/parser/message-decoder.d.ts.map +0 -1
- package/dist/parser/message-decoder.js +0 -288
- package/dist/parser/message-decoder.js.map +0 -1
- package/dist/parser/types.d.ts +0 -60
- package/dist/parser/types.d.ts.map +0 -1
- package/dist/parser/types.js +0 -13
- package/dist/parser/types.js.map +0 -1
- package/dist/types.d.ts +0 -110
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -3
- package/dist/types.js.map +0 -1
|
@@ -1,272 +0,0 @@
|
|
|
1
|
-
// Auto-generated TypeScript types for minimal dialect
|
|
2
|
-
// Generated from MAVLink XML definitions
|
|
3
|
-
|
|
4
|
-
export interface MAVLinkMessage<Content = unknown> {
|
|
5
|
-
timestamp: number;
|
|
6
|
-
system_id: number;
|
|
7
|
-
component_id: number;
|
|
8
|
-
type: string;
|
|
9
|
-
content: Content;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
// Micro air vehicle / autopilot classes. This identifies the individual model.
|
|
13
|
-
export type MAV_AUTOPILOT =
|
|
14
|
-
| 0 // MAV_AUTOPILOT_GENERIC - Generic autopilot, full support for everything
|
|
15
|
-
| 1 // MAV_AUTOPILOT_RESERVED - Reserved for future use.
|
|
16
|
-
| 2 // MAV_AUTOPILOT_SLUGS - SLUGS autopilot, http://slugsuav.soe.ucsc.edu
|
|
17
|
-
| 3 // MAV_AUTOPILOT_ARDUPILOTMEGA - ArduPilot - Plane/Copter/Rover/Sub/Tracker, https://ardupilot.org
|
|
18
|
-
| 4 // MAV_AUTOPILOT_OPENPILOT - OpenPilot, http://openpilot.org
|
|
19
|
-
| 5 // MAV_AUTOPILOT_GENERIC_WAYPOINTS_ONLY - Generic autopilot only supporting simple waypoints
|
|
20
|
-
| 6 // MAV_AUTOPILOT_GENERIC_WAYPOINTS_AND_SIMPLE_NAVIGATION_ONLY - Generic autopilot supporting waypoints and other simple navigation commands
|
|
21
|
-
| 7 // MAV_AUTOPILOT_GENERIC_MISSION_FULL - Generic autopilot supporting the full mission command set
|
|
22
|
-
| 8 // MAV_AUTOPILOT_INVALID - No valid autopilot, e.g. a GCS or other MAVLink component
|
|
23
|
-
| 9 // MAV_AUTOPILOT_PPZ - PPZ UAV - http://nongnu.org/paparazzi
|
|
24
|
-
| 10 // MAV_AUTOPILOT_UDB - UAV Dev Board
|
|
25
|
-
| 11 // MAV_AUTOPILOT_FP - FlexiPilot
|
|
26
|
-
| 12 // MAV_AUTOPILOT_PX4 - PX4 Autopilot - http://px4.io/
|
|
27
|
-
| 13 // MAV_AUTOPILOT_SMACCMPILOT - SMACCMPilot - http://smaccmpilot.org
|
|
28
|
-
| 14 // MAV_AUTOPILOT_AUTOQUAD - AutoQuad -- http://autoquad.org
|
|
29
|
-
| 15 // MAV_AUTOPILOT_ARMAZILA - Armazila -- http://armazila.com
|
|
30
|
-
| 16 // MAV_AUTOPILOT_AEROB - Aerob -- http://aerob.ru
|
|
31
|
-
| 17 // MAV_AUTOPILOT_ASLUAV - ASLUAV autopilot -- http://www.asl.ethz.ch
|
|
32
|
-
| 18 // MAV_AUTOPILOT_SMARTAP - SmartAP Autopilot - http://sky-drones.com
|
|
33
|
-
| 19 // MAV_AUTOPILOT_AIRRAILS - AirRails - http://uaventure.com
|
|
34
|
-
| 20 // MAV_AUTOPILOT_REFLEX - Fusion Reflex - https://fusion.engineering
|
|
35
|
-
| number;
|
|
36
|
-
|
|
37
|
-
// MAVLINK component type reported in HEARTBEAT message. Flight controllers must report the type of the vehicle on which they are mounted (e.g. MAV_TYPE_OCTOROTOR). All other components must report a value appropriate for their type (e.g. a camera must use MAV_TYPE_CAMERA).
|
|
38
|
-
export type MAV_TYPE =
|
|
39
|
-
| 0 // MAV_TYPE_GENERIC - Generic micro air vehicle
|
|
40
|
-
| 1 // MAV_TYPE_FIXED_WING - Fixed wing aircraft.
|
|
41
|
-
| 2 // MAV_TYPE_QUADROTOR - Quadrotor
|
|
42
|
-
| 3 // MAV_TYPE_COAXIAL - Coaxial helicopter
|
|
43
|
-
| 4 // MAV_TYPE_HELICOPTER - Normal helicopter with tail rotor.
|
|
44
|
-
| 5 // MAV_TYPE_ANTENNA_TRACKER - Ground installation
|
|
45
|
-
| 6 // MAV_TYPE_GCS - Operator control unit / ground control station
|
|
46
|
-
| 7 // MAV_TYPE_AIRSHIP - Airship, controlled
|
|
47
|
-
| 8 // MAV_TYPE_FREE_BALLOON - Free balloon, uncontrolled
|
|
48
|
-
| 9 // MAV_TYPE_ROCKET - Rocket
|
|
49
|
-
| 10 // MAV_TYPE_GROUND_ROVER - Ground rover
|
|
50
|
-
| 11 // MAV_TYPE_SURFACE_BOAT - Surface vessel, boat, ship
|
|
51
|
-
| 12 // MAV_TYPE_SUBMARINE - Submarine
|
|
52
|
-
| 13 // MAV_TYPE_HEXAROTOR - Hexarotor
|
|
53
|
-
| 14 // MAV_TYPE_OCTOROTOR - Octorotor
|
|
54
|
-
| 15 // MAV_TYPE_TRICOPTER - Tricopter
|
|
55
|
-
| 16 // MAV_TYPE_FLAPPING_WING - Flapping wing
|
|
56
|
-
| 17 // MAV_TYPE_KITE - Kite
|
|
57
|
-
| 18 // MAV_TYPE_ONBOARD_CONTROLLER - Onboard companion controller
|
|
58
|
-
| 19 // MAV_TYPE_VTOL_TAILSITTER_DUOROTOR - Two-rotor Tailsitter VTOL that additionally uses control surfaces in vertical operation. Note, value previously named MAV_TYPE_VTOL_DUOROTOR.
|
|
59
|
-
| 20 // MAV_TYPE_VTOL_TAILSITTER_QUADROTOR - Quad-rotor Tailsitter VTOL using a V-shaped quad config in vertical operation. Note: value previously named MAV_TYPE_VTOL_QUADROTOR.
|
|
60
|
-
| 21 // MAV_TYPE_VTOL_TILTROTOR - Tiltrotor VTOL. Fuselage and wings stay (nominally) horizontal in all flight phases. It able to tilt (some) rotors to provide thrust in cruise flight.
|
|
61
|
-
| 22 // MAV_TYPE_VTOL_FIXEDROTOR - VTOL with separate fixed rotors for hover and cruise flight. Fuselage and wings stay (nominally) horizontal in all flight phases.
|
|
62
|
-
| 23 // MAV_TYPE_VTOL_TAILSITTER - Tailsitter VTOL. Fuselage and wings orientation changes depending on flight phase: vertical for hover, horizontal for cruise. Use more specific VTOL MAV_TYPE_VTOL_TAILSITTER_DUOROTOR or MAV_TYPE_VTOL_TAILSITTER_QUADROTOR if appropriate.
|
|
63
|
-
| 24 // MAV_TYPE_VTOL_TILTWING - Tiltwing VTOL. Fuselage stays horizontal in all flight phases. The whole wing, along with any attached engine, can tilt between vertical and horizontal mode.
|
|
64
|
-
| 25 // MAV_TYPE_VTOL_RESERVED5 - VTOL reserved 5
|
|
65
|
-
| 26 // MAV_TYPE_GIMBAL - Gimbal
|
|
66
|
-
| 27 // MAV_TYPE_ADSB - ADSB system
|
|
67
|
-
| 28 // MAV_TYPE_PARAFOIL - Steerable, nonrigid airfoil
|
|
68
|
-
| 29 // MAV_TYPE_DODECAROTOR - Dodecarotor
|
|
69
|
-
| 30 // MAV_TYPE_CAMERA - Camera
|
|
70
|
-
| 31 // MAV_TYPE_CHARGING_STATION - Charging station
|
|
71
|
-
| 32 // MAV_TYPE_FLARM - FLARM collision avoidance system
|
|
72
|
-
| 33 // MAV_TYPE_SERVO - Servo
|
|
73
|
-
| 34 // MAV_TYPE_ODID - Open Drone ID. See https://mavlink.io/en/services/opendroneid.html.
|
|
74
|
-
| 35 // MAV_TYPE_DECAROTOR - Decarotor
|
|
75
|
-
| 36 // MAV_TYPE_BATTERY - Battery
|
|
76
|
-
| 37 // MAV_TYPE_PARACHUTE - Parachute
|
|
77
|
-
| 38 // MAV_TYPE_LOG - Log
|
|
78
|
-
| 39 // MAV_TYPE_OSD - OSD
|
|
79
|
-
| 40 // MAV_TYPE_IMU - IMU
|
|
80
|
-
| 41 // MAV_TYPE_GPS - GPS
|
|
81
|
-
| 42 // MAV_TYPE_WINCH - Winch
|
|
82
|
-
| 43 // MAV_TYPE_GENERIC_MULTIROTOR - Generic multirotor that does not fit into a specific type or whose type is unknown
|
|
83
|
-
| 44 // MAV_TYPE_ILLUMINATOR - Illuminator. An illuminator is a light source that is used for lighting up dark areas external to the system: e.g. a torch or searchlight (as opposed to a light source for illuminating the system itself, e.g. an indicator light).
|
|
84
|
-
| 45 // MAV_TYPE_SPACECRAFT_ORBITER - Orbiter spacecraft. Includes satellites orbiting terrestrial and extra-terrestrial bodies. Follows NASA Spacecraft Classification.
|
|
85
|
-
| 46 // MAV_TYPE_GROUND_QUADRUPED - A generic four-legged ground vehicle (e.g., a robot dog).
|
|
86
|
-
| 47 // MAV_TYPE_VTOL_GYRODYNE - VTOL hybrid of helicopter and autogyro. It has a main rotor for lift and separate propellers for forward flight. The rotor must be powered for hover but can autorotate in cruise flight. See: https://en.wikipedia.org/wiki/Gyrodyne
|
|
87
|
-
| 48 // MAV_TYPE_GRIPPER - Gripper
|
|
88
|
-
| number;
|
|
89
|
-
|
|
90
|
-
// These flags encode the MAV mode, see MAV_MODE enum for useful combinations.
|
|
91
|
-
export type MAV_MODE_FLAG =
|
|
92
|
-
| 128 // MAV_MODE_FLAG_SAFETY_ARMED - 0b10000000 MAV safety set to armed. Motors are enabled / running / can start. Ready to fly. Additional note: this flag is to be ignore when sent in the command MAV_CMD_DO_SET_MODE and MAV_CMD_COMPONENT_ARM_DISARM shall be used instead. The flag can still be used to report the armed state.
|
|
93
|
-
| 64 // MAV_MODE_FLAG_MANUAL_INPUT_ENABLED - 0b01000000 remote control input is enabled.
|
|
94
|
-
| 32 // MAV_MODE_FLAG_HIL_ENABLED - 0b00100000 hardware in the loop simulation. All motors / actuators are blocked, but internal software is full operational.
|
|
95
|
-
| 16 // MAV_MODE_FLAG_STABILIZE_ENABLED - 0b00010000 system stabilizes electronically its attitude (and optionally position). It needs however further control inputs to move around.
|
|
96
|
-
| 8 // MAV_MODE_FLAG_GUIDED_ENABLED - 0b00001000 guided mode enabled, system flies waypoints / mission items.
|
|
97
|
-
| 4 // MAV_MODE_FLAG_AUTO_ENABLED - 0b00000100 autonomous mode enabled, system finds its own goal positions. Guided flag can be set or not, depends on the actual implementation.
|
|
98
|
-
| 2 // MAV_MODE_FLAG_TEST_ENABLED - 0b00000010 system has a test mode enabled. This flag is intended for temporary system tests and should not be used for stable implementations.
|
|
99
|
-
| 1 // MAV_MODE_FLAG_CUSTOM_MODE_ENABLED - 0b00000001 system-specific custom mode is enabled. When using this flag to enable a custom mode all other flags should be ignored.
|
|
100
|
-
| number;
|
|
101
|
-
|
|
102
|
-
// These values encode the bit positions of the decode position. These values can be used to read the value of a flag bit by combining the base_mode variable with AND with the flag position value. The result will be either 0 or 1, depending on if the flag is set or not.
|
|
103
|
-
export type MAV_MODE_FLAG_DECODE_POSITION =
|
|
104
|
-
| 128 // MAV_MODE_FLAG_DECODE_POSITION_SAFETY - First bit: 10000000
|
|
105
|
-
| 64 // MAV_MODE_FLAG_DECODE_POSITION_MANUAL - Second bit: 01000000
|
|
106
|
-
| 32 // MAV_MODE_FLAG_DECODE_POSITION_HIL - Third bit: 00100000
|
|
107
|
-
| 16 // MAV_MODE_FLAG_DECODE_POSITION_STABILIZE - Fourth bit: 00010000
|
|
108
|
-
| 8 // MAV_MODE_FLAG_DECODE_POSITION_GUIDED - Fifth bit: 00001000
|
|
109
|
-
| 4 // MAV_MODE_FLAG_DECODE_POSITION_AUTO - Sixth bit: 00000100
|
|
110
|
-
| 2 // MAV_MODE_FLAG_DECODE_POSITION_TEST - Seventh bit: 00000010
|
|
111
|
-
| 1 // MAV_MODE_FLAG_DECODE_POSITION_CUSTOM_MODE - Eighth bit: 00000001
|
|
112
|
-
| number;
|
|
113
|
-
|
|
114
|
-
export type MAV_STATE =
|
|
115
|
-
| 0 // MAV_STATE_UNINIT - Uninitialized system, state is unknown.
|
|
116
|
-
| 1 // MAV_STATE_BOOT - System is booting up.
|
|
117
|
-
| 2 // MAV_STATE_CALIBRATING - System is calibrating and not flight-ready.
|
|
118
|
-
| 3 // MAV_STATE_STANDBY - System is grounded and on standby. It can be launched any time.
|
|
119
|
-
| 4 // MAV_STATE_ACTIVE - System is active and might be already airborne. Motors are engaged.
|
|
120
|
-
| 5 // MAV_STATE_CRITICAL - System is in a non-normal flight mode (failsafe). It can however still navigate.
|
|
121
|
-
| 6 // MAV_STATE_EMERGENCY - System is in a non-normal flight mode (failsafe). It lost control over parts or over the whole airframe. It is in mayday and going down.
|
|
122
|
-
| 7 // MAV_STATE_POWEROFF - System just initialized its power-down sequence, will shut down now.
|
|
123
|
-
| 8 // MAV_STATE_FLIGHT_TERMINATION - System is terminating itself (failsafe or commanded).
|
|
124
|
-
| number;
|
|
125
|
-
|
|
126
|
-
// Legacy component ID values for particular types of hardware/software that might make up a MAVLink system (autopilot, cameras, servos, avoidance systems etc.).
|
|
127
|
-
// Components are not required or expected to use IDs with names that correspond to their type or function, but may choose to do so.
|
|
128
|
-
// Using an ID that matches the type may slightly reduce the chances of component id clashes, as, for historical reasons, it is less likely to be used by some other type of component.
|
|
129
|
-
// System integration will still need to ensure that all components have unique IDs.
|
|
130
|
-
// Component IDs are used for addressing messages to a particular component within a system.
|
|
131
|
-
// A component can use any unique ID between 1 and 255 (MAV_COMP_ID_ALL value is the broadcast address, used to send to all components).
|
|
132
|
-
// Historically component ID were also used for identifying the type of component.
|
|
133
|
-
// New code must not use component IDs to infer the component type, but instead check the MAV_TYPE in the HEARTBEAT message!
|
|
134
|
-
export type MAV_COMPONENT =
|
|
135
|
-
| 0 // MAV_COMP_ID_ALL - Target id (target_component) used to broadcast messages to all components of the receiving system. Components should attempt to process messages with this component ID and forward to components on any other interfaces. Note: This is not a valid *source* component id for a message.
|
|
136
|
-
| 1 // MAV_COMP_ID_AUTOPILOT1 - System flight controller component ("autopilot"). Only one autopilot is expected in a particular system.
|
|
137
|
-
| 25 // MAV_COMP_ID_USER1 - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network.
|
|
138
|
-
| 26 // MAV_COMP_ID_USER2 - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network.
|
|
139
|
-
| 27 // MAV_COMP_ID_USER3 - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network.
|
|
140
|
-
| 28 // MAV_COMP_ID_USER4 - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network.
|
|
141
|
-
| 29 // MAV_COMP_ID_USER5 - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network.
|
|
142
|
-
| 30 // MAV_COMP_ID_USER6 - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network.
|
|
143
|
-
| 31 // MAV_COMP_ID_USER7 - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network.
|
|
144
|
-
| 32 // MAV_COMP_ID_USER8 - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network.
|
|
145
|
-
| 33 // MAV_COMP_ID_USER9 - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network.
|
|
146
|
-
| 34 // MAV_COMP_ID_USER10 - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network.
|
|
147
|
-
| 35 // MAV_COMP_ID_USER11 - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network.
|
|
148
|
-
| 36 // MAV_COMP_ID_USER12 - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network.
|
|
149
|
-
| 37 // MAV_COMP_ID_USER13 - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network.
|
|
150
|
-
| 38 // MAV_COMP_ID_USER14 - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network.
|
|
151
|
-
| 39 // MAV_COMP_ID_USER15 - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network.
|
|
152
|
-
| 40 // MAV_COMP_ID_USER16 - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network.
|
|
153
|
-
| 41 // MAV_COMP_ID_USER17 - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network.
|
|
154
|
-
| 42 // MAV_COMP_ID_USER18 - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network.
|
|
155
|
-
| 43 // MAV_COMP_ID_USER19 - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network.
|
|
156
|
-
| 44 // MAV_COMP_ID_USER20 - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network.
|
|
157
|
-
| 45 // MAV_COMP_ID_USER21 - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network.
|
|
158
|
-
| 46 // MAV_COMP_ID_USER22 - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network.
|
|
159
|
-
| 47 // MAV_COMP_ID_USER23 - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network.
|
|
160
|
-
| 48 // MAV_COMP_ID_USER24 - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network.
|
|
161
|
-
| 49 // MAV_COMP_ID_USER25 - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network.
|
|
162
|
-
| 50 // MAV_COMP_ID_USER26 - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network.
|
|
163
|
-
| 51 // MAV_COMP_ID_USER27 - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network.
|
|
164
|
-
| 52 // MAV_COMP_ID_USER28 - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network.
|
|
165
|
-
| 53 // MAV_COMP_ID_USER29 - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network.
|
|
166
|
-
| 54 // MAV_COMP_ID_USER30 - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network.
|
|
167
|
-
| 55 // MAV_COMP_ID_USER31 - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network.
|
|
168
|
-
| 56 // MAV_COMP_ID_USER32 - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network.
|
|
169
|
-
| 57 // MAV_COMP_ID_USER33 - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network.
|
|
170
|
-
| 58 // MAV_COMP_ID_USER34 - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network.
|
|
171
|
-
| 59 // MAV_COMP_ID_USER35 - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network.
|
|
172
|
-
| 60 // MAV_COMP_ID_USER36 - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network.
|
|
173
|
-
| 61 // MAV_COMP_ID_USER37 - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network.
|
|
174
|
-
| 62 // MAV_COMP_ID_USER38 - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network.
|
|
175
|
-
| 63 // MAV_COMP_ID_USER39 - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network.
|
|
176
|
-
| 64 // MAV_COMP_ID_USER40 - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network.
|
|
177
|
-
| 65 // MAV_COMP_ID_USER41 - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network.
|
|
178
|
-
| 66 // MAV_COMP_ID_USER42 - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network.
|
|
179
|
-
| 67 // MAV_COMP_ID_USER43 - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network.
|
|
180
|
-
| 68 // MAV_COMP_ID_TELEMETRY_RADIO - Telemetry radio (e.g. SiK radio, or other component that emits RADIO_STATUS messages).
|
|
181
|
-
| 69 // MAV_COMP_ID_USER45 - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network.
|
|
182
|
-
| 70 // MAV_COMP_ID_USER46 - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network.
|
|
183
|
-
| 71 // MAV_COMP_ID_USER47 - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network.
|
|
184
|
-
| 72 // MAV_COMP_ID_USER48 - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network.
|
|
185
|
-
| 73 // MAV_COMP_ID_USER49 - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network.
|
|
186
|
-
| 74 // MAV_COMP_ID_USER50 - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network.
|
|
187
|
-
| 75 // MAV_COMP_ID_USER51 - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network.
|
|
188
|
-
| 76 // MAV_COMP_ID_USER52 - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network.
|
|
189
|
-
| 77 // MAV_COMP_ID_USER53 - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network.
|
|
190
|
-
| 78 // MAV_COMP_ID_USER54 - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network.
|
|
191
|
-
| 79 // MAV_COMP_ID_USER55 - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network.
|
|
192
|
-
| 80 // MAV_COMP_ID_USER56 - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network.
|
|
193
|
-
| 81 // MAV_COMP_ID_USER57 - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network.
|
|
194
|
-
| 82 // MAV_COMP_ID_USER58 - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network.
|
|
195
|
-
| 83 // MAV_COMP_ID_USER59 - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network.
|
|
196
|
-
| 84 // MAV_COMP_ID_USER60 - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network.
|
|
197
|
-
| 85 // MAV_COMP_ID_USER61 - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network.
|
|
198
|
-
| 86 // MAV_COMP_ID_USER62 - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network.
|
|
199
|
-
| 87 // MAV_COMP_ID_USER63 - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network.
|
|
200
|
-
| 88 // MAV_COMP_ID_USER64 - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network.
|
|
201
|
-
| 89 // MAV_COMP_ID_USER65 - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network.
|
|
202
|
-
| 90 // MAV_COMP_ID_USER66 - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network.
|
|
203
|
-
| 91 // MAV_COMP_ID_USER67 - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network.
|
|
204
|
-
| 92 // MAV_COMP_ID_USER68 - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network.
|
|
205
|
-
| 93 // MAV_COMP_ID_USER69 - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network.
|
|
206
|
-
| 94 // MAV_COMP_ID_USER70 - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network.
|
|
207
|
-
| 95 // MAV_COMP_ID_USER71 - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network.
|
|
208
|
-
| 96 // MAV_COMP_ID_USER72 - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network.
|
|
209
|
-
| 97 // MAV_COMP_ID_USER73 - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network.
|
|
210
|
-
| 98 // MAV_COMP_ID_USER74 - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network.
|
|
211
|
-
| 99 // MAV_COMP_ID_USER75 - Id for a component on privately managed MAVLink network. Can be used for any purpose but may not be published by components outside of the private network.
|
|
212
|
-
| 100 // MAV_COMP_ID_CAMERA - Camera #1.
|
|
213
|
-
| 101 // MAV_COMP_ID_CAMERA2 - Camera #2.
|
|
214
|
-
| 102 // MAV_COMP_ID_CAMERA3 - Camera #3.
|
|
215
|
-
| 103 // MAV_COMP_ID_CAMERA4 - Camera #4.
|
|
216
|
-
| 104 // MAV_COMP_ID_CAMERA5 - Camera #5.
|
|
217
|
-
| 105 // MAV_COMP_ID_CAMERA6 - Camera #6.
|
|
218
|
-
| 140 // MAV_COMP_ID_SERVO1 - Servo #1.
|
|
219
|
-
| 141 // MAV_COMP_ID_SERVO2 - Servo #2.
|
|
220
|
-
| 142 // MAV_COMP_ID_SERVO3 - Servo #3.
|
|
221
|
-
| 143 // MAV_COMP_ID_SERVO4 - Servo #4.
|
|
222
|
-
| 144 // MAV_COMP_ID_SERVO5 - Servo #5.
|
|
223
|
-
| 145 // MAV_COMP_ID_SERVO6 - Servo #6.
|
|
224
|
-
| 146 // MAV_COMP_ID_SERVO7 - Servo #7.
|
|
225
|
-
| 147 // MAV_COMP_ID_SERVO8 - Servo #8.
|
|
226
|
-
| 148 // MAV_COMP_ID_SERVO9 - Servo #9.
|
|
227
|
-
| 149 // MAV_COMP_ID_SERVO10 - Servo #10.
|
|
228
|
-
| 150 // MAV_COMP_ID_SERVO11 - Servo #11.
|
|
229
|
-
| 151 // MAV_COMP_ID_SERVO12 - Servo #12.
|
|
230
|
-
| 152 // MAV_COMP_ID_SERVO13 - Servo #13.
|
|
231
|
-
| 153 // MAV_COMP_ID_SERVO14 - Servo #14.
|
|
232
|
-
| 154 // MAV_COMP_ID_GIMBAL - Gimbal #1.
|
|
233
|
-
| 155 // MAV_COMP_ID_LOG - Logging component.
|
|
234
|
-
| 156 // MAV_COMP_ID_ADSB - Automatic Dependent Surveillance-Broadcast (ADS-B) component.
|
|
235
|
-
| 157 // MAV_COMP_ID_OSD - On Screen Display (OSD) devices for video links.
|
|
236
|
-
| 158 // MAV_COMP_ID_PERIPHERAL - Generic autopilot peripheral component ID. Meant for devices that do not implement the parameter microservice.
|
|
237
|
-
| 159 // MAV_COMP_ID_QX1_GIMBAL - Gimbal ID for QX1.
|
|
238
|
-
| 160 // MAV_COMP_ID_FLARM - FLARM collision alert component.
|
|
239
|
-
| 161 // MAV_COMP_ID_PARACHUTE - Parachute component.
|
|
240
|
-
| 169 // MAV_COMP_ID_WINCH - Winch component.
|
|
241
|
-
| 171 // MAV_COMP_ID_GIMBAL2 - Gimbal #2.
|
|
242
|
-
| 172 // MAV_COMP_ID_GIMBAL3 - Gimbal #3.
|
|
243
|
-
| 173 // MAV_COMP_ID_GIMBAL4 - Gimbal #4
|
|
244
|
-
| 174 // MAV_COMP_ID_GIMBAL5 - Gimbal #5.
|
|
245
|
-
| 175 // MAV_COMP_ID_GIMBAL6 - Gimbal #6.
|
|
246
|
-
| 180 // MAV_COMP_ID_BATTERY - Battery #1.
|
|
247
|
-
| 181 // MAV_COMP_ID_BATTERY2 - Battery #2.
|
|
248
|
-
| 189 // MAV_COMP_ID_MAVCAN - CAN over MAVLink client.
|
|
249
|
-
| 190 // MAV_COMP_ID_MISSIONPLANNER - Component that can generate/supply a mission flight plan (e.g. GCS or developer API).
|
|
250
|
-
| 191 // MAV_COMP_ID_ONBOARD_COMPUTER - Component that lives on the onboard computer (companion computer) and has some generic functionalities, such as settings system parameters and monitoring the status of some processes that don't directly speak mavlink and so on.
|
|
251
|
-
| 192 // MAV_COMP_ID_ONBOARD_COMPUTER2 - Component that lives on the onboard computer (companion computer) and has some generic functionalities, such as settings system parameters and monitoring the status of some processes that don't directly speak mavlink and so on.
|
|
252
|
-
| 193 // MAV_COMP_ID_ONBOARD_COMPUTER3 - Component that lives on the onboard computer (companion computer) and has some generic functionalities, such as settings system parameters and monitoring the status of some processes that don't directly speak mavlink and so on.
|
|
253
|
-
| 194 // MAV_COMP_ID_ONBOARD_COMPUTER4 - Component that lives on the onboard computer (companion computer) and has some generic functionalities, such as settings system parameters and monitoring the status of some processes that don't directly speak mavlink and so on.
|
|
254
|
-
| 195 // MAV_COMP_ID_PATHPLANNER - Component that finds an optimal path between points based on a certain constraint (e.g. minimum snap, shortest path, cost, etc.).
|
|
255
|
-
| 196 // MAV_COMP_ID_OBSTACLE_AVOIDANCE - Component that plans a collision free path between two points.
|
|
256
|
-
| 197 // MAV_COMP_ID_VISUAL_INERTIAL_ODOMETRY - Component that provides position estimates using VIO techniques.
|
|
257
|
-
| 198 // MAV_COMP_ID_PAIRING_MANAGER - Component that manages pairing of vehicle and GCS.
|
|
258
|
-
| 200 // MAV_COMP_ID_IMU - Inertial Measurement Unit (IMU) #1.
|
|
259
|
-
| 201 // MAV_COMP_ID_IMU_2 - Inertial Measurement Unit (IMU) #2.
|
|
260
|
-
| 202 // MAV_COMP_ID_IMU_3 - Inertial Measurement Unit (IMU) #3.
|
|
261
|
-
| 220 // MAV_COMP_ID_GPS - GPS #1.
|
|
262
|
-
| 221 // MAV_COMP_ID_GPS2 - GPS #2.
|
|
263
|
-
| 236 // MAV_COMP_ID_ODID_TXRX_1 - Open Drone ID transmitter/receiver (Bluetooth/WiFi/Internet).
|
|
264
|
-
| 237 // MAV_COMP_ID_ODID_TXRX_2 - Open Drone ID transmitter/receiver (Bluetooth/WiFi/Internet).
|
|
265
|
-
| 238 // MAV_COMP_ID_ODID_TXRX_3 - Open Drone ID transmitter/receiver (Bluetooth/WiFi/Internet).
|
|
266
|
-
| 240 // MAV_COMP_ID_UDP_BRIDGE - Component to bridge MAVLink to UDP (i.e. from a UART).
|
|
267
|
-
| 241 // MAV_COMP_ID_UART_BRIDGE - Component to bridge to UART (i.e. from UDP).
|
|
268
|
-
| 242 // MAV_COMP_ID_TUNNEL_NODE - Component handling TUNNEL messages (e.g. vendor specific GUI of a component).
|
|
269
|
-
| 243 // MAV_COMP_ID_ILLUMINATOR - Illuminator
|
|
270
|
-
| 250 // MAV_COMP_ID_SYSTEM_CONTROL - Deprecated, don't use. Component for handling system messages (e.g. to ARM, takeoff, etc.).
|
|
271
|
-
| number;
|
|
272
|
-
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export interface BatchProcessorOptions {
|
|
2
|
-
outputDir: string;
|
|
3
|
-
dialectFormat: 'single' | 'separate';
|
|
4
|
-
includeEnums: boolean;
|
|
5
|
-
includeTypeGuards: boolean;
|
|
6
|
-
}
|
|
7
|
-
export declare class BatchProcessor {
|
|
8
|
-
private generator;
|
|
9
|
-
private static readonly MAVLINK_DIALECTS_URL;
|
|
10
|
-
private static readonly MAVLINK_RAW_BASE_URL;
|
|
11
|
-
constructor();
|
|
12
|
-
processAllDialects(options: BatchProcessorOptions): Promise<void>;
|
|
13
|
-
processSpecificDialects(dialectNames: string[], options: BatchProcessorOptions): Promise<void>;
|
|
14
|
-
private generateMainIndex;
|
|
15
|
-
generatePackageJson(outputDir: string, version?: string): Promise<void>;
|
|
16
|
-
}
|
|
17
|
-
//# sourceMappingURL=batch-processor.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"batch-processor.d.ts","sourceRoot":"","sources":["../../src/generator/batch-processor.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,qBAAqB;IACpC,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,QAAQ,GAAG,UAAU,CAAC;IACrC,YAAY,EAAE,OAAO,CAAC;IACtB,iBAAiB,EAAE,OAAO,CAAC;CAC5B;AAED,qBAAa,cAAc;IACzB,OAAO,CAAC,SAAS,CAAmB;IACpC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,oBAAoB,CAAoF;IAChI,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,oBAAoB,CAAuF;;IAM7H,kBAAkB,CAAC,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC;IAiDjE,uBAAuB,CAAC,YAAY,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC;YAsCtF,iBAAiB;IAczB,mBAAmB,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,GAAE,MAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;CAoDvF"}
|
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.BatchProcessor = void 0;
|
|
7
|
-
const fs_1 = require("fs");
|
|
8
|
-
const path_1 = require("path");
|
|
9
|
-
const node_fetch_1 = __importDefault(require("node-fetch"));
|
|
10
|
-
const generator_1 = require("./generator");
|
|
11
|
-
class BatchProcessor {
|
|
12
|
-
constructor() {
|
|
13
|
-
this.generator = new generator_1.MAVLinkGenerator();
|
|
14
|
-
}
|
|
15
|
-
async processAllDialects(options) {
|
|
16
|
-
console.log('Fetching list of available dialects...');
|
|
17
|
-
// Get list of XML files from GitHub API
|
|
18
|
-
const response = await (0, node_fetch_1.default)(BatchProcessor.MAVLINK_DIALECTS_URL);
|
|
19
|
-
if (!response.ok) {
|
|
20
|
-
throw new Error(`Failed to fetch dialects list: ${response.statusText}`);
|
|
21
|
-
}
|
|
22
|
-
const files = await response.json();
|
|
23
|
-
const xmlFiles = files.filter(file => file.name.endsWith('.xml'));
|
|
24
|
-
console.log(`Found ${xmlFiles.length} dialect files to process`);
|
|
25
|
-
// Create main output directory
|
|
26
|
-
await fs_1.promises.mkdir(options.outputDir, { recursive: true });
|
|
27
|
-
// Process each dialect
|
|
28
|
-
const processedDialects = [];
|
|
29
|
-
for (const file of xmlFiles) {
|
|
30
|
-
const dialectName = file.name.replace('.xml', '').toLowerCase().replace('_', '');
|
|
31
|
-
const dialectOutputDir = (0, path_1.join)(options.outputDir, dialectName);
|
|
32
|
-
console.log(`Processing ${file.name}...`);
|
|
33
|
-
try {
|
|
34
|
-
const generationOptions = {
|
|
35
|
-
dialectName,
|
|
36
|
-
outputFormat: options.dialectFormat,
|
|
37
|
-
includeEnums: options.includeEnums,
|
|
38
|
-
includeTypeGuards: options.includeTypeGuards
|
|
39
|
-
};
|
|
40
|
-
await this.generator.generateFromURL(file.download_url, dialectOutputDir, generationOptions);
|
|
41
|
-
processedDialects.push(dialectName);
|
|
42
|
-
// Reset parser state for next dialect
|
|
43
|
-
this.generator.reset();
|
|
44
|
-
}
|
|
45
|
-
catch (error) {
|
|
46
|
-
console.error(`Failed to process ${file.name}:`, error);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
// Generate main index file
|
|
50
|
-
await this.generateMainIndex(options.outputDir, processedDialects);
|
|
51
|
-
console.log(`Successfully processed ${processedDialects.length} dialects`);
|
|
52
|
-
}
|
|
53
|
-
async processSpecificDialects(dialectNames, options) {
|
|
54
|
-
console.log(`Processing ${dialectNames.length} specific dialects...`);
|
|
55
|
-
// Create main output directory
|
|
56
|
-
await fs_1.promises.mkdir(options.outputDir, { recursive: true });
|
|
57
|
-
const processedDialects = [];
|
|
58
|
-
for (const dialectName of dialectNames) {
|
|
59
|
-
const xmlFileName = `${dialectName}.xml`;
|
|
60
|
-
const dialectUrl = `${BatchProcessor.MAVLINK_RAW_BASE_URL}/${xmlFileName}`;
|
|
61
|
-
const dialectOutputDir = (0, path_1.join)(options.outputDir, dialectName.toLowerCase());
|
|
62
|
-
console.log(`Processing ${dialectName}...`);
|
|
63
|
-
try {
|
|
64
|
-
const generationOptions = {
|
|
65
|
-
dialectName: dialectName.toLowerCase(),
|
|
66
|
-
outputFormat: options.dialectFormat,
|
|
67
|
-
includeEnums: options.includeEnums,
|
|
68
|
-
includeTypeGuards: options.includeTypeGuards
|
|
69
|
-
};
|
|
70
|
-
await this.generator.generateFromURL(dialectUrl, dialectOutputDir, generationOptions);
|
|
71
|
-
processedDialects.push(dialectName.toLowerCase());
|
|
72
|
-
// Reset parser state for next dialect
|
|
73
|
-
this.generator.reset();
|
|
74
|
-
}
|
|
75
|
-
catch (error) {
|
|
76
|
-
console.error(`Failed to process ${dialectName}:`, error);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
// Generate main index file
|
|
80
|
-
await this.generateMainIndex(options.outputDir, processedDialects);
|
|
81
|
-
console.log(`Successfully processed ${processedDialects.length} dialects`);
|
|
82
|
-
}
|
|
83
|
-
async generateMainIndex(outputDir, dialectNames) {
|
|
84
|
-
const indexContent = `// Auto-generated TypeScript dialects index
|
|
85
|
-
// Exports all available dialects
|
|
86
|
-
|
|
87
|
-
${dialectNames.map(name => `export * as ${name} from './${name}';`).join('\n')}
|
|
88
|
-
|
|
89
|
-
// Convenience re-exports
|
|
90
|
-
export { MAVLinkMessage, MessageTypeMap, AnyMessage } from './common/types';
|
|
91
|
-
`;
|
|
92
|
-
await fs_1.promises.writeFile((0, path_1.join)(outputDir, 'index.ts'), indexContent);
|
|
93
|
-
console.log(`Generated main index file with ${dialectNames.length} dialects`);
|
|
94
|
-
}
|
|
95
|
-
async generatePackageJson(outputDir, version = '1.0.0') {
|
|
96
|
-
const packageJson = {
|
|
97
|
-
name: 'mavlink-types',
|
|
98
|
-
version,
|
|
99
|
-
description: 'Auto-generated TypeScript types for MAVLink dialects',
|
|
100
|
-
main: 'index.js',
|
|
101
|
-
types: 'index.d.ts',
|
|
102
|
-
files: ['**/*.ts', '**/*.js', '**/*.d.ts'],
|
|
103
|
-
keywords: ['mavlink', 'typescript', 'types', 'drone', 'autopilot'],
|
|
104
|
-
license: 'MIT',
|
|
105
|
-
repository: {
|
|
106
|
-
type: 'git',
|
|
107
|
-
url: 'https://github.com/mavlink/mavlink'
|
|
108
|
-
},
|
|
109
|
-
scripts: {
|
|
110
|
-
build: 'tsc',
|
|
111
|
-
prepublishOnly: 'npm run build'
|
|
112
|
-
},
|
|
113
|
-
devDependencies: {
|
|
114
|
-
typescript: '^5.0.0'
|
|
115
|
-
}
|
|
116
|
-
};
|
|
117
|
-
await fs_1.promises.writeFile((0, path_1.join)(outputDir, 'package.json'), JSON.stringify(packageJson, null, 2));
|
|
118
|
-
// Also generate a basic tsconfig.json
|
|
119
|
-
const tsConfig = {
|
|
120
|
-
compilerOptions: {
|
|
121
|
-
target: 'ES2020',
|
|
122
|
-
module: 'commonjs',
|
|
123
|
-
declaration: true,
|
|
124
|
-
outDir: './dist',
|
|
125
|
-
rootDir: './',
|
|
126
|
-
strict: true,
|
|
127
|
-
esModuleInterop: true,
|
|
128
|
-
skipLibCheck: true,
|
|
129
|
-
forceConsistentCasingInFileNames: true
|
|
130
|
-
},
|
|
131
|
-
include: ['**/*.ts'],
|
|
132
|
-
exclude: ['node_modules', 'dist']
|
|
133
|
-
};
|
|
134
|
-
await fs_1.promises.writeFile((0, path_1.join)(outputDir, 'tsconfig.json'), JSON.stringify(tsConfig, null, 2));
|
|
135
|
-
console.log('Generated package.json and tsconfig.json');
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
exports.BatchProcessor = BatchProcessor;
|
|
139
|
-
BatchProcessor.MAVLINK_DIALECTS_URL = 'https://api.github.com/repos/mavlink/mavlink/contents/message_definitions/v1.0';
|
|
140
|
-
BatchProcessor.MAVLINK_RAW_BASE_URL = 'https://raw.githubusercontent.com/mavlink/mavlink/master/message_definitions/v1.0';
|
|
141
|
-
//# sourceMappingURL=batch-processor.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"batch-processor.js","sourceRoot":"","sources":["../../src/generator/batch-processor.ts"],"names":[],"mappings":";;;;;;AAAA,2BAAoC;AACpC,+BAA4B;AAC5B,4DAA+B;AAC/B,2CAA+C;AAU/C,MAAa,cAAc;IAKzB;QACE,IAAI,CAAC,SAAS,GAAG,IAAI,4BAAgB,EAAE,CAAC;IAC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AS,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAClC,CAAC;QAEF,OAAO,CAAC,GAAG,CAAC,0CAA0C,CAAC,CAAC;IAC1D,CAAC;;AAjKH,wCAkKC;AAhKyB,mCAAoB,GAAG,gFAAgF,CAAC;AACxG,mCAAoB,GAAG,mFAAmF,CAAC"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { GenerationOptions } from '../types';
|
|
2
|
-
export declare class MAVLinkGenerator {
|
|
3
|
-
private xmlParser;
|
|
4
|
-
private typeConverter;
|
|
5
|
-
private templateEngine;
|
|
6
|
-
constructor();
|
|
7
|
-
generateFromURL(url: string, outputPath: string, options: GenerationOptions): Promise<void>;
|
|
8
|
-
generateFromFile(filePath: string, outputPath: string, options: GenerationOptions): Promise<void>;
|
|
9
|
-
private generate;
|
|
10
|
-
private generateDecoderDefinitions;
|
|
11
|
-
reset(): void;
|
|
12
|
-
}
|
|
13
|
-
export declare function generateTypesFromXML(xmlContent: string, options: GenerationOptions): Promise<{
|
|
14
|
-
[filename: string]: string;
|
|
15
|
-
}>;
|
|
16
|
-
//# sourceMappingURL=generator.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../../src/generator/generator.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,iBAAiB,EAA4C,MAAM,UAAU,CAAC;AAEvF,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,SAAS,CAAY;IAC7B,OAAO,CAAC,aAAa,CAAgB;IACrC,OAAO,CAAC,cAAc,CAAiB;;IAQjC,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;IAK3F,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;YAKzF,QAAQ;IAoCtB,OAAO,CAAC,0BAA0B;IAkDlC,KAAK,IAAI,IAAI;CAGd;AAGD,wBAAsB,oBAAoB,CACxC,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,iBAAiB,GACzB,OAAO,CAAC;IAAE,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,CAAC,CAsCzC"}
|
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MAVLinkGenerator = void 0;
|
|
4
|
-
exports.generateTypesFromXML = generateTypesFromXML;
|
|
5
|
-
const fs_1 = require("fs");
|
|
6
|
-
const path_1 = require("path");
|
|
7
|
-
const xml2js_1 = require("xml2js");
|
|
8
|
-
const xml_parser_1 = require("./xml-parser");
|
|
9
|
-
const type_converter_1 = require("./type-converter");
|
|
10
|
-
const template_engine_1 = require("./template-engine");
|
|
11
|
-
class MAVLinkGenerator {
|
|
12
|
-
constructor() {
|
|
13
|
-
this.xmlParser = new xml_parser_1.XMLParser();
|
|
14
|
-
this.typeConverter = new type_converter_1.TypeConverter();
|
|
15
|
-
this.templateEngine = new template_engine_1.TemplateEngine();
|
|
16
|
-
}
|
|
17
|
-
async generateFromURL(url, outputPath, options) {
|
|
18
|
-
const definition = await this.xmlParser.parseFromURL(url);
|
|
19
|
-
await this.generate(definition, outputPath, options);
|
|
20
|
-
}
|
|
21
|
-
async generateFromFile(filePath, outputPath, options) {
|
|
22
|
-
const definition = await this.xmlParser.parseFromFile(filePath);
|
|
23
|
-
await this.generate(definition, outputPath, options);
|
|
24
|
-
}
|
|
25
|
-
async generate(definition, outputPath, options) {
|
|
26
|
-
// Convert to TypeScript types
|
|
27
|
-
const tsDialect = this.typeConverter.convert(definition, options.dialectName);
|
|
28
|
-
// Ensure output directory exists
|
|
29
|
-
await fs_1.promises.mkdir(outputPath, { recursive: true });
|
|
30
|
-
if (options.outputFormat === 'single') {
|
|
31
|
-
// Generate single file
|
|
32
|
-
const content = this.templateEngine.generateSingle(tsDialect);
|
|
33
|
-
await fs_1.promises.writeFile((0, path_1.join)(outputPath, 'index.ts'), content);
|
|
34
|
-
}
|
|
35
|
-
else {
|
|
36
|
-
// Generate separate files as .d.ts files
|
|
37
|
-
const typesContent = this.templateEngine.generateTypes(tsDialect);
|
|
38
|
-
await fs_1.promises.writeFile((0, path_1.join)(outputPath, 'types.d.ts'), typesContent);
|
|
39
|
-
if (options.includeEnums) {
|
|
40
|
-
const enumsContent = this.templateEngine.generateEnums(tsDialect);
|
|
41
|
-
await fs_1.promises.writeFile((0, path_1.join)(outputPath, 'enums.d.ts'), enumsContent);
|
|
42
|
-
}
|
|
43
|
-
const messagesContent = this.templateEngine.generateMessages(tsDialect);
|
|
44
|
-
await fs_1.promises.writeFile((0, path_1.join)(outputPath, 'messages.d.ts'), messagesContent);
|
|
45
|
-
const indexContent = this.templateEngine.generateIndex(tsDialect, options.includeEnums);
|
|
46
|
-
await fs_1.promises.writeFile((0, path_1.join)(outputPath, 'index.d.ts'), indexContent);
|
|
47
|
-
}
|
|
48
|
-
// Generate decoder definitions in the same dialect directory
|
|
49
|
-
const decoderContent = this.generateDecoderDefinitions(definition, options.dialectName);
|
|
50
|
-
const decoderPath = (0, path_1.join)(outputPath, 'decoder.js');
|
|
51
|
-
await fs_1.promises.writeFile(decoderPath, decoderContent);
|
|
52
|
-
console.log(`Generated TypeScript types for ${options.dialectName} in ${outputPath}`);
|
|
53
|
-
}
|
|
54
|
-
generateDecoderDefinitions(definition, dialectName) {
|
|
55
|
-
let code = `// Auto-generated decoder definitions for ${dialectName} dialect\n`;
|
|
56
|
-
code += `// Generated from MAVLink XML definitions\n\n`;
|
|
57
|
-
const dialectNameUpper = dialectName.toUpperCase();
|
|
58
|
-
const exportName = `${dialectNameUpper}_MESSAGE_DEFINITIONS`;
|
|
59
|
-
code += `const ${exportName} = [\n`;
|
|
60
|
-
for (const message of definition.messages || []) {
|
|
61
|
-
code += ` {\n`;
|
|
62
|
-
code += ` id: ${message.id},\n`;
|
|
63
|
-
code += ` name: '${message.name}',\n`;
|
|
64
|
-
code += ` fields: [\n`;
|
|
65
|
-
for (const field of message.fields || []) {
|
|
66
|
-
let fieldType = field.type;
|
|
67
|
-
let arrayLength;
|
|
68
|
-
// Handle array types like uint8_t[4]
|
|
69
|
-
const arrayMatch = fieldType.match(/^([^[]+)\[(\d+)\]$/);
|
|
70
|
-
if (arrayMatch) {
|
|
71
|
-
fieldType = arrayMatch[1];
|
|
72
|
-
arrayLength = parseInt(arrayMatch[2]);
|
|
73
|
-
}
|
|
74
|
-
code += ` {\n`;
|
|
75
|
-
code += ` name: '${field.name}',\n`;
|
|
76
|
-
code += ` type: '${fieldType}',\n`;
|
|
77
|
-
if (arrayLength) {
|
|
78
|
-
code += ` arrayLength: ${arrayLength},\n`;
|
|
79
|
-
}
|
|
80
|
-
if (field.extension) {
|
|
81
|
-
code += ` extension: ${field.extension},\n`;
|
|
82
|
-
}
|
|
83
|
-
code += ` },\n`;
|
|
84
|
-
}
|
|
85
|
-
code += ` ]\n`;
|
|
86
|
-
code += ` },\n`;
|
|
87
|
-
}
|
|
88
|
-
code += `];\n\n`;
|
|
89
|
-
code += `module.exports = {\n`;
|
|
90
|
-
code += ` ${exportName}\n`;
|
|
91
|
-
code += `};\n`;
|
|
92
|
-
return code;
|
|
93
|
-
}
|
|
94
|
-
reset() {
|
|
95
|
-
this.xmlParser.reset();
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
exports.MAVLinkGenerator = MAVLinkGenerator;
|
|
99
|
-
// Standalone function for programmatic usage
|
|
100
|
-
async function generateTypesFromXML(xmlContent, options) {
|
|
101
|
-
const converter = new type_converter_1.TypeConverter();
|
|
102
|
-
const templateEngine = new template_engine_1.TemplateEngine();
|
|
103
|
-
// Parse XML directly from string
|
|
104
|
-
const definition = await new Promise((resolve, reject) => {
|
|
105
|
-
(0, xml2js_1.parseString)(xmlContent, { explicitArray: false }, (err, result) => {
|
|
106
|
-
if (err)
|
|
107
|
-
reject(err);
|
|
108
|
-
else
|
|
109
|
-
resolve(result.mavlink);
|
|
110
|
-
});
|
|
111
|
-
});
|
|
112
|
-
// Convert parsed XML to definition format for compatibility
|
|
113
|
-
const definitionForConverter = {
|
|
114
|
-
version: definition.version,
|
|
115
|
-
dialect: definition.dialect ? parseInt(definition.dialect) : undefined,
|
|
116
|
-
includes: [],
|
|
117
|
-
enums: [],
|
|
118
|
-
messages: []
|
|
119
|
-
};
|
|
120
|
-
// Convert to TypeScript
|
|
121
|
-
const tsDialect = converter.convert(definitionForConverter, options.dialectName);
|
|
122
|
-
const files = {};
|
|
123
|
-
if (options.outputFormat === 'single') {
|
|
124
|
-
files['index.ts'] = templateEngine.generateSingle(tsDialect);
|
|
125
|
-
}
|
|
126
|
-
else {
|
|
127
|
-
files['types.ts'] = templateEngine.generateTypes(tsDialect);
|
|
128
|
-
if (options.includeEnums) {
|
|
129
|
-
files['enums.ts'] = templateEngine.generateEnums(tsDialect);
|
|
130
|
-
}
|
|
131
|
-
files['messages.ts'] = templateEngine.generateMessages(tsDialect);
|
|
132
|
-
files['index.ts'] = templateEngine.generateIndex(tsDialect, options.includeEnums);
|
|
133
|
-
}
|
|
134
|
-
return files;
|
|
135
|
-
}
|
|
136
|
-
//# sourceMappingURL=generator.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../src/generator/generator.ts"],"names":[],"mappings":";;;AAyHA,oDAyCC;AAlKD,2BAAoC;AACpC,+BAA4B;AAC5B,mCAAqC;AACrC,6CAAyC;AACzC,qDAAiD;AACjD,uDAAmD;AAGnD,MAAa,gBAAgB;IAK3B;QACE,IAAI,CAAC,SAAS,GAAG,IAAI,sBAAS,EAAE,CAAC;QACjC,IAAI,CAAC,aAAa,GAAG,IAAI,8BAAa,EAAE,CAAC;QACzC,IAAI,CAAC,cAAc,GAAG,IAAI,gCAAc,EAAE,CA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