GSON ToolboxA Visual Studio Code Extension for GSON scripting and Debugging
Requirements
Getting StartedBegin creation of a gson script by creating a jsonc file (json with comments). You can use File->New File and type your filename with a jsonc extension: for example, myscript.jsonc. A gson script is a json file, supporting C style comments such as // and /* */. To begin, simply create a json object, then we'll add the gson script json schema that defines everything a gson script can do.
{
"$schema":""
}
A new menu will appear when you save the jsonc file on the upper right hand corner of Visual Studio Code. You can use this to automatically place the gson script schema into your project by clicking "Get Schema" on the menu. This will place the file 'gsonscriptschema.json' under a subfolder named 'schema'. You may now reference this file in your document:
{
"$schema":"./schema/gsonscriptschema.json"
}
Doing this enables the json schema for the Visual Studio Code editor, which will provide autocompletion to make creation of a script easier. Learning ResourcesTo see what is possible and learn to use the gson schema, we recommend using the GSON learning resources:
Using the GSON ToolboxThe extension offers these functions on the drop down menu:
Get SchemaUsing this command, as shown before, will copy the file /schema/gsonscriptschema.json into your working folder. This makes it accessible as a json schema for your script files. Reference it through the property: "$schema":"/schema/gsonscriptschema.json"
Save the json with this property, and Visual Studio Code will provide autocomplete for your script statements written in json. Assemble FileThis command converts your open jsonc file into a gson file. The gson file contains the interpreter instructions to run on your device. If your script contains any errors, the assembler will report the problems to you for correction. The gson file will be written to a subfolder in your project named "out". From there, you may distribute the script to your devices through:
Download to DeviceIf you have your device connected to your PC via serial port, the GSON Toolbox can directly place your assembled script onto the device using this command. It will upload the opened script, then reset the device to cause it to load the new script file. This only works if you have a connected device. After the device resets, you may use the serial port debugging to initiate interactive script debugging in Visual Studio Code. Interactive Script DebuggingThe GSON Toolbox provides interactive debugging capability, so that you can debug scripts running on a device directly from visual studio code.
Serial Port DebuggingIf you have your device connected to your PC via serial port, the GSON Toolbox can debug script execution on the attached device. Make certain to assemble the script first, and use the Download to Device command to put the script onto the device. Initiating the command "Serial Port Debugging" will start interactive debugging with the connected device. Over the Air DebuggingOver the Air Debugging allows you to do interactive debugging of a script running on any device.
After setting up, you can initiate the command "Over the Air Debugging".
Configuration of the GSON ToolboxIn order to integrate with CAST, or to initiate over the air debugging to a device with a Geometris SIM, you'll require an API Key from Geometris.Contact [support](mailto:support@geometris.com) To configure the API key,
If your devices use Geometris SIMs, Click: Gson: Is Native to indicate you use Geometris sims. If your devices do not use Geometris SIMs, you'll need to integrate via the Twilio API.
) You can use this to automatically place the gson script schema into your project by clicking "Get Schema" on the menu. This will place the file 'gsonscriptschema.json' under a subfolder named 'schema'. You may now reference this file in your document:
{
"$schema":"./schema/gsonscriptschema.json"
}
Doing this enables the json schema for the Visual Studio Code editor, which will provide autocompletion to make creation of a script easier. |