Skip to content

Commit 830231e

Browse files
committed
Add createCommandTypesJson - WIP
1 parent c762be8 commit 830231e

File tree

1 file changed

+214
-0
lines changed

1 file changed

+214
-0
lines changed

Firmware/RTK_Everywhere/menuCommands.ino

Lines changed: 214 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4123,3 +4123,217 @@ void printAvailableSettings()
41234123
}
41244124
}
41254125
}
4126+
4127+
void createCommandTypesJson(String &output)
4128+
{
4129+
JsonDocument doc;
4130+
4131+
JsonArray command_types = doc["command types"].to<JsonArray>();
4132+
4133+
// LG290P
4134+
4135+
JsonObject command_types_tLgConst = command_types.add<JsonObject>();
4136+
command_types_tLgConst["name"] = "tLgConst";
4137+
command_types_tLgConst["description"] = "LG290P GNSS constellations";
4138+
command_types_tLgConst["instruction"] = "Enable / disable each GNSS constellation";
4139+
command_types_tLgConst["prefix"] = "constellation_";
4140+
JsonArray command_types_tLgConst_keys = command_types_tLgConst["keys"].to<JsonArray>();
4141+
for (int x = 0; x < MAX_LG290P_CONSTELLATIONS; x++)
4142+
command_types_tLgConst_keys.add(lg290pConstellationNames[x]);
4143+
JsonArray command_types_tLgConst_values = command_types_tLgConst["values"].to<JsonArray>();
4144+
command_types_tLgConst_values.add("0");
4145+
command_types_tLgConst_values.add("1");
4146+
4147+
JsonObject command_types_tLgMRNmea = command_types.add<JsonObject>();
4148+
command_types_tLgMRNmea["name"] = "tLgMRNmea";
4149+
command_types_tLgMRNmea["description"] = "LG290P NMEA message rates";
4150+
command_types_tLgMRNmea["instruction"] = "Enable / disable each NMEA message";
4151+
command_types_tLgMRNmea["prefix"] = "messageRateNMEA_";
4152+
JsonArray command_types_tLgMRNmea_keys = command_types_tLgMRNmea["keys"].to<JsonArray>();
4153+
for (int y = 0; y < MAX_LG290P_NMEA_MSG; y++)
4154+
command_types_tLgMRNmea_keys.add(lgMessagesNMEA[y].msgTextName);
4155+
JsonArray command_types_tLgMRNmea_values = command_types_tLgMRNmea["values"].to<JsonArray>();
4156+
command_types_tLgMRNmea_values.add("0");
4157+
command_types_tLgMRNmea_values.add("1");
4158+
4159+
JsonObject command_types_tLgMRBaRT = command_types.add<JsonObject>();
4160+
command_types_tLgMRBaRT["Name"] = "tLgMRBaRT";
4161+
command_types_tLgMRBaRT["description"] = "LG290P RTCM message rates - Base";
4162+
command_types_tLgMRBaRT["instruction"] = "Set the RTCM message interval in seconds for Base (0 = Off)";
4163+
command_types_tLgMRBaRT["prefix"] = "messageRateRTCMBase_";
4164+
JsonArray command_types_tLgMRBaRT_keys = command_types_tLgMRBaRT["keys"].to<JsonArray>();
4165+
for (int x = 0; x < MAX_LG290P_RTCM_MSG; x++)
4166+
command_types_tLgMRBaRT_keys.add(lgMessagesRTCM[x].msgTextName);
4167+
command_types_tLgMRBaRT["type"] = "integer";
4168+
command_types_tLgMRBaRT["value min"] = 0;
4169+
command_types_tLgMRBaRT["value max"] = 1200;
4170+
4171+
JsonObject command_types_tLgMRRvRT = command_types.add<JsonObject>();
4172+
command_types_tLgMRRvRT["Name"] = "tLgMRRvRT";
4173+
command_types_tLgMRRvRT["description"] = "LG290P RTCM message rates - Rover";
4174+
command_types_tLgMRRvRT["instruction"] = "Set the RTCM message interval in seconds for Rover (0 = Off)";
4175+
command_types_tLgMRRvRT["prefix"] = "messageRateRTCMRover_";
4176+
JsonArray command_types_tLgMRRvRT_keys = command_types_tLgMRRvRT["keys"].to<JsonArray>();
4177+
for (int x = 0; x < MAX_LG290P_RTCM_MSG; x++)
4178+
command_types_tLgMRRvRT_keys.add(lgMessagesRTCM[x].msgTextName);
4179+
command_types_tLgMRRvRT["type"] = "integer";
4180+
command_types_tLgMRRvRT["value min"] = 0;
4181+
command_types_tLgMRRvRT["value max"] = 1200;
4182+
4183+
JsonObject command_types_tLgMRPqtm = command_types.add<JsonObject>();
4184+
command_types_tLgMRPqtm["Name"] = "tLgMRPqtm";
4185+
command_types_tLgMRPqtm["description"] = "LG290P PQTM message rates";
4186+
command_types_tLgMRPqtm["instruction"] = "Enable / disable each PQTM message";
4187+
command_types_tLgMRPqtm["prefix"] = "messageRatePQTM_";
4188+
JsonArray command_types_tLgMRPqtm_keys = command_types_tLgMRPqtm["keys"].to<JsonArray>();
4189+
for (int x = 0; x < MAX_LG290P_PQTM_MSG; x++)
4190+
command_types_tLgMRPqtm_keys.add(lgMessagesPQTM[x].msgTextName);
4191+
JsonArray command_types_tLgMRPqtm_values = command_types_tLgMRPqtm["values"].to<JsonArray>();
4192+
command_types_tLgMRPqtm_values.add("0");
4193+
command_types_tLgMRPqtm_values.add("1");
4194+
4195+
// mosaic-X5
4196+
4197+
JsonObject command_types_tMosaicConst = command_types.add<JsonObject>();
4198+
command_types_tMosaicConst["name"] = "tMosaicConst";
4199+
command_types_tMosaicConst["description"] = "mosaic-X5 GNSS constellations";
4200+
command_types_tMosaicConst["instruction"] = "Enable / disable each GNSS constellation";
4201+
command_types_tMosaicConst["prefix"] = "constellation_";
4202+
JsonArray command_types_tMosaicConst_keys = command_types_tMosaicConst["keys"].to<JsonArray>();
4203+
for (int x = 0; x < MAX_MOSAIC_CONSTELLATIONS; x++)
4204+
command_types_tMosaicConst_keys.add(mosaicSignalConstellations[x].configName);
4205+
JsonArray command_types_tMosaicConst_values = command_types_tMosaicConst["values"].to<JsonArray>();
4206+
command_types_tMosaicConst_values.add("0");
4207+
command_types_tMosaicConst_values.add("1");
4208+
4209+
JsonObject command_types_tMosaicMSNmea = command_types.add<JsonObject>();
4210+
command_types_tMosaicMSNmea["name"] = "tMosaicMSNmea";
4211+
command_types_tMosaicMSNmea["description"] = "mosaic-X5 message stream for NMEA";
4212+
command_types_tMosaicMSNmea["instruction"] = "Select the message stream for each NMEA message (0 = Off)";
4213+
command_types_tMosaicMSNmea["prefix"] = "messageStreamNMEA_";
4214+
JsonArray command_types_tMosaicMSNmea_keys = command_types_tMosaicMSNmea["keys"].to<JsonArray>();
4215+
for (int x = 0; x < MAX_MOSAIC_NMEA_MSG; x++)
4216+
command_types_tMosaicMSNmea_keys.add(mosaicMessagesNMEA[x].msgTextName);
4217+
JsonArray command_types_tMosaicMSNmea_values = command_types_tMosaicMSNmea["values"].to<JsonArray>();
4218+
command_types_tMosaicMSNmea_values.add("0");
4219+
command_types_tMosaicMSNmea_values.add("1");
4220+
command_types_tMosaicMSNmea_values.add("2");
4221+
4222+
JsonObject command_types_tMosaicSINmea = command_types.add<JsonObject>();
4223+
command_types_tMosaicSINmea["name"] = "tMosaicSINmea";
4224+
command_types_tMosaicSINmea["description"] = "mosaic-X5 NMEA message intervals";
4225+
command_types_tMosaicSINmea["instruction"] = "Set the interval for each NMEA stream";
4226+
command_types_tMosaicSINmea["prefix"] = "streamIntervalNMEA_";
4227+
JsonArray command_types_tMosaicSINmea_keys = command_types_tMosaicSINmea["keys"].to<JsonArray>();
4228+
command_types_tMosaicSINmea_keys.add("1");
4229+
command_types_tMosaicSINmea_keys.add("2");
4230+
JsonArray command_types_tMosaicSINmea_values = command_types_tMosaicSINmea["values"].to<JsonArray>();
4231+
for (int y = 0; y < MAX_MOSAIC_MSG_RATES; y++)
4232+
command_types_tMosaicSINmea_values.add(mosaicMsgRates[y].humanName);
4233+
4234+
JsonObject command_types_tMosaicMIRvRT = command_types.add<JsonObject>();
4235+
command_types_tMosaicMIRvRT["name"] = "tMosaicMIRvRT";
4236+
command_types_tMosaicMIRvRT["description"] = "mosaic-X5 RTCM message intervals - Rover";
4237+
command_types_tMosaicMIRvRT["instruction"] = "Set the RTCM message interval in seconds for Rover";
4238+
command_types_tMosaicMIRvRT["prefix"] = "messageIntervalRTCMRover_";
4239+
JsonArray command_types_tMosaicMIRvRT_keys = command_types_tMosaicMIRvRT["keys"].to<JsonArray>();
4240+
for (int y = 0; y < MAX_MOSAIC_RTCM_V3_INTERVAL_GROUPS; y++)
4241+
command_types_tMosaicMIRvRT_keys.add(mosaicRTCMv3MsgIntervalGroups[y].name);
4242+
command_types_tMosaicMIRvRT["type"] = "float";
4243+
command_types_tMosaicMIRvRT["value min"] = 0.1;
4244+
command_types_tMosaicMIRvRT["value max"] = 600.0;
4245+
4246+
JsonObject command_types_tMosaicMIBaRT = command_types.add<JsonObject>();
4247+
command_types_tMosaicMIBaRT["name"] = "tMosaicMIBaRT";
4248+
command_types_tMosaicMIBaRT["description"] = "mosaic-X5 RTCM message intervals - Base";
4249+
command_types_tMosaicMIBaRT["instruction"] = "Set the RTCM message interval in seconds for Base";
4250+
command_types_tMosaicMIBaRT["prefix"] = "messageIntervalRTCMBase_";
4251+
JsonArray command_types_tMosaicMIBaRT_keys = command_types_tMosaicMIBaRT["keys"].to<JsonArray>();
4252+
for (int y = 0; y < MAX_MOSAIC_RTCM_V3_INTERVAL_GROUPS; y++)
4253+
command_types_tMosaicMIBaRT_keys.add(mosaicRTCMv3MsgIntervalGroups[y].name);
4254+
command_types_tMosaicMIBaRT["type"] = "float";
4255+
command_types_tMosaicMIBaRT["value min"] = 0.1;
4256+
command_types_tMosaicMIBaRT["value max"] = 600.0;
4257+
4258+
JsonObject command_types_tMosaicMERvRT = command_types.add<JsonObject>();
4259+
command_types_tMosaicMERvRT["name"] = "tMosaicMERvRT";
4260+
command_types_tMosaicMERvRT["description"] = "mosaic-X5 RTCM message enabled - Rover";
4261+
command_types_tMosaicMERvRT["instruction"] = "Enable / disable Rover RTCM messages";
4262+
command_types_tMosaicMERvRT["prefix"] = "messageEnabledRTCMRover_";
4263+
JsonArray command_types_tMosaicMERvRT_keys = command_types_tMosaicMERvRT["keys"].to<JsonArray>();
4264+
for (int y = 0; y < MAX_MOSAIC_RTCM_V3_MSG; y++)
4265+
command_types_tMosaicMERvRT_keys.add(mosaicMessagesRTCMv3[y].name);
4266+
JsonArray command_types_tMosaicMERvRT_values = command_types_tMosaicMERvRT["values"].to<JsonArray>();
4267+
command_types_tMosaicMERvRT_values.add("0");
4268+
command_types_tMosaicMERvRT_values.add("1");
4269+
4270+
JsonObject command_types_tMosaicMEBaRT = command_types.add<JsonObject>();
4271+
command_types_tMosaicMEBaRT["name"] = "tMosaicMEBaRT";
4272+
command_types_tMosaicMEBaRT["description"] = "mosaic-X5 RTCM message enabled - Base";
4273+
command_types_tMosaicMEBaRT["instruction"] = "Enable / disable Base RTCM messages";
4274+
command_types_tMosaicMEBaRT["prefix"] = "messageEnabledRTCMBase_";
4275+
JsonArray command_types_tMosaicMEBaRT_keys = command_types_tMosaicMEBaRT["keys"].to<JsonArray>();
4276+
for (int y = 0; y < MAX_MOSAIC_RTCM_V3_MSG; y++)
4277+
command_types_tMosaicMEBaRT_keys.add(mosaicMessagesRTCMv3[y].name);
4278+
JsonArray command_types_tMosaicMEBaRT_values = command_types_tMosaicMEBaRT["values"].to<JsonArray>();
4279+
command_types_tMosaicMEBaRT_values.add("0");
4280+
command_types_tMosaicMEBaRT_values.add("1");
4281+
4282+
// UM980
4283+
4284+
JsonObject command_types_tUmConst = command_types.add<JsonObject>();
4285+
command_types_tUmConst["name"] = "tUmConst";
4286+
command_types_tUmConst["description"] = "UM980 GNSS constellations";
4287+
command_types_tUmConst["instruction"] = "Enable / disable each GNSS constellation";
4288+
command_types_tUmConst["prefix"] = "constellation_";
4289+
JsonArray command_types_tUmConst_keys = command_types_tUmConst["keys"].to<JsonArray>();
4290+
for (int x = 0; x < MAX_UM980_CONSTELLATIONS; x++)
4291+
command_types_tUmConst_keys.add(um980ConstellationCommands[x].textName);
4292+
JsonArray command_types_tUmConst_values = command_types_tUmConst["values"].to<JsonArray>();
4293+
command_types_tUmConst_values.add("0");
4294+
command_types_tUmConst_values.add("1");
4295+
4296+
JsonObject command_types_tUmMRNmea = command_types.add<JsonObject>();
4297+
command_types_tUmMRNmea["name"] = "tUmMRNmea";
4298+
command_types_tUmMRNmea["description"] = "UM980 NMEA message rates";
4299+
command_types_tUmMRNmea["instruction"] = "Set the NMEA message interval in seconds (0 = Off)";
4300+
command_types_tUmMRNmea["prefix"] = "messageRateNMEA_";
4301+
JsonArray command_types_tUmMRNmea_keys = command_types_tUmMRNmea["keys"].to<JsonArray>();
4302+
for (int y = 0; y < MAX_UM980_NMEA_MSG; y++)
4303+
command_types_tUmMRNmea_keys.add(umMessagesNMEA[y].msgTextName);
4304+
command_types_tUmMRNmea["type"] = "float";
4305+
command_types_tUmMRNmea["value min"] = 0.0;
4306+
command_types_tUmMRNmea["value max"] = 65.0;
4307+
4308+
JsonObject command_types_tUmMRBaRT = command_types.add<JsonObject>();
4309+
command_types_tUmMRBaRT["Name"] = "tUmMRBaRT";
4310+
command_types_tUmMRBaRT["description"] = "UM980 RTCM message rates - Base";
4311+
command_types_tUmMRBaRT["instruction"] = "Set the RTCM message interval in seconds for Base (0 = Off)";
4312+
command_types_tUmMRBaRT["prefix"] = "messageRateRTCMBase_";
4313+
JsonArray command_types_tUmMRBaRT_keys = command_types_tUmMRBaRT["keys"].to<JsonArray>();
4314+
for (int x = 0; x < MAX_UM980_RTCM_MSG; x++)
4315+
command_types_tUmMRBaRT_keys.add(umMessagesRTCM[x].msgTextName);
4316+
command_types_tUmMRBaRT["type"] = "float";
4317+
command_types_tUmMRBaRT["value min"] = 0.0;
4318+
command_types_tUmMRBaRT["value max"] = 65.0;
4319+
4320+
JsonObject command_types_tUmMRRvRT = command_types.add<JsonObject>();
4321+
command_types_tUmMRRvRT["Name"] = "tUmMRRvRT";
4322+
command_types_tUmMRRvRT["description"] = "UM980 RTCM message rates - Rover";
4323+
command_types_tUmMRRvRT["instruction"] = "Set the RTCM message interval in seconds for Rover (0 = Off)";
4324+
command_types_tUmMRRvRT["prefix"] = "messageRateRTCMRover_";
4325+
JsonArray command_types_tUmMRRvRT_keys = command_types_tUmMRRvRT["keys"].to<JsonArray>();
4326+
for (int x = 0; x < MAX_UM980_RTCM_MSG; x++)
4327+
command_types_tUmMRRvRT_keys.add(umMessagesRTCM[x].msgTextName);
4328+
command_types_tUmMRRvRT["type"] = "float";
4329+
command_types_tUmMRRvRT["value min"] = 0.0;
4330+
command_types_tUmMRRvRT["value max"] = 65.0;
4331+
4332+
// JsonArray commands = doc["commands"].to<JsonArray>();
4333+
// commands.add("messageStreamNMEA_GGA,tMosaicMSNmea,1");
4334+
// commands.add("streamIntervalNMEA_2,tMosaicMSNmea,sec1");
4335+
4336+
doc.shrinkToFit(); // optional
4337+
4338+
serializeJsonPretty(doc, output); // TODO - remove the Pretty formatting
4339+
}

0 commit comments

Comments
 (0)