This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision | |||
| android:jobsite:smartsuiteconfiguration [2014/03/06 17:45] mjallison [JSON Alternative] | android:jobsite:smartsuiteconfiguration [2014/04/09 17:42] (current) mjallison | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | Configuration objects are represented as a JSON object. The Access API allows you to grab the configuration object via a stream. This example shows a fully populated configuration object. The "ui" object and "job" object are optional.  | ||
| - | Mumble Mumble... early thoughts of the configuration file format. | + | The "ui" object will contain all the value, or none. For the "job" object, any one of the values may not be present. | 
| - | ===== XML Alternative ===== | ||
| <code> | <code> | ||
| - | <configuration type="SmartTrack"> | + | { | 
| - | <job> | + | "configuration.type": "SmartTrack" | 
| - | <cycleline name="line1">lat,lon,alt lat,lon,alt lat,lon,alt lat,lon,alt </cycleline> | + | "ui": { | 
| - | <haulpath name="path1">lat,lon,alt lat,lon,alt lat,lon,alt lat,lon,alt lat,lon,alt lat,lon,alt </haulpath>\ | + | "gps.northup": false, | 
| - | <warningarea name="area1">lat,lon,alt lat,lon,alt lat,lon,alt lat,lon,alt lat,lon,alt </warningarea> | + | "gps.usecompass": false, | 
| - | </job> | + | "screen.visible": false, | 
| - | <ui> | + | "statistics.visible": false, | 
| - | <settings visible="true"> | + | "login.visible": false, | 
| - | <filelist visible="true"> | + | "settings.visible": false, | 
| - | <gps visible="true"> | + | "preferences.visible": false, | 
| - | <northup value="true"> | + | "screenblanking.on": true, | 
| - | <usecompass value="true"> | + | "units.is.metric": false, | 
| - | </gps> | + | "track.cycles.displayed": false, | 
| - | <preferences visible="true"> | + | "gps.visible": false, | 
| - | <screen visible="true"> | + | "screenblanking.speed": 5, | 
| - | <machine visible="true"> | + | "cut.fill.setting": false, | 
| - | <login visible="true"> | + | "filelist.visible": false, | 
| - | </preferences> | + | "machine.visible": false | 
| - | <screenblanking value="10"> | + | }, | 
| - | <statistics visible="true"> | + | "job": { | 
| - | </ui> | + | "haulpath": "37.69827167784122,-121.81372338848165 37.698729396233624,-121.81368534695918 37.69895363855252,-121.81300747292565 37.69891010564817,-121.81236937168113 37.6986660738121,-121.81176326223982 37.69805798205796,-121.8118203404538 37.697965654517965,-121.81261579744947 37.69790578375631,-121.81332928842612 37.698267156656364,-121.81374629148586", | 
| - | </configuration> | + | "cyclelines": [ | 
| + | "37.69856055410253,-121.81389631635922 37.69853417331307,-121.8129590554174" | ||
| + | ], | ||
| + | "jobfileid": "241", | ||
| + | "jobfile": "\/Projects\/Samples\/Job Files\/City of Livermore.adf" | ||
| + | }, | ||
| + | } | ||
| </code> | </code> | ||
| - | Notes: | ||
| - | * Cycleline, haulpath, and warningarea may have zero or more instances. | ||
| - | * Other values have precisely one entry. | ||
| - | |||
| - | The current thinking is that the server traffics in the XML format, while the client applications have helper objects to deal with it. A model is similar to the Bundle class in Android that lets you do things like: | ||
| - | |||
| - | <code> | ||
| - | boolean gpsIsVisible = config.getBoolean("ui.gps.visible", true); | ||
| - | double blankspeed = config.getDouble("ui.screenblanking.visible", 37.5); | ||
| - | </code> | ||
| - | |||
| - | Helper classes for the config object would be coded for Java and C++. | ||
| - | |||
| - | ===== JSON Alternative ===== | ||
| - | Thinking about XML points out that working with XML is a pain in the butt. The parsers are ugly to work with, and the readability of an XML fragment is not a good as desired. JSON is an alternative that is portable across systems, and much more readable. Here are some thoughts RE: using JSON for the management directive format.  | ||
| - | |||
| - | <code> | ||
| - | { "configuration.type": "SmartTrack", | ||
| - | "job" : { | ||
| - | "jobfile": "/Projects/Samples/City of Livermore.adf", | ||
| - | "cyclelines": ["37.4,121.8,90.0 37.4,-121.85,91 37.5,-121.8,92",  | ||
| - | "37.4,121.8,90.0 37.4,-121.85,91 37.5,-121.8,92" ], | ||
| - | "haulpath": "37.4,121.8,90.0 37.4,-121.85,91 37.5,-121.8,92",  | ||
| - | "warningareas": [ { "name": "area1", | ||
| - | "line": "37.4,121.8,90.0 37.4,-121.85,91 37.5,-121.8,92"  | ||
| - | }, | ||
| - | { "name": "area2", | ||
| - | "line": "37.4,121.8,90.0 37.4,-121.85,91 37.5,-121.8,92"  | ||
| - | } | ||
| - | ] | ||
| - | }, | ||
| - | "ui": { | ||
| - | "settings.visible": "true", | ||
| - | "filelist.visible": "true", | ||
| - | "gps": { "visible": "true", | ||
| - | "northup": "true", | ||
| - | "usecompass": "true" | ||
| - | }, | ||
| - | "preferences": { "visible": true, | ||
| - | "screen.visible": "true", | ||
| - | "machine.visible": "true", | ||
| - | "login.visible": "true" | ||
| - | }, | ||
| - | "screeenblanking": 10, | ||
| - | "statistics.visible": "true" | ||
| - | } | ||
| - | } | ||
| - | </code> | ||