Recipe and WEB.OBJ.GZ ======================= The WEB.OBJ.GZ consolidates all essential files into a single package, while the recipe.json defines the commands and configuration parameters necessary for the setup. After the files are extracted and a recipe.json is detected, the data logger executes the set of instructions in the recipe file. The recipe.json must be valid JSON or the recipe will not execute. It is recommended to use a JSON validator before including the recipe. .. image:: images/flowchart_1.png Example ------- Sanrio ~~~~~~ Deploy a network of CR350 data loggers to monitor environmental conditions. All locations need to have the following: - The same set of files to run. - A standard CR350 operating system. - The same initial settings set. - A self-hosted web interface for maintenance staff to connect to the local system without needing software like Device Configuration Utility or LoggerNet installed on their computers or tablets. - A simple, scalable method for deploying CR350 updates. File Structure ~~~~~~~~~~~~~~ - Main_Program.CRB : The main program that always runs on power-up. - A.CRB : Include file for device A. - B.CRB : Include file for device B. - recipe.json : Operational setup procedure. - CR350.Beta.01.06.19.obj : The specified CR350 OS the application should run. - WebPageFiles : A directory that contains the web interface files for user interaction. .. image:: images/objgz_ex1.png **Recipe.json** The recipe will execute the commands from top to bottom as specified. In this example the execution order matters so an order of operations explanation is provided along with the example recipe.json Order of operation ~~~~~~~~~~~~~~~~~~ 1. Load File CPU:CR350.Beta.01.06.19.obj - When an .obj is extracted from a web.obj.gz the obj does not get put on the internal csi: drive. The data logger OS extracts .obj files to the cpu: automatically. 2. Format Drive cpu: - Format the cpu: must follow the load os command otherwise the format process would delete the .obj before it is applied. 3. Move File (A.CRB) to cpu: 4. Move File (B.CRB) to cpu: 5. Move File (Main_Program.CRB) to cpu: 6. Set Station Settings 7. Run Main_Program.CRB - The main program is set to run after it is moved from the csi: drive to the cpu: 8. Delete File csi:recipe.json - Delete the recipe.json file as it is not required. Leaving it on the drive will not affect operations but will occupy unnecessary space. Example recipe.json ~~~~~~~~~~~~~~~~~~~ .. code-block:: json { "name": "Test Recipe", "version": "00", "operations": [ { "name": "file", "data": { "action": "load", "path": "CPU:CR350.Beta.01.06.19.obj" } }, { "name": "file", "data": { "action": "format", "drive": "cpu:" } }, { "name": "file", "data": { "action": "move", "source": "csi:A.CRB", "destination": "cpu:A.CRB" } }, { "name": "file", "data": { "action": "move", "source": "csi:B.CRB", "destination": "cpu:B.CRB" } }, { "name": "file", "data": { "action": "move", "source": "csi:Main_Program.CRB", "destination": "cpu:Main_Program.CRB" } }, { "name": "setting", "data": { "StationName": "Vecna", "PakBusEncryptionKey": "", "BaudrateRS232": "9600", "PingEnabled": "True" } }, { "name": "file", "data": { "action": "run", "path": "cpu:Main_Program.CRB", "runOnPowerUp": "true", "deleteDataTables": "true" } }, { "name": "file", "data": { "action": "delete", "path": "csi:recipe.json" } } ] } WEB.OBJ.GZ Build ---------------- - Open command prompt in the directory and run the tar command .. image:: images/objgz_ex2.png :alt: tar command - After the command runs the output file should be in the directory .. image:: images/objgz_ex3.png :alt: tar result Tar Command to Build WEB.OBJ.GZ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The fastest and most efficient way to create a web.obj.gz file is by using the tar command from a command prompt. This command can be run from Windows PowerShell or a Unix system, however files in any subdirectories must be explicitly called out. - Open a command prompt in the directory that contains all the necessary files. - Copy and run the following command .. code-block:: bash tar -czvf filename.web.obj.gz *.* WebPageFiles/*.* [ tar -czvf ] This creates a tar.gz archive that includes files specified by the include arguments. [ filename.web.obj.gz ] : Output file name. instead of tar.gz use web.obj.gz. [ \*.\* ] : Include all files in the current directory. [ WebPageFiles/\*.\* ] : Include all the files in the WebPageFiles subdirectory