Classes | |
| struct | Port |
| struct | Function |
| struct | ParamWrite |
Functions | |
| bool | isFunctionParam (const QVariantList &enumValues) |
| true: the enum values are a PX4 serial port selection, which makes the parameter a port function | |
| QString | baudParamName (int portId) |
| Baud rate parameter for a port, empty if the port has none (Ethernet, unknown ports). | |
| QString | functionLabel (const QString ¶mName, const QString &shortDescription) |
| Display label from a PX4 "Serial Configuration for <label>" short description. | |
| Function | makeFunction (const QString ¶mName, const QString &shortDescription, const QVariantList &enumValues, const QStringList &enumStrings, int value) |
| value is the function parameter's value. currentPortId is defaultPortId when it is Disabled. | |
| QList< Port > | ports (const QList< Function > &functions) |
| Every port any function can run on, in port id order. | |
| QStringList | functionsOnPort (const QList< Function > &functions, int portId) |
| QList< Function > | functionsForPort (const QList< Function > &functions, int portId) |
| QList< ParamWrite > | assignPort (const QList< Function > &functions, int portId, const QString &functionParamName) |
| QList< ParamWrite > | removeFromPort (const QList< Function > &functions, int portId, const QString &functionParamName) |
| Writes which take functionParamName off portId. Empty if it isn't on the port, or the port is its default port. | |
| bool | isSharedPort (int portId) |
| QStringList | optionParamNames (const QString &functionParamName, int portId) |
| Extra settings shown for a function when it runs on portId. | |
Variables | |
| constexpr int | kDisabledPortId = 0 |
| constexpr int | kEthernetPortId = 1000 |
PX4 assigns serial ports per function: each function has a parameter (MAV_0_CONFIG, GPS_1_CONFIG, ...) whose value is the port it runs on. These helpers invert that into a per-port view, working only from parameter metadata and values so they can be tested without a vehicle.
| QList< ParamWrite > PX4SerialPortConfig::assignPort | ( | const QList< Function > & | functions, |
| int | portId, | ||
| const QString & | functionParamName ) |
Writes which put functionParamName on portId. On a port which isn't shared it becomes the only function there, and an empty functionParamName clears the port. A function is never cleared from its default port, since Disabled would leave it running there. Empty if nothing changes or the function can't run on the port.
Definition at line 183 of file PX4SerialPortConfig.cc.
References isSharedPort(), and kDisabledPortId.
Referenced by PX4SerialPortsController::setPortFunction(), and PX4SerialPortsController::setPortFunctionEnabled().
| QString PX4SerialPortConfig::baudParamName | ( | int | portId | ) |
Baud rate parameter for a port, empty if the port has none (Ethernet, unknown ports).
Definition at line 89 of file PX4SerialPortConfig.cc.
| QString PX4SerialPortConfig::functionLabel | ( | const QString & | paramName, |
| const QString & | shortDescription ) |
Display label from a PX4 "Serial Configuration for <label>" short description.
Definition at line 95 of file PX4SerialPortConfig.cc.
Referenced by makeFunction().
| QList< Function > PX4SerialPortConfig::functionsForPort | ( | const QList< Function > & | functions, |
| int | portId ) |
The functions allowed on a port, with the port's usual functions (GPS on a GPS port, MAVLink on a TELEM port, ...) first. Order is otherwise kept.
Definition at line 163 of file PX4SerialPortConfig.cc.
Referenced by PX4SerialPortsController::PX4SerialPortsController().
| QStringList PX4SerialPortConfig::functionsOnPort | ( | const QList< Function > & | functions, |
| int | portId ) |
Parameter names of the functions assigned to a port. More than one on a port which isn't shared is a conflict: PX4 starts only one of them.
Definition at line 147 of file PX4SerialPortConfig.cc.
References kDisabledPortId.
| bool PX4SerialPortConfig::isFunctionParam | ( | const QVariantList & | enumValues | ) |
true: the enum values are a PX4 serial port selection, which makes the parameter a port function
Definition at line 65 of file PX4SerialPortConfig.cc.
References kDisabledPortId, and kEthernetPortId.
Referenced by PX4SerialPortsComponent::functionFacts().
| bool PX4SerialPortConfig::isSharedPort | ( | int | portId | ) |
true: several functions can run on the port at once. Only Ethernet: PX4 stops a second function from opening a serial port, but network functions each use their own UDP port.
Definition at line 220 of file PX4SerialPortConfig.cc.
References kEthernetPortId.
Referenced by assignPort().
| Function PX4SerialPortConfig::makeFunction | ( | const QString & | paramName, |
| const QString & | shortDescription, | ||
| const QVariantList & | enumValues, | ||
| const QStringList & | enumStrings, | ||
| int | value ) |
value is the function parameter's value. currentPortId is defaultPortId when it is Disabled.
Definition at line 105 of file PX4SerialPortConfig.cc.
References PX4SerialPortConfig::Function::currentPortId, PX4SerialPortConfig::Function::defaultPortId, functionLabel(), kDisabledPortId, and PX4SerialPortConfig::Function::ports.
Referenced by PX4SerialPortsComponent::summaryItems().
| QStringList PX4SerialPortConfig::optionParamNames | ( | const QString & | functionParamName, |
| int | portId ) |
Extra settings shown for a function when it runs on portId.
Definition at line 225 of file PX4SerialPortConfig.cc.
References kDisabledPortId, and kEthernetPortId.
Every port any function can run on, in port id order.
Definition at line 129 of file PX4SerialPortConfig.cc.
Referenced by PX4SerialPortsController::PX4SerialPortsController(), and PX4SerialPortsComponent::summaryItems().
| QList< ParamWrite > PX4SerialPortConfig::removeFromPort | ( | const QList< Function > & | functions, |
| int | portId, | ||
| const QString & | functionParamName ) |
Writes which take functionParamName off portId. Empty if it isn't on the port, or the port is its default port.
Definition at line 210 of file PX4SerialPortConfig.cc.
References PX4SerialPortConfig::Function::currentPortId, PX4SerialPortConfig::Function::defaultPortId, and kDisabledPortId.
Referenced by PX4SerialPortsController::setPortFunctionEnabled().
|
inlineconstexpr |
Definition at line 13 of file PX4SerialPortConfig.h.
Referenced by assignPort(), functionsOnPort(), isFunctionParam(), makeFunction(), optionParamNames(), and removeFromPort().
|
inlineconstexpr |
Definition at line 14 of file PX4SerialPortConfig.h.
Referenced by isFunctionParam(), isSharedPort(), and optionParamNames().