Add returnable python commands

requires modified abstractscreenrenderer
This commit is contained in:
2025-01-08 02:19:22 +01:00
parent bb2894d86c
commit 9b6b941d30
4 changed files with 427 additions and 1 deletions

View File

@@ -375,6 +375,360 @@ commanddescription_sequence Commands_descriptions = {
{ "quitsimulation", command_target::simulation, command_mode::oneoff },
};
// Maps of command and coresponding strings
std::unordered_map<std::string, user_command> commandMap = {
{"aidriverdisable", user_command::aidriverdisable},
{"jointcontrollerset", user_command::jointcontrollerset},
{"mastercontrollerincrease", user_command::mastercontrollerincrease},
{"mastercontrollerincreasefast", user_command::mastercontrollerincreasefast},
{"mastercontrollerdecrease", user_command::mastercontrollerdecrease},
{"mastercontrollerdecreasefast", user_command::mastercontrollerdecreasefast},
{"mastercontrollerset", user_command::mastercontrollerset},
{"secondcontrollerincrease", user_command::secondcontrollerincrease},
{"secondcontrollerincreasefast", user_command::secondcontrollerincreasefast},
{"secondcontrollerdecrease", user_command::secondcontrollerdecrease},
{"secondcontrollerdecreasefast", user_command::secondcontrollerdecreasefast},
{"secondcontrollerset", user_command::secondcontrollerset},
{"mucurrentindicatorothersourceactivate", user_command::mucurrentindicatorothersourceactivate},
{"independentbrakeincrease", user_command::independentbrakeincrease},
{"independentbrakeincreasefast", user_command::independentbrakeincreasefast},
{"independentbrakedecrease", user_command::independentbrakedecrease},
{"independentbrakedecreasefast", user_command::independentbrakedecreasefast},
{"independentbrakeset", user_command::independentbrakeset},
{"independentbrakebailoff", user_command::independentbrakebailoff},
{"universalbrakebutton1", user_command::universalbrakebutton1},
{"universalbrakebutton2", user_command::universalbrakebutton2},
{"universalbrakebutton3", user_command::universalbrakebutton3},
{"trainbrakeincrease", user_command::trainbrakeincrease},
{"trainbrakedecrease", user_command::trainbrakedecrease},
{"trainbrakeset", user_command::trainbrakeset},
{"trainbrakecharging", user_command::trainbrakecharging},
{"trainbrakerelease", user_command::trainbrakerelease},
{"trainbrakefirstservice", user_command::trainbrakefirstservice},
{"trainbrakeservice", user_command::trainbrakeservice},
{"trainbrakefullservice", user_command::trainbrakefullservice},
{"trainbrakehandleoff", user_command::trainbrakehandleoff},
{"trainbrakeemergency", user_command::trainbrakeemergency},
{"trainbrakebasepressureincrease", user_command::trainbrakebasepressureincrease},
{"trainbrakebasepressuredecrease", user_command::trainbrakebasepressuredecrease},
{"trainbrakebasepressurereset", user_command::trainbrakebasepressurereset},
{"trainbrakeoperationtoggle", user_command::trainbrakeoperationtoggle},
{"manualbrakeincrease", user_command::manualbrakeincrease},
{"manualbrakedecrease", user_command::manualbrakedecrease},
{"alarmchaintoggle", user_command::alarmchaintoggle},
{"alarmchainenable", user_command::alarmchainenable},
{"alarmchaindisable", user_command::alarmchaindisable},
{"wheelspinbrakeactivate", user_command::wheelspinbrakeactivate},
{"sandboxactivate", user_command::sandboxactivate},
{"autosandboxtoggle", user_command::autosandboxtoggle},
{"autosandboxactivate", user_command::autosandboxactivate},
{"autosandboxdeactivate", user_command::autosandboxdeactivate},
{"reverserincrease", user_command::reverserincrease},
{"reverserdecrease", user_command::reverserdecrease},
{"reverserforwardhigh", user_command::reverserforwardhigh},
{"reverserforward", user_command::reverserforward},
{"reverserneutral", user_command::reverserneutral},
{"reverserbackward", user_command::reverserbackward},
{"waterpumpbreakertoggle", user_command::waterpumpbreakertoggle},
{"waterpumpbreakerclose", user_command::waterpumpbreakerclose},
{"waterpumpbreakeropen", user_command::waterpumpbreakeropen},
{"waterpumptoggle", user_command::waterpumptoggle},
{"waterpumpenable", user_command::waterpumpenable},
{"waterpumpdisable", user_command::waterpumpdisable},
{"waterheaterbreakertoggle", user_command::waterheaterbreakertoggle},
{"waterheaterbreakerclose", user_command::waterheaterbreakerclose},
{"waterheaterbreakeropen", user_command::waterheaterbreakeropen},
{"waterheatertoggle", user_command::waterheatertoggle},
{"waterheaterenable", user_command::waterheaterenable},
{"waterheaterdisable", user_command::waterheaterdisable},
{"watercircuitslinktoggle", user_command::watercircuitslinktoggle},
{"watercircuitslinkenable", user_command::watercircuitslinkenable},
{"watercircuitslinkdisable", user_command::watercircuitslinkdisable},
{"fuelpumptoggle", user_command::fuelpumptoggle},
{"fuelpumpenable", user_command::fuelpumpenable},
{"fuelpumpdisable", user_command::fuelpumpdisable},
{"oilpumptoggle", user_command::oilpumptoggle},
{"oilpumpenable", user_command::oilpumpenable},
{"oilpumpdisable", user_command::oilpumpdisable},
{"linebreakertoggle", user_command::linebreakertoggle},
{"linebreakeropen", user_command::linebreakeropen},
{"linebreakerclose", user_command::linebreakerclose},
{"convertertoggle", user_command::convertertoggle},
{"converterenable", user_command::converterenable},
{"converterdisable", user_command::converterdisable},
{"convertertogglelocal", user_command::convertertogglelocal},
{"converteroverloadrelayreset", user_command::converteroverloadrelayreset},
{"compressortoggle", user_command::compressortoggle},
{"compressorenable", user_command::compressorenable},
{"compressordisable", user_command::compressordisable},
{"compressortogglelocal", user_command::compressortogglelocal},
{"compressorpresetactivatenext", user_command::compressorpresetactivatenext},
{"compressorpresetactivateprevious", user_command::compressorpresetactivateprevious},
{"compressorpresetactivatedefault", user_command::compressorpresetactivatedefault},
{"motoroverloadrelaythresholdtoggle", user_command::motoroverloadrelaythresholdtoggle},
{"motoroverloadrelaythresholdsetlow", user_command::motoroverloadrelaythresholdsetlow},
{"motoroverloadrelaythresholdsethigh", user_command::motoroverloadrelaythresholdsethigh},
{"motoroverloadrelayreset", user_command::motoroverloadrelayreset},
{"universalrelayreset1", user_command::universalrelayreset1},
{"universalrelayreset2", user_command::universalrelayreset2},
{"universalrelayreset3", user_command::universalrelayreset3},
{"notchingrelaytoggle", user_command::notchingrelaytoggle},
{"epbrakecontroltoggle", user_command::epbrakecontroltoggle},
{"epbrakecontrolenable", user_command::epbrakecontrolenable},
{"epbrakecontroldisable", user_command::epbrakecontroldisable},
{"trainbrakeoperationmodeincrease", user_command::trainbrakeoperationmodeincrease},
{"trainbrakeoperationmodedecrease", user_command::trainbrakeoperationmodedecrease},
{"brakeactingspeedincrease", user_command::brakeactingspeedincrease},
{"brakeactingspeeddecrease", user_command::brakeactingspeeddecrease},
{"brakeactingspeedsetcargo", user_command::brakeactingspeedsetcargo},
{"brakeactingspeedsetpassenger", user_command::brakeactingspeedsetpassenger},
{"brakeactingspeedsetrapid", user_command::brakeactingspeedsetrapid},
{"brakeloadcompensationincrease", user_command::brakeloadcompensationincrease},
{"brakeloadcompensationdecrease", user_command::brakeloadcompensationdecrease},
{"mubrakingindicatortoggle", user_command::mubrakingindicatortoggle},
{"alerteracknowledge", user_command::alerteracknowledge},
{"cabsignalacknowledge", user_command::cabsignalacknowledge},
{"hornlowactivate", user_command::hornlowactivate},
{"hornhighactivate", user_command::hornhighactivate},
{"whistleactivate", user_command::whistleactivate},
{"radiotoggle", user_command::radiotoggle},
{"radioenable", user_command::radioenable},
{"radiodisable", user_command::radiodisable},
{"radiochannelincrease", user_command::radiochannelincrease},
{"radiochanneldecrease", user_command::radiochanneldecrease},
{"radiochannelset", user_command::radiochannelset},
{"radiostopsend", user_command::radiostopsend},
{"radiostopenable", user_command::radiostopenable},
{"radiostopdisable", user_command::radiostopdisable},
{"radiostoptest", user_command::radiostoptest},
{"radiocall3send", user_command::radiocall3send},
{"radiovolumeincrease", user_command::radiovolumeincrease},
{"radiovolumedecrease", user_command::radiovolumedecrease},
{"radiovolumeset", user_command::radiovolumeset},
{"cabchangeforward", user_command::cabchangeforward},
{"cabchangebackward", user_command::cabchangebackward},
{"viewturn", user_command::viewturn},
{"movehorizontal", user_command::movehorizontal},
{"movehorizontalfast", user_command::movehorizontalfast},
{"movevertical", user_command::movevertical},
{"moveverticalfast", user_command::moveverticalfast},
{"moveleft", user_command::moveleft},
{"moveright", user_command::moveright},
{"moveforward", user_command::moveforward},
{"moveback", user_command::moveback},
{"moveup", user_command::moveup},
{"movedown", user_command::movedown},
{"nearestcarcouplingincrease", user_command::nearestcarcouplingincrease},
{"nearestcarcouplingdisconnect", user_command::nearestcarcouplingdisconnect},
{"nearestcarcoupleradapterattach", user_command::nearestcarcoupleradapterattach},
{"nearestcarcoupleradapterremove", user_command::nearestcarcoupleradapterremove},
{"occupiedcarcouplingdisconnect", user_command::occupiedcarcouplingdisconnect},
{"occupiedcarcouplingdisconnectback", user_command::occupiedcarcouplingdisconnectback},
{"doortoggleleft", user_command::doortoggleleft},
{"doortoggleright", user_command::doortoggleright},
{"doorpermitleft", user_command::doorpermitleft},
{"doorpermitright", user_command::doorpermitright},
{"doorpermitpresetactivatenext", user_command::doorpermitpresetactivatenext},
{"doorpermitpresetactivateprevious", user_command::doorpermitpresetactivateprevious},
{"dooropenleft", user_command::dooropenleft},
{"dooropenright", user_command::dooropenright},
{"dooropenall", user_command::dooropenall},
{"doorcloseleft", user_command::doorcloseleft},
{"doorcloseright", user_command::doorcloseright},
{"doorcloseall", user_command::doorcloseall},
{"doorsteptoggle", user_command::doorsteptoggle},
{"doormodetoggle", user_command::doormodetoggle},
{"mirrorstoggle", user_command::mirrorstoggle},
{"departureannounce", user_command::departureannounce},
{"doorlocktoggle", user_command::doorlocktoggle},
{"pantographcompressorvalvetoggle", user_command::pantographcompressorvalvetoggle},
{"pantographcompressorvalveenable", user_command::pantographcompressorvalveenable},
{"pantographcompressorvalvedisable", user_command::pantographcompressorvalvedisable},
{"pantographcompressoractivate", user_command::pantographcompressoractivate},
{"pantographtogglefront", user_command::pantographtogglefront},
{"pantographtogglerear", user_command::pantographtogglerear},
{"pantographraisefront", user_command::pantographraisefront},
{"pantographraiserear", user_command::pantographraiserear},
{"pantographlowerfront", user_command::pantographlowerfront},
{"pantographlowerrear", user_command::pantographlowerrear},
{"pantographlowerall", user_command::pantographlowerall},
{"pantographselectnext", user_command::pantographselectnext},
{"pantographselectprevious", user_command::pantographselectprevious},
{"pantographtoggleselected", user_command::pantographtoggleselected},
{"pantographraiseselected", user_command::pantographraiseselected},
{"pantographlowerselected", user_command::pantographlowerselected},
{"pantographvalvesupdate", user_command::pantographvalvesupdate},
{"pantographvalvesoff", user_command::pantographvalvesoff},
{"heatingtoggle", user_command::heatingtoggle},
{"heatingenable", user_command::heatingenable},
{"heatingdisable", user_command::heatingdisable},
{"lightspresetactivatenext", user_command::lightspresetactivatenext},
{"lightspresetactivateprevious", user_command::lightspresetactivateprevious},
{"headlighttoggleleft", user_command::headlighttoggleleft},
{"headlightenableleft", user_command::headlightenableleft},
{"headlightdisableleft", user_command::headlightdisableleft},
{"headlighttoggleright", user_command::headlighttoggleright},
{"headlightenableright", user_command::headlightenableright},
{"headlightdisableright", user_command::headlightdisableright},
{"headlighttoggleupper", user_command::headlighttoggleupper},
{"headlightenableupper", user_command::headlightenableupper},
{"headlightdisableupper", user_command::headlightdisableupper},
{"redmarkertoggleleft", user_command::redmarkertoggleleft},
{"redmarkerenableleft", user_command::redmarkerenableleft},
{"redmarkerdisableleft", user_command::redmarkerdisableleft},
{"redmarkertoggleright", user_command::redmarkertoggleright},
{"redmarkerenableright", user_command::redmarkerenableright},
{"redmarkerdisableright", user_command::redmarkerdisableright},
{"headlighttogglerearleft", user_command::headlighttogglerearleft},
{"headlightenablerearleft", user_command::headlightenablerearleft},
{"headlightdisablerearleft", user_command::headlightdisablerearleft},
{"headlighttogglerearright", user_command::headlighttogglerearright},
{"headlightenablerearright", user_command::headlightenablerearright},
{"headlightdisablerearright", user_command::headlightdisablerearright},
{"headlighttogglerearupper", user_command::headlighttogglerearupper},
{"headlightenablerearupper", user_command::headlightenablerearupper},
{"headlightdisablerearupper", user_command::headlightdisablerearupper},
{"redmarkertogglerearleft", user_command::redmarkertogglerearleft},
{"redmarkerenablerearleft", user_command::redmarkerenablerearleft},
{"redmarkerdisablerearleft", user_command::redmarkerdisablerearleft},
{"redmarkertogglerearright", user_command::redmarkertogglerearright},
{"redmarkerenablerearright", user_command::redmarkerenablerearright},
{"redmarkerdisablerearright", user_command::redmarkerdisablerearright},
{"redmarkerstoggle", user_command::redmarkerstoggle},
{"endsignalstoggle", user_command::endsignalstoggle},
{"headlightsdimtoggle", user_command::headlightsdimtoggle},
{"headlightsdimenable", user_command::headlightsdimenable},
{"headlightsdimdisable", user_command::headlightsdimdisable},
{"motorconnectorsopen", user_command::motorconnectorsopen},
{"motorconnectorsclose", user_command::motorconnectorsclose},
{"motordisconnect", user_command::motordisconnect},
{"interiorlighttoggle", user_command::interiorlighttoggle},
{"interiorlightenable", user_command::interiorlightenable},
{"interiorlightdisable", user_command::interiorlightdisable},
{"interiorlightdimtoggle", user_command::interiorlightdimtoggle},
{"interiorlightdimenable", user_command::interiorlightdimenable},
{"interiorlightdimdisable", user_command::interiorlightdimdisable},
{"compartmentlightstoggle", user_command::compartmentlightstoggle},
{"compartmentlightsenable", user_command::compartmentlightsenable},
{"compartmentlightsdisable", user_command::compartmentlightsdisable},
{"instrumentlighttoggle", user_command::instrumentlighttoggle},
{"instrumentlightenable", user_command::instrumentlightenable},
{"instrumentlightdisable", user_command::instrumentlightdisable},
{"dashboardlighttoggle", user_command::dashboardlighttoggle},
{"dashboardlightenable", user_command::dashboardlightenable},
{"dashboardlightdisable", user_command::dashboardlightdisable},
{"timetablelighttoggle", user_command::timetablelighttoggle},
{"timetablelightenable", user_command::timetablelightenable},
{"timetablelightdisable", user_command::timetablelightdisable},
{"generictoggle0", user_command::generictoggle0},
{"generictoggle1", user_command::generictoggle1},
{"generictoggle2", user_command::generictoggle2},
{"generictoggle3", user_command::generictoggle3},
{"generictoggle4", user_command::generictoggle4},
{"generictoggle5", user_command::generictoggle5},
{"generictoggle6", user_command::generictoggle6},
{"generictoggle7", user_command::generictoggle7},
{"generictoggle8", user_command::generictoggle8},
{"generictoggle9", user_command::generictoggle9},
{"batterytoggle", user_command::batterytoggle},
{"batteryenable", user_command::batteryenable},
{"batterydisable", user_command::batterydisable},
{"cabactivationtoggle", user_command::cabactivationtoggle},
{"cabactivationenable", user_command::cabactivationenable},
{"cabactivationdisable", user_command::cabactivationdisable},
{"motorblowerstogglefront", user_command::motorblowerstogglefront},
{"motorblowerstogglerear", user_command::motorblowerstogglerear},
{"motorblowersdisableall", user_command::motorblowersdisableall},
{"coolingfanstoggle", user_command::coolingfanstoggle},
{"tempomattoggle", user_command::tempomattoggle},
{"springbraketoggle", user_command::springbraketoggle},
{"springbrakeenable", user_command::springbrakeenable},
{"springbrakedisable", user_command::springbrakedisable},
{"springbrakeshutofftoggle", user_command::springbrakeshutofftoggle},
{"springbrakeshutoffenable", user_command::springbrakeshutoffenable},
{"springbrakeshutoffdisable", user_command::springbrakeshutoffdisable},
{"springbrakerelease", user_command::springbrakerelease},
{"distancecounteractivate", user_command::distancecounteractivate},
{"speedcontrolincrease", user_command::speedcontrolincrease},
{"speedcontroldecrease", user_command::speedcontroldecrease},
{"speedcontrolpowerincrease", user_command::speedcontrolpowerincrease},
{"speedcontrolpowerdecrease", user_command::speedcontrolpowerdecrease},
{"speedcontrolbutton0", user_command::speedcontrolbutton0},
{"speedcontrolbutton1", user_command::speedcontrolbutton1},
{"speedcontrolbutton2", user_command::speedcontrolbutton2},
{"speedcontrolbutton3", user_command::speedcontrolbutton3},
{"speedcontrolbutton4", user_command::speedcontrolbutton4},
{"speedcontrolbutton5", user_command::speedcontrolbutton5},
{"speedcontrolbutton6", user_command::speedcontrolbutton6},
{"speedcontrolbutton7", user_command::speedcontrolbutton7},
{"speedcontrolbutton8", user_command::speedcontrolbutton8},
{"speedcontrolbutton9", user_command::speedcontrolbutton9},
{"inverterenable1", user_command::inverterenable1},
{"inverterenable2", user_command::inverterenable2},
{"inverterenable3", user_command::inverterenable3},
{"inverterenable4", user_command::inverterenable4},
{"inverterenable5", user_command::inverterenable5},
{"inverterenable6", user_command::inverterenable6},
{"inverterenable7", user_command::inverterenable7},
{"inverterenable8", user_command::inverterenable8},
{"inverterenable9", user_command::inverterenable9},
{"inverterenable10", user_command::inverterenable10},
{"inverterenable11", user_command::inverterenable11},
{"inverterenable12", user_command::inverterenable12},
{"inverterdisable1", user_command::inverterdisable1},
{"inverterdisable2", user_command::inverterdisable2},
{"inverterdisable3", user_command::inverterdisable3},
{"inverterdisable4", user_command::inverterdisable4},
{"inverterdisable5", user_command::inverterdisable5},
{"inverterdisable6", user_command::inverterdisable6},
{"inverterdisable7", user_command::inverterdisable7},
{"inverterdisable8", user_command::inverterdisable8},
{"inverterdisable9", user_command::inverterdisable9},
{"inverterdisable10", user_command::inverterdisable10},
{"inverterdisable11", user_command::inverterdisable11},
{"inverterdisable12", user_command::inverterdisable12},
{"invertertoggle1", user_command::invertertoggle1},
{"invertertoggle2", user_command::invertertoggle2},
{"invertertoggle3", user_command::invertertoggle3},
{"invertertoggle4", user_command::invertertoggle4},
{"invertertoggle5", user_command::invertertoggle5},
{"invertertoggle6", user_command::invertertoggle6},
{"invertertoggle7", user_command::invertertoggle7},
{"invertertoggle8", user_command::invertertoggle8},
{"invertertoggle9", user_command::invertertoggle9},
{"invertertoggle10", user_command::invertertoggle10},
{"invertertoggle11", user_command::invertertoggle11},
{"invertertoggle12", user_command::invertertoggle12},
{"globalradiostop", user_command::globalradiostop},
{"timejump", user_command::timejump},
{"timejumplarge", user_command::timejumplarge},
{"timejumpsmall", user_command::timejumpsmall},
{"setdatetime", user_command::setdatetime},
{"setweather", user_command::setweather},
{"settemperature", user_command::settemperature},
{"vehiclemoveforwards", user_command::vehiclemoveforwards},
{"vehiclemovebackwards", user_command::vehiclemovebackwards},
{"vehicleboost", user_command::vehicleboost},
{"debugtoggle", user_command::debugtoggle},
{"focuspauseset", user_command::focuspauseset},
{"pausetoggle", user_command::pausetoggle},
{"entervehicle", user_command::entervehicle},
{"resetconsist", user_command::resetconsist},
{"fillcompressor", user_command::fillcompressor},
{"consistreleaser", user_command::consistreleaser},
{"queueevent", user_command::queueevent},
{"setlight", user_command::setlight},
{"insertmodel", user_command::insertmodel},
{"deletemodel", user_command::deletemodel},
{"dynamicmove", user_command::dynamicmove},
{"consistteleport", user_command::consistteleport},
{"pullalarmchain", user_command::pullalarmchain},
{"sendaicommand", user_command::sendaicommand},
{"spawntrainset", user_command::spawntrainset},
{"destroytrainset", user_command::destroytrainset},
{"quitsimulation", user_command::quitsimulation},
{"none", user_command::none}};
} // simulation
void command_queue::update()