Razvoj programa devconf
Definirane funkcije
Datoteka main.cpp
Functions
-
QString takeArg(QList<QString> &arglist, const QString &defaultValue = "")
Take the first argument from a list of arguments, then pop it.
- Parameters
arglist – The list of arguments.
defaultValue – Fallback value in case
arglistis empty.
- Returns
The first argument from
arglist.
-
QString templateDir()
Obtain template directory. Uses the environment variable
DEVCONF_TEMPLATE_DIRif set, otherwise use a default system path.
-
bool copyTemplate(const QString &targetDir)
Generate template JSON files in the specified directory.
This function is to be called when the
--templateoption is specified in the command line.- Parameters
targetDir – The target directory
- Returns
Whether the operation was successful.
-
void generateOutputFiles(const QString &inputDir, const QString &outputDir)
-
int initMbedWorkspace(const QString &outputDir)
-
int main(int argc, char *argv[])
Datoteka file.h
Definira operacije sa datotekama koje se koriste u projektu. To su uglavnom funkcije koje na osnovu templejt datoteke i podataka učitanih iz JSON datoteka generišu izlazne fajlove koji će se smjestiti u MBED workspace.
Functions
-
bool copyFile(const QString &source, const QString &dest)
Copy the file
sourceinto the filedestination, thereby creating the necessary output directory structure if necessary.
-
void substituteInFile(const QString &source, const QString &dest, const QMap<QString, QString> &substitutions)
Copy
sourcefile todestfile withsubstitutionsapplied.- Parameters
substitutions – The keys are names of the substitution variables and the values are the strings with which to substitute them. Substitution variables must start with a ‘$’ in the
sourcefile.
-
void writeDeviceHeader(const Device &device, const QString &in, const QString &out)
Populate the template from file
inwith the data fromdeviceand write the result to the fileout.Example:
Device device = jsonParseDevice("factory_device.json"); write(device, "iot_device.h.in", "iot_device.h");
Note
inandoutare file paths.
-
void writeDeviceImpl(const Device &device, const QString &out)
-
void writeMessageHandlers(const QString &in, const QString &out, const Device &device)
-
void writeMqttWrapperImpl(const QString &in, const QString &out, const Device &device)
-
namespace Devlib
Datoteka generator.h
Sadrži funkcije za generisanje C++ koda na osnovu podataka učitanih iz JSON datoteka.
C++ code generator
Functions
-
QString enumDefinition(const ValueSpec &spec)
-
QString functionDeclaration(const SingleFunction &fun)
-
QString functionDefinition(const SingleFunction &fun)
-
QString dataDeclaration(const Data &data)
-
QString dataDefinition(const Data &data)
-
QString messageHandlerDeclaration(const SingleFunction &fun)
-
QString messageHandlerDeclaration(const Data &data)
-
QString messageHandlerDefinition(const SingleFunction &fun)
-
QString messageHandlerDefinition(const Data &data)
-
QString mqttAutoSubscribeImpl(const QStringList &names)
-
void writeEnums(QTextStream &stream, QList<ValueSpec> enums)
-
void writeFunctionDeclarations(QTextStream &stream, QList<const SingleFunction*> functions)
-
void writeDataDeclarations(QTextStream &stream, QList<const Data*> functions)
-
void writeMessageHandlers(QTextStream &stream, QList<const SingleFunction*> functions)
-
void writeMessageHandlers(QTextStream &stream, QList<const Data*> data)
-
QString indented(QString str)