Serial Studio 1.1.6
A dashboard software for your embedded projects
|
#include <Generator.h>
Public Types | |
enum | OperationMode { kManual = 0x00 , kAutomatic = 0x01 } |
Public Slots | |
void | loadJsonMap () |
void | loadJsonMap (const QString &path) |
void | setOperationMode (const JSON::Generator::OperationMode &mode) |
void | readSettings () |
void | writeSettings (const QString &path) |
Signals | |
void | jsonFileMapChanged () |
void | operationModeChanged () |
void | jsonChanged (const QJsonObject &json) |
Public Member Functions | |
QString | jsonMapData () const |
QString | jsonMapFilename () const |
QString | jsonMapFilepath () const |
OperationMode | operationMode () const |
Static Public Member Functions | |
static Generator & | instance () |
Properties | |
QString | jsonMapFilename |
QString | jsonMapFilepath |
OperationMode | operationMode |
Private Slots | |
void | reset () |
void | readData (const QByteArray &data) |
Private Member Functions | |
Generator () | |
Generator (Generator &&)=delete | |
Generator (const Generator &)=delete | |
Generator & | operator= (Generator &&)=delete |
Generator & | operator= (const Generator &)=delete |
Private Attributes | |
QFile | m_jsonMap |
QJsonObject | m_json |
QJSEngine | m_jsEngine |
QSettings | m_settings |
QString | m_jsonMapData |
OperationMode | m_opMode |
QJsonParseError | m_error |
QStringList | m_latestValidValues |
The Generator class.
The JSON generator class receives raw frame data from the I/O manager class and generates a JSON file that represents the project title, the groups that compose the project and the datasets that compose each group.
As described in the documentation of the Frame
class, the process of receiving data and generating the Serial Studio user interface is: 1) Physical device sends data 2) I/O driver receives data 3) I/O manager processes the data and separates the frames 4) JSON generator creates a JSON file with the data contained in each frame. 5) UI dashboard class receives the JSON file. 6) TimerEvents class notifies the UI dashboard that the user interface should be re-generated. 7) UI dashboard feeds JSON data to a Frame
object. 8) The Frame
object creates a model of the JSON data with the values of the latest received frame. 9) UI dashboard updates the widgets with the C++ model provided by this class.
|
explicitprivate |
Initializes the JSON Parser class and connects appropiate SIGNALS/SLOTS
|
privatedelete |
|
privatedelete |
|
static |
Returns the only instance of the class
|
signal |
|
signal |
QString JSON::Generator::jsonMapData | ( | ) | const |
Returns the JSON map data from the loaded file as a string
QString JSON::Generator::jsonMapFilename | ( | ) | const |
Returns the file name (e.g. "JsonMap.json") of the loaded JSON map file
QString JSON::Generator::jsonMapFilepath | ( | ) | const |
Returns the file path of the loaded JSON map file
|
slot |
Creates a file dialog & lets the user select the JSON file map
|
slot |
Opens, validates & loads into memory the JSON file in the given path.
JSON::Generator::OperationMode JSON::Generator::operationMode | ( | ) | const |
Returns the operation mode
|
signal |
|
privateslot |
Tries to parse the given data as a JSON document according to the selected operation mode.
Possible operation modes:
If JSON parsing is successfull, then the class shall notify the rest of the application in order to process packet data.
|
slot |
Loads the last saved JSON map file (if any)
|
privateslot |
Resets all the statistics related to the current device and the JSON map file
|
slot |
Changes the operation mode of the JSON parser. There are two possible op. modes:
kManual
serial data only contains the comma-separated values, and we need to use a JSON map file (given by the user) to know what each value means. This method is recommended when we need to transfer & display a large amount of information from the microcontroller unit to the computer.
kAutomatic
serial data contains the JSON data frame, good for simple applications or for prototyping.
|
slot |
Saves the location of the last valid JSON map file that was opened (if any)
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
read |
|
read |
|
readwrite |