diff --git a/Makefile b/Makefile index 34f40b1b98..f216c67a71 100644 --- a/Makefile +++ b/Makefile @@ -52,7 +52,7 @@ help: @echo " test to run all tests" @echo -all: deps-generator c python javascript java haskell docs +all: deps-generator c python javascript java docs haskell docs: verify-prereq-docs deps-generator pdf html c: deps-c gen-c test-c diff --git a/c/include/libsbp/settings.h b/c/include/libsbp/settings.h index 75f94229d5..b79273d036 100644 --- a/c/include/libsbp/settings.h +++ b/c/include/libsbp/settings.h @@ -17,13 +17,32 @@ /** \defgroup settings Settings * - * * Messages for reading and writing the device's device settings. + * * + * Messages for reading, writing, and discovering device settings. Settings + * with a "string" field have multiple values in this field delimited with a + * null character (the c style null terminator). For instance, when querying + * the 'firmware_version' setting in the 'system_info' section, the following + * array of characters needs to be sent for the string field in + * MSG_SETTINGS_READ: "system_info\0firmware_version\0", where the delimiting + * null characters are specified with the escape sequence '\0' and all + * quotation marks should be omitted. * - * Note that some of these messages share the same message type ID for both the - * host request and the device response. See the accompanying document for - * descriptions of settings configurations and examples: * - * https://github.com/swift-nav/piksi\_firmware/blob/master/docs/settings.pdf + * In the message descriptions below, the generic strings SECTION_SETTING and + * SETTING are used to refer to the two strings that comprise the identifier + * of an individual setting.In firmware_version example above, SECTION_SETTING + * is the 'system_info', and the SETTING portion is 'firmware_version'. + * + * See the "Software Settings Manual" on support.swiftnav.com for detailed + * documentation about all settings and sections available for each Swift + * firmware version. Settings manuals are available for each firmware version + * at the following link: https://support.swiftnav.com/customer/en/portal/articles/2628580-piksi-multi-specifications#settings. + * The latest settings document is also available at the following link: + * http://swiftnav.com/latest/piksi-multi-settings . + * See lastly https://github.com/swift-nav/piksi_tools/blob/master/piksi_tools/settings.py , + * the open source python command line utility for reading, writing, and + * saving settings in the piksi_tools repository on github as a helpful + * reference and example. * \{ */ #ifndef LIBSBP_SETTINGS_MESSAGES_H @@ -42,14 +61,18 @@ /** Write device configuration settings (host => device) * -* The setting message writes the device configuration. + * The setting message writes the device configuration for a particular + * setting via A NULL-terminated and NULL-delimited string with contents + * "SECTION_SETTING\0SETTING\0VALUE\0" where the '\0' escape sequence denotes + * the NULL character and where quotation marks are omitted. A device will + * only process to this message when it is received from sender ID 0x42. + * An example string that could be sent to a device is + * "solution\0soln_freq\010\0". */ #define SBP_MSG_SETTINGS_WRITE 0x00A0 typedef struct __attribute__((packed)) { - char setting[0]; /**< A NULL-terminated and delimited string with contents -[SECTION_SETTING, SETTING, VALUE]. A device will only -process to this message when it is received from sender ID -0x42. + char setting[0]; /**< A NULL-terminated and NULL-delimited string with contents +"SECTION_SETTING\0SETTING\0VALUE\0" */ } msg_settings_write_t; @@ -58,38 +81,55 @@ process to this message when it is received from sender ID * * Return the status of a write request with the new value of the * setting. If the requested value is rejected, the current value - * will be returned. + * will be returned. The string field is a NULL-terminated and NULL-delimited + * string with contents "SECTION_SETTING\0SETTING\0VALUE\0" where the '\0' + * escape sequence denotes the NULL character and where quotation marks + * are omitted. An example string that could be sent from device is + * "solution\0soln_freq\010\0". */ #define SBP_MSG_SETTINGS_WRITE_RESP 0x00AF typedef struct __attribute__((packed)) { u8 status; /**< Write status */ char setting[0]; /**< A NULL-terminated and delimited string with contents -[SECTION_SETTING, SETTING, VALUE]. +"SECTION_SETTING\0SETTING\0VALUE\0" */ } msg_settings_write_resp_t; /** Read device configuration settings (host => device) * -* The setting message reads the device configuration. + * The setting message that reads the device configuration. The string + * field is a NULL-terminated and NULL-delimited string with contents + * "SECTION_SETTING\0SETTING\0" where the '\0' escape sequence denotes the + * NULL character and where quotation marks are omitted. An example + * string that could be sent to a device is "solution\0soln_freq\0". A + * device will only respond to this message when it is received from + * sender ID 0x42. A device should respond with a MSG_SETTINGS_READ_RESP + * message (msg_id 0x00A5). */ #define SBP_MSG_SETTINGS_READ_REQ 0x00A4 typedef struct __attribute__((packed)) { - char setting[0]; /**< A NULL-terminated and delimited string with contents -[SECTION_SETTING, SETTING]. A device will only respond to -this message when it is received from sender ID 0x42. + char setting[0]; /**< A NULL-terminated and NULL-delimited string with contents +"SECTION_SETTING\0SETTING\0" */ } msg_settings_read_req_t; /** Read device configuration settings (host <= device) * -* The setting message reads the device configuration. + * The setting message wich which the device responds after a + * MSG_SETTING_READ_REQ is sent to device. The string field is a + * NULL-terminated and NULL-delimited string with contents + * "SECTION_SETTING\0SETTING\0VALUE\0" where the '\0' escape sequence + * denotes the NULL character and where quotation marks are omitted. An + * example string that could be sent from device is + * "solution\0soln_freq\010\0". */ #define SBP_MSG_SETTINGS_READ_RESP 0x00A5 typedef struct __attribute__((packed)) { - char setting[0]; /**< A NULL-terminated and delimited string with contents -[SECTION_SETTING, SETTING, VALUE]. + char setting[0]; /**< A NULL-terminated and NULL-delimited string with contents +"SECTION_SETTING\0SETTING\0VALUE\0" + */ } msg_settings_read_resp_t; @@ -97,10 +137,8 @@ typedef struct __attribute__((packed)) { /** Read setting by direct index (host => device) * * The settings message for iterating through the settings - * values. It will read the setting at an index, returning a - * NULL-terminated and delimited string with contents - * [SECTION_SETTING, SETTING, VALUE]. A device will only respond to - * this message when it is received from sender ID 0x42. + * values. A device will respond to this message with a + * "MSG_SETTINGS_READ_BY_INDEX_RESP". */ #define SBP_MSG_SETTINGS_READ_BY_INDEX_REQ 0x00A2 typedef struct __attribute__((packed)) { @@ -112,10 +150,16 @@ typedef struct __attribute__((packed)) { /** Read setting by direct index (host <= device) * - * The settings message for iterating through the settings - * values. It will read the setting at an index, returning a - * NULL-terminated and delimited string with contents - * [SECTION_SETTING, SETTING, VALUE]. + * The settings message that reports the value of a setting at an index. + * + * In the string field, it reports NULL-terminated and delimited string + * with contents "SECTION_SETTING\0SETTING\0VALUE\0FORMAT_TYPE\0". where + * the '\0' escape sequence denotes the NULL character and where quotation + * marks are omitted. The FORMAT_TYPE field is optional and denotes + * possible string values of the setting as a hint to the user. If + * included, the format type portion of the string has the format + * "enum:value1,value2,value3". An example string that could be sent from + * the device is "simulator\0enabled\0True\0enum:True,False\0" */ #define SBP_MSG_SETTINGS_READ_BY_INDEX_RESP 0x00A7 typedef struct __attribute__((packed)) { @@ -123,7 +167,7 @@ typedef struct __attribute__((packed)) { 0 to length(settings) */ char setting[0]; /**< A NULL-terminated and delimited string with contents -[SECTION_SETTING, SETTING, VALUE]. +"SECTION_SETTING\0SETTING\0VALUE\0FORMAT_TYPE\0" */ } msg_settings_read_by_index_resp_t; @@ -144,7 +188,7 @@ typedef struct __attribute__((packed)) { #define SBP_MSG_SETTINGS_REGISTER 0x00AE typedef struct __attribute__((packed)) { char setting[0]; /**< A NULL-terminated and delimited string with contents -[SECTION_SETTING, SETTING, VALUE]. +"SECTION_SETTING\0SETTING\0VALUE". */ } msg_settings_register_t; diff --git a/docs/sbp.pdf b/docs/sbp.pdf index 33d64e8493..f55d446a76 100644 Binary files a/docs/sbp.pdf and b/docs/sbp.pdf differ diff --git a/generator/sbpg/targets/c.py b/generator/sbpg/targets/c.py index 8b86fb46ee..ba1f137749 100755 --- a/generator/sbpg/targets/c.py +++ b/generator/sbpg/targets/c.py @@ -14,6 +14,7 @@ """ from sbpg.targets.templating import * +from sbpg.utils import markdown_links MESSAGES_TEMPLATE_NAME = "sbp_messages_template.h" VERSION_TEMPLATE_NAME = "sbp_version_template.h" @@ -22,6 +23,7 @@ def commentify(value): """ Builds a comment. """ + value = markdown_links(value) if value is None: return if len(value.split('\n')) == 1: diff --git a/generator/sbpg/targets/haskell.py b/generator/sbpg/targets/haskell.py index 5c8a86d14a..56a1c24b7b 100755 --- a/generator/sbpg/targets/haskell.py +++ b/generator/sbpg/targets/haskell.py @@ -16,6 +16,7 @@ import string import copy from sbpg.targets.templating import * +from sbpg.utils import comment_links MESSAGES_TEMPLATE_NAME = "SbpMessagesTemplate.hs" CABAL_TEMPLATE_NAME = "sbp-template.cabal" @@ -143,6 +144,9 @@ def to_put(f, type_map=PUT_CONSTRUCT_CODE): return "mapM_ %s" % to_put(f_, type_map) return type_map.get(name, "put") +def comment_links_hsk(s): + return '\<' + comment_links(s) + '\>' + def max_fid_len(m): """ Max field id length. @@ -156,6 +160,7 @@ def max_fid_len(m): JENV.filters['to_put'] = to_put JENV.filters['max_fid_len'] = max_fid_len JENV.filters['camel_case'] = camel_case +JENV.filters['comment_links'] = comment_links_hsk def render_source(output_dir, package_spec): """ diff --git a/generator/sbpg/targets/java.py b/generator/sbpg/targets/java.py index cce92ae3bd..5bfb6a42d5 100755 --- a/generator/sbpg/targets/java.py +++ b/generator/sbpg/targets/java.py @@ -20,7 +20,7 @@ import os import os.path from sbpg.targets.templating import JENV, ACRONYMS - +from sbpg.utils import comment_links TEMPLATE_NAME = "sbp_java.java.j2" TEMPLATE_TABLE_NAME = "MessageTable.java.j2" @@ -61,6 +61,7 @@ def commentify(value): """ Builds a comment. """ + value = comment_links(value) if value is None: return if len(value.split('\n')) == 1: diff --git a/generator/sbpg/targets/javascript.py b/generator/sbpg/targets/javascript.py index d7c52756c7..0b6fd0f2eb 100644 --- a/generator/sbpg/targets/javascript.py +++ b/generator/sbpg/targets/javascript.py @@ -17,6 +17,7 @@ """ from sbpg.targets.templating import JENV +from sbpg.utils import comment_links import copy import textwrap @@ -176,6 +177,7 @@ def islist(x): JENV.filters['arrayLength'] = array_length JENV.filters['construct_js'] = construct_format JENV.filters['jsdoc'] = jsdoc_format +JENV.filters['comment_links'] = comment_links JENV.filters['starWordWrap'] = star_wordwrap JENV.filters['starWordWrapIndent'] = star_wordwrap_indent diff --git a/generator/sbpg/targets/latex.py b/generator/sbpg/targets/latex.py index d36996352e..5e28029f68 100755 --- a/generator/sbpg/targets/latex.py +++ b/generator/sbpg/targets/latex.py @@ -45,9 +45,9 @@ def no_us(value): LATEX_SUBS = ( (re.compile(r'\\'), r'\\textbackslash'), (re.compile(r'([{}_#%&$])'), r'\\\1'), + (re.compile(r'@@(\S+)\[(.+)\]'), r'\href{\1}{\2}'), (re.compile(r'~'), r'\~{}'), (re.compile(r'\^'), r'\^{}'), - (re.compile(r'_'), r'_'), (re.compile(r'"'), r"''"), (re.compile(r'\.\.\.+'), r'\\ldots'), ) diff --git a/generator/sbpg/targets/python.py b/generator/sbpg/targets/python.py index 38eddcd5d9..1d8ffad891 100755 --- a/generator/sbpg/targets/python.py +++ b/generator/sbpg/targets/python.py @@ -17,6 +17,7 @@ """ from sbpg.targets.templating import JENV, ACRONYMS +from sbpg.utils import comment_links import copy TEMPLATE_NAME = "sbp_construct_template.py.j2" @@ -97,6 +98,7 @@ def classnameify(s): JENV.filters['construct_py'] = construct_format JENV.filters['classnameify'] = classnameify JENV.filters['pydoc'] = pydoc_format +JENV.filters['comment_links'] = comment_links def render_source(output_dir, package_spec, jenv=JENV): diff --git a/generator/sbpg/targets/resources/SbpMessagesTemplate.hs b/generator/sbpg/targets/resources/SbpMessagesTemplate.hs index f2446cdd5a..ac6a1d9d72 100644 --- a/generator/sbpg/targets/resources/SbpMessagesTemplate.hs +++ b/generator/sbpg/targets/resources/SbpMessagesTemplate.hs @@ -11,7 +11,7 @@ -- Stability: experimental -- Portability: portable -- --- (((description | replace("\n", " ") | wordwrap(width=76, wrapstring="\n-- ")))) +-- (((description | comment_links | replace("\n", " ") | wordwrap(width=76, wrapstring="\n-- " )))) module (((module_name))) ( module (((module_name))) diff --git a/generator/sbpg/targets/resources/sbp_construct_template.py.j2 b/generator/sbpg/targets/resources/sbp_construct_template.py.j2 index b978da57f1..03e421b8c2 100755 --- a/generator/sbpg/targets/resources/sbp_construct_template.py.j2 +++ b/generator/sbpg/targets/resources/sbp_construct_template.py.j2 @@ -11,7 +11,7 @@ """ -(((description))) +(((description|comment_links))) """ import json diff --git a/generator/sbpg/targets/resources/sbp_js.js.j2 b/generator/sbpg/targets/resources/sbp_js.js.j2 index 135f8e16a0..414f110de5 100644 --- a/generator/sbpg/targets/resources/sbp_js.js.j2 +++ b/generator/sbpg/targets/resources/sbp_js.js.j2 @@ -15,7 +15,7 @@ ********************** * Package description: * - * (((description | starWordWrap))) + * (((description | comment_links | starWordWrap))) ***********************/ var SBP = require('./sbp'); diff --git a/generator/sbpg/targets/resources/sbp_messages_desc.tex b/generator/sbpg/targets/resources/sbp_messages_desc.tex index 76c2ca9c3d..a43490b7d2 100644 --- a/generator/sbpg/targets/resources/sbp_messages_desc.tex +++ b/generator/sbpg/targets/resources/sbp_messages_desc.tex @@ -4,9 +4,9 @@ \section{Stable Message Definitions} ((*- for m in msgs *)) ((*- if m.pkg *)) -\subsection{(((m.pkg|packagenameify|header_write)))} +\subsection{(((m.pkg|packagenameify|header_write|no_us)))} \begin{large} -(((m.pkg_desc | escape_tex | no_us))) +(((m.pkg_desc | escape_tex ))) \end{large} ((* endif *)) \subsubsection{(((m.name|escape_tex))) --- ((('0x%04X'|format(m.sbp_id)))) --- (((m.sbp_id)))} @@ -94,7 +94,7 @@ \subsection{(((m.pkg|packagenameify|no_us|header_write)))} (((m.pkg_desc))) \end{large} ((* endif *)) -\subsubsection*{(((m.name|escape_tex))) --- ((('0x%04X'|format(m.sbp_id)))) --- (((m.sbp_id)))} +\subsubsection*{(((m.name|escape_tex|no_us))) --- ((('0x%04X'|format(m.sbp_id)))) --- (((m.sbp_id)))} \label{sec:(((m.name)))} \begin{minipage}{\textwidth} \begin{large} diff --git a/generator/sbpg/utils.py b/generator/sbpg/utils.py index d4577aae25..3cfac09cd2 100755 --- a/generator/sbpg/utils.py +++ b/generator/sbpg/utils.py @@ -10,7 +10,7 @@ # WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. import pprint - +import re def fmt_repr(obj): """ Return pretty printed string representation of an object. @@ -52,3 +52,11 @@ def rejig_bitfields(bfs): 'len': bf_len, })) return new_bfs, n_with_values + +def comment_links(input_string): + pattern = re.compile(r'@@(\S+)\[(.+)\]') + return pattern.sub( r'\1', input_string) + +def markdown_links(input_string): + pattern = re.compile(r'@@(\S+)\[(.+)\]') + return pattern.sub( r'[\2](\1)', input_string) diff --git a/haskell/src/SwiftNav/SBP/Settings.hs b/haskell/src/SwiftNav/SBP/Settings.hs index 2e7efc3a8f..c5615318d1 100644 --- a/haskell/src/SwiftNav/SBP/Settings.hs +++ b/haskell/src/SwiftNav/SBP/Settings.hs @@ -11,11 +11,28 @@ -- Stability: experimental -- Portability: portable -- --- Messages for reading and writing the device's device settings. Note that --- some of these messages share the same message type ID for both the host --- request and the device response. See the accompanying document for --- descriptions of settings configurations and examples: https://github.com --- /swift-nav/piksi\_firmware/blob/master/docs/settings.pdf +-- Messages for reading, writing, and discovering device settings. Settings +-- with a "string" field have multiple values in this field delimited with a +-- null character (the c style null terminator). For instance, when querying +-- the 'firmware_version' setting in the 'system_info' section, the following +-- array of characters needs to be sent for the string field in +-- MSG_SETTINGS_READ: "system_info\0firmware_version\0", where the delimiting +-- null characters are specified with the escape sequence '\0' and all +-- quotation marks should be omitted. In the message descriptions below, the +-- generic strings SECTION_SETTING and SETTING are used to refer to the two +-- strings that comprise the identifier of an individual setting.In +-- firmware_version example above, SECTION_SETTING is the 'system_info', and +-- the SETTING portion is 'firmware_version'. See the "Software Settings +-- Manual" on support.swiftnav.com for detailed documentation about all +-- settings and sections available for each Swift firmware version. Settings +-- manuals are available for each firmware version at the following link: +-- https://support.swiftnav.com/customer/en/portal/articles/2628580-piksi- +-- multi-specifications#settings. The latest settings document is also +-- available at the following link: http://swiftnav.com/latest/piksi-multi- +-- settings . See lastly https://github.com/swift- +-- nav/piksi_tools/blob/master/piksi_tools/settings.py , the open source +-- python command line utility for reading, writing, and saving settings in the +-- piksi_tools repository on github as a helpful reference and example. module SwiftNav.SBP.Settings ( module SwiftNav.SBP.Settings @@ -64,12 +81,16 @@ msgSettingsWrite = 0x00A0 -- | SBP class for message MSG_SETTINGS_WRITE (0x00A0). -- --- The setting message writes the device configuration. +-- The setting message writes the device configuration for a particular setting +-- via A NULL-terminated and NULL-delimited string with contents +-- "SECTION_SETTING\0SETTING\0VALUE\0" where the '\0' escape sequence denotes +-- the NULL character and where quotation marks are omitted. A device will only +-- process to this message when it is received from sender ID 0x42. An example +-- string that could be sent to a device is "solution\0soln_freq\010\0". data MsgSettingsWrite = MsgSettingsWrite { _msgSettingsWrite_setting :: !Text - -- ^ A NULL-terminated and delimited string with contents [SECTION_SETTING, - -- SETTING, VALUE]. A device will only process to this message when it is - -- received from sender ID 0x42. + -- ^ A NULL-terminated and NULL-delimited string with contents + -- "SECTION_SETTING\0SETTING\0VALUE\0" } deriving ( Show, Read, Eq ) instance Binary MsgSettingsWrite where @@ -90,13 +111,17 @@ msgSettingsWriteResp = 0x00AF -- | SBP class for message MSG_SETTINGS_WRITE_RESP (0x00AF). -- -- Return the status of a write request with the new value of the setting. If --- the requested value is rejected, the current value will be returned. +-- the requested value is rejected, the current value will be returned. The +-- string field is a NULL-terminated and NULL-delimited string with contents +-- "SECTION_SETTING\0SETTING\0VALUE\0" where the '\0' escape sequence denotes +-- the NULL character and where quotation marks are omitted. An example string +-- that could be sent from device is "solution\0soln_freq\010\0". data MsgSettingsWriteResp = MsgSettingsWriteResp { _msgSettingsWriteResp_status :: !Word8 -- ^ Write status , _msgSettingsWriteResp_setting :: !Text - -- ^ A NULL-terminated and delimited string with contents [SECTION_SETTING, - -- SETTING, VALUE]. + -- ^ A NULL-terminated and delimited string with contents + -- "SECTION_SETTING\0SETTING\0VALUE\0" } deriving ( Show, Read, Eq ) instance Binary MsgSettingsWriteResp where @@ -118,12 +143,17 @@ msgSettingsReadReq = 0x00A4 -- | SBP class for message MSG_SETTINGS_READ_REQ (0x00A4). -- --- The setting message reads the device configuration. +-- The setting message that reads the device configuration. The string field is +-- a NULL-terminated and NULL-delimited string with contents +-- "SECTION_SETTING\0SETTING\0" where the '\0' escape sequence denotes the NULL +-- character and where quotation marks are omitted. An example string that +-- could be sent to a device is "solution\0soln_freq\0". A device will only +-- respond to this message when it is received from sender ID 0x42. A device +-- should respond with a MSG_SETTINGS_READ_RESP message (msg_id 0x00A5). data MsgSettingsReadReq = MsgSettingsReadReq { _msgSettingsReadReq_setting :: !Text - -- ^ A NULL-terminated and delimited string with contents [SECTION_SETTING, - -- SETTING]. A device will only respond to this message when it is received - -- from sender ID 0x42. + -- ^ A NULL-terminated and NULL-delimited string with contents + -- "SECTION_SETTING\0SETTING\0" } deriving ( Show, Read, Eq ) instance Binary MsgSettingsReadReq where @@ -143,11 +173,16 @@ msgSettingsReadResp = 0x00A5 -- | SBP class for message MSG_SETTINGS_READ_RESP (0x00A5). -- --- The setting message reads the device configuration. +-- The setting message wich which the device responds after a +-- MSG_SETTING_READ_REQ is sent to device. The string field is a NULL- +-- terminated and NULL-delimited string with contents +-- "SECTION_SETTING\0SETTING\0VALUE\0" where the '\0' escape sequence denotes +-- the NULL character and where quotation marks are omitted. An example string +-- that could be sent from device is "solution\0soln_freq\010\0". data MsgSettingsReadResp = MsgSettingsReadResp { _msgSettingsReadResp_setting :: !Text - -- ^ A NULL-terminated and delimited string with contents [SECTION_SETTING, - -- SETTING, VALUE]. + -- ^ A NULL-terminated and NULL-delimited string with contents + -- "SECTION_SETTING\0SETTING\0VALUE\0" } deriving ( Show, Read, Eq ) instance Binary MsgSettingsReadResp where @@ -167,10 +202,8 @@ msgSettingsReadByIndexReq = 0x00A2 -- | SBP class for message MSG_SETTINGS_READ_BY_INDEX_REQ (0x00A2). -- --- The settings message for iterating through the settings values. It will read --- the setting at an index, returning a NULL-terminated and delimited string --- with contents [SECTION_SETTING, SETTING, VALUE]. A device will only respond --- to this message when it is received from sender ID 0x42. +-- The settings message for iterating through the settings values. A device +-- will respond to this message with a "MSG_SETTINGS_READ_BY_INDEX_RESP". data MsgSettingsReadByIndexReq = MsgSettingsReadByIndexReq { _msgSettingsReadByIndexReq_index :: !Word16 -- ^ An index into the device settings, with values ranging from 0 to @@ -194,16 +227,22 @@ msgSettingsReadByIndexResp = 0x00A7 -- | SBP class for message MSG_SETTINGS_READ_BY_INDEX_RESP (0x00A7). -- --- The settings message for iterating through the settings values. It will read --- the setting at an index, returning a NULL-terminated and delimited string --- with contents [SECTION_SETTING, SETTING, VALUE]. +-- The settings message that reports the value of a setting at an index. In +-- the string field, it reports NULL-terminated and delimited string with +-- contents "SECTION_SETTING\0SETTING\0VALUE\0FORMAT_TYPE\0". where the '\0' +-- escape sequence denotes the NULL character and where quotation marks are +-- omitted. The FORMAT_TYPE field is optional and denotes possible string +-- values of the setting as a hint to the user. If included, the format type +-- portion of the string has the format "enum:value1,value2,value3". An example +-- string that could be sent from the device is +-- "simulator\0enabled\0True\0enum:True,False\0" data MsgSettingsReadByIndexResp = MsgSettingsReadByIndexResp { _msgSettingsReadByIndexResp_index :: !Word16 -- ^ An index into the device settings, with values ranging from 0 to -- length(settings) , _msgSettingsReadByIndexResp_setting :: !Text - -- ^ A NULL-terminated and delimited string with contents [SECTION_SETTING, - -- SETTING, VALUE]. + -- ^ A NULL-terminated and delimited string with contents + -- "SECTION_SETTING\0SETTING\0VALUE\0FORMAT_TYPE\0" } deriving ( Show, Read, Eq ) instance Binary MsgSettingsReadByIndexResp where @@ -249,8 +288,8 @@ msgSettingsRegister = 0x00AE -- setting to set the initial value. data MsgSettingsRegister = MsgSettingsRegister { _msgSettingsRegister_setting :: !Text - -- ^ A NULL-terminated and delimited string with contents [SECTION_SETTING, - -- SETTING, VALUE]. + -- ^ A NULL-terminated and delimited string with contents + -- "SECTION_SETTING\0SETTING\0VALUE". } deriving ( Show, Read, Eq ) instance Binary MsgSettingsRegister where diff --git a/java/src/com/swiftnav/sbp/settings/MsgSettingsReadByIndexReq.java b/java/src/com/swiftnav/sbp/settings/MsgSettingsReadByIndexReq.java index 9b2b2a712b..cecaa81814 100644 --- a/java/src/com/swiftnav/sbp/settings/MsgSettingsReadByIndexReq.java +++ b/java/src/com/swiftnav/sbp/settings/MsgSettingsReadByIndexReq.java @@ -29,10 +29,8 @@ * fields. * * The settings message for iterating through the settings - * values. It will read the setting at an index, returning a - * NULL-terminated and delimited string with contents - * [SECTION_SETTING, SETTING, VALUE]. A device will only respond to - * this message when it is received from sender ID 0x42. */ + * values. A device will respond to this message with a + * "MSG_SETTINGS_READ_BY_INDEX_RESP". */ public class MsgSettingsReadByIndexReq extends SBPMessage { public static final int TYPE = 0x00A2; diff --git a/java/src/com/swiftnav/sbp/settings/MsgSettingsReadByIndexResp.java b/java/src/com/swiftnav/sbp/settings/MsgSettingsReadByIndexResp.java index 16d1b4b08a..6655f9df68 100644 --- a/java/src/com/swiftnav/sbp/settings/MsgSettingsReadByIndexResp.java +++ b/java/src/com/swiftnav/sbp/settings/MsgSettingsReadByIndexResp.java @@ -28,10 +28,16 @@ * an inherited SBP object, or construct it inline using a dict of its * fields. * - * The settings message for iterating through the settings - * values. It will read the setting at an index, returning a - * NULL-terminated and delimited string with contents - * [SECTION_SETTING, SETTING, VALUE]. */ + * The settings message that reports the value of a setting at an index. + * + * In the string field, it reports NULL-terminated and delimited string + * with contents "SECTION_SETTING\0SETTING\0VALUE\0FORMAT_TYPE\0". where + * the '\0' escape sequence denotes the NULL character and where quotation + * marks are omitted. The FORMAT_TYPE field is optional and denotes + * possible string values of the setting as a hint to the user. If + * included, the format type portion of the string has the format + * "enum:value1,value2,value3". An example string that could be sent from + * the device is "simulator\0enabled\0True\0enum:True,False\0" */ public class MsgSettingsReadByIndexResp extends SBPMessage { public static final int TYPE = 0x00A7; @@ -43,7 +49,7 @@ public class MsgSettingsReadByIndexResp extends SBPMessage { public int index; /** A NULL-terminated and delimited string with contents -[SECTION_SETTING, SETTING, VALUE]. +"SECTION_SETTING\0SETTING\0VALUE\0FORMAT_TYPE\0" */ public String setting; diff --git a/java/src/com/swiftnav/sbp/settings/MsgSettingsReadReq.java b/java/src/com/swiftnav/sbp/settings/MsgSettingsReadReq.java index 66685d465d..760bd3181a 100644 --- a/java/src/com/swiftnav/sbp/settings/MsgSettingsReadReq.java +++ b/java/src/com/swiftnav/sbp/settings/MsgSettingsReadReq.java @@ -28,15 +28,21 @@ * an inherited SBP object, or construct it inline using a dict of its * fields. * -* The setting message reads the device configuration. */ + * The setting message that reads the device configuration. The string + * field is a NULL-terminated and NULL-delimited string with contents + * "SECTION_SETTING\0SETTING\0" where the '\0' escape sequence denotes the + * NULL character and where quotation marks are omitted. An example + * string that could be sent to a device is "solution\0soln_freq\0". A + * device will only respond to this message when it is received from + * sender ID 0x42. A device should respond with a MSG_SETTINGS_READ_RESP + * message (msg_id 0x00A5). */ public class MsgSettingsReadReq extends SBPMessage { public static final int TYPE = 0x00A4; - /** A NULL-terminated and delimited string with contents -[SECTION_SETTING, SETTING]. A device will only respond to -this message when it is received from sender ID 0x42. + /** A NULL-terminated and NULL-delimited string with contents +"SECTION_SETTING\0SETTING\0" */ public String setting; diff --git a/java/src/com/swiftnav/sbp/settings/MsgSettingsReadResp.java b/java/src/com/swiftnav/sbp/settings/MsgSettingsReadResp.java index c0ddf3d956..f634329a78 100644 --- a/java/src/com/swiftnav/sbp/settings/MsgSettingsReadResp.java +++ b/java/src/com/swiftnav/sbp/settings/MsgSettingsReadResp.java @@ -28,14 +28,21 @@ * an inherited SBP object, or construct it inline using a dict of its * fields. * -* The setting message reads the device configuration. */ + * The setting message wich which the device responds after a + * MSG_SETTING_READ_REQ is sent to device. The string field is a + * NULL-terminated and NULL-delimited string with contents + * "SECTION_SETTING\0SETTING\0VALUE\0" where the '\0' escape sequence + * denotes the NULL character and where quotation marks are omitted. An + * example string that could be sent from device is + * "solution\0soln_freq\010\0". */ public class MsgSettingsReadResp extends SBPMessage { public static final int TYPE = 0x00A5; - /** A NULL-terminated and delimited string with contents -[SECTION_SETTING, SETTING, VALUE]. + /** A NULL-terminated and NULL-delimited string with contents +"SECTION_SETTING\0SETTING\0VALUE\0" + */ public String setting; diff --git a/java/src/com/swiftnav/sbp/settings/MsgSettingsRegister.java b/java/src/com/swiftnav/sbp/settings/MsgSettingsRegister.java index 94df067fed..c0868c2272 100644 --- a/java/src/com/swiftnav/sbp/settings/MsgSettingsRegister.java +++ b/java/src/com/swiftnav/sbp/settings/MsgSettingsRegister.java @@ -37,7 +37,7 @@ public class MsgSettingsRegister extends SBPMessage { /** A NULL-terminated and delimited string with contents -[SECTION_SETTING, SETTING, VALUE]. +"SECTION_SETTING\0SETTING\0VALUE". */ public String setting; diff --git a/java/src/com/swiftnav/sbp/settings/MsgSettingsWrite.java b/java/src/com/swiftnav/sbp/settings/MsgSettingsWrite.java index deeac39ee5..b699449591 100644 --- a/java/src/com/swiftnav/sbp/settings/MsgSettingsWrite.java +++ b/java/src/com/swiftnav/sbp/settings/MsgSettingsWrite.java @@ -28,16 +28,20 @@ * an inherited SBP object, or construct it inline using a dict of its * fields. * -* The setting message writes the device configuration. */ + * The setting message writes the device configuration for a particular + * setting via A NULL-terminated and NULL-delimited string with contents + * "SECTION_SETTING\0SETTING\0VALUE\0" where the '\0' escape sequence denotes + * the NULL character and where quotation marks are omitted. A device will + * only process to this message when it is received from sender ID 0x42. + * An example string that could be sent to a device is + * "solution\0soln_freq\010\0". */ public class MsgSettingsWrite extends SBPMessage { public static final int TYPE = 0x00A0; - /** A NULL-terminated and delimited string with contents -[SECTION_SETTING, SETTING, VALUE]. A device will only -process to this message when it is received from sender ID -0x42. + /** A NULL-terminated and NULL-delimited string with contents +"SECTION_SETTING\0SETTING\0VALUE\0" */ public String setting; diff --git a/java/src/com/swiftnav/sbp/settings/MsgSettingsWriteResp.java b/java/src/com/swiftnav/sbp/settings/MsgSettingsWriteResp.java index 0bd1cfd112..94112679ec 100644 --- a/java/src/com/swiftnav/sbp/settings/MsgSettingsWriteResp.java +++ b/java/src/com/swiftnav/sbp/settings/MsgSettingsWriteResp.java @@ -30,7 +30,11 @@ * * Return the status of a write request with the new value of the * setting. If the requested value is rejected, the current value - * will be returned. */ + * will be returned. The string field is a NULL-terminated and NULL-delimited + * string with contents "SECTION_SETTING\0SETTING\0VALUE\0" where the '\0' + * escape sequence denotes the NULL character and where quotation marks + * are omitted. An example string that could be sent from device is + * "solution\0soln_freq\010\0". */ public class MsgSettingsWriteResp extends SBPMessage { public static final int TYPE = 0x00AF; @@ -40,7 +44,7 @@ public class MsgSettingsWriteResp extends SBPMessage { public int status; /** A NULL-terminated and delimited string with contents -[SECTION_SETTING, SETTING, VALUE]. +"SECTION_SETTING\0SETTING\0VALUE\0" */ public String setting; diff --git a/javascript/sbp/settings.js b/javascript/sbp/settings.js index 415c528a40..2c71ace173 100644 --- a/javascript/sbp/settings.js +++ b/javascript/sbp/settings.js @@ -15,11 +15,28 @@ ********************** * Package description: * - * Messages for reading and writing the device's device settings. Note that some - * of these messages share the same message type ID for both the host request and - * the device response. See the accompanying document for descriptions of settings - * configurations and examples: https://github.com/swift- - * nav/piksi\_firmware/blob/master/docs/settings.pdf + * Messages for reading, writing, and discovering device settings. Settings with a + * "string" field have multiple values in this field delimited with a null + * character (the c style null terminator). For instance, when querying the + * 'firmware_version' setting in the 'system_info' section, the following array of + * characters needs to be sent for the string field in MSG_SETTINGS_READ: + * "system_info\0firmware_version\0", where the delimiting null characters are + * specified with the escape sequence '\0' and all quotation marks should be + * omitted. In the message descriptions below, the generic strings + * SECTION_SETTING and SETTING are used to refer to the two strings that comprise + * the identifier of an individual setting.In firmware_version example above, + * SECTION_SETTING is the 'system_info', and the SETTING portion is + * 'firmware_version'. See the "Software Settings Manual" on support.swiftnav.com + * for detailed documentation about all settings and sections available for each + * Swift firmware version. Settings manuals are available for each firmware version + * at the following link: + * https://support.swiftnav.com/customer/en/portal/articles/2628580-piksi-multi- + * specifications#settings. The latest settings document is also available at the + * following link: http://swiftnav.com/latest/piksi-multi-settings . See lastly + * https://github.com/swift-nav/piksi_tools/blob/master/piksi_tools/settings.py , + * the open source python command line utility for reading, writing, and saving + * settings in the piksi_tools repository on github as a helpful reference and + * example. ***********************/ var SBP = require('./sbp'); @@ -53,12 +70,16 @@ MsgSettingsSave.prototype.fieldSpec = []; /** * SBP class for message MSG_SETTINGS_WRITE (0x00A0). * - * The setting message writes the device configuration. + * The setting message writes the device configuration for a particular setting via + * A NULL-terminated and NULL-delimited string with contents + * "SECTION_SETTING\0SETTING\0VALUE\0" where the '\0' escape sequence denotes the + * NULL character and where quotation marks are omitted. A device will only process + * to this message when it is received from sender ID 0x42. An example string that + * could be sent to a device is "solution\0soln_freq\010\0". * * Fields in the SBP payload (`sbp.payload`): - * @field setting string A NULL-terminated and delimited string with contents [SECTION_SETTING, SETTING, - * VALUE]. A device will only process to this message when it is received from - * sender ID 0x42. + * @field setting string A NULL-terminated and NULL-delimited string with contents + * "SECTION_SETTING\0SETTING\0VALUE\0" * * @param sbp An SBP object with a payload to be decoded. */ @@ -83,12 +104,16 @@ MsgSettingsWrite.prototype.fieldSpec.push(['setting', 'string', null]); * SBP class for message MSG_SETTINGS_WRITE_RESP (0x00AF). * * Return the status of a write request with the new value of the setting. If the - * requested value is rejected, the current value will be returned. + * requested value is rejected, the current value will be returned. The string + * field is a NULL-terminated and NULL-delimited string with contents + * "SECTION_SETTING\0SETTING\0VALUE\0" where the '\0' escape sequence denotes the + * NULL character and where quotation marks are omitted. An example string that + * could be sent from device is "solution\0soln_freq\010\0". * * Fields in the SBP payload (`sbp.payload`): * @field status number (unsigned 8-bit int, 1 byte) Write status - * @field setting string A NULL-terminated and delimited string with contents [SECTION_SETTING, SETTING, - * VALUE]. + * @field setting string A NULL-terminated and delimited string with contents + * "SECTION_SETTING\0SETTING\0VALUE\0" * * @param sbp An SBP object with a payload to be decoded. */ @@ -114,12 +139,17 @@ MsgSettingsWriteResp.prototype.fieldSpec.push(['setting', 'string', null]); /** * SBP class for message MSG_SETTINGS_READ_REQ (0x00A4). * - * The setting message reads the device configuration. + * The setting message that reads the device configuration. The string field is a + * NULL-terminated and NULL-delimited string with contents + * "SECTION_SETTING\0SETTING\0" where the '\0' escape sequence denotes the NULL + * character and where quotation marks are omitted. An example string that could be + * sent to a device is "solution\0soln_freq\0". A device will only respond to this + * message when it is received from sender ID 0x42. A device should respond with a + * MSG_SETTINGS_READ_RESP message (msg_id 0x00A5). * * Fields in the SBP payload (`sbp.payload`): - * @field setting string A NULL-terminated and delimited string with contents [SECTION_SETTING, SETTING]. - * A device will only respond to this message when it is received from sender ID - * 0x42. + * @field setting string A NULL-terminated and NULL-delimited string with contents + * "SECTION_SETTING\0SETTING\0" * * @param sbp An SBP object with a payload to be decoded. */ @@ -143,11 +173,15 @@ MsgSettingsReadReq.prototype.fieldSpec.push(['setting', 'string', null]); /** * SBP class for message MSG_SETTINGS_READ_RESP (0x00A5). * - * The setting message reads the device configuration. + * The setting message wich which the device responds after a MSG_SETTING_READ_REQ + * is sent to device. The string field is a NULL-terminated and NULL-delimited + * string with contents "SECTION_SETTING\0SETTING\0VALUE\0" where the '\0' escape + * sequence denotes the NULL character and where quotation marks are omitted. An + * example string that could be sent from device is "solution\0soln_freq\010\0". * * Fields in the SBP payload (`sbp.payload`): - * @field setting string A NULL-terminated and delimited string with contents [SECTION_SETTING, SETTING, - * VALUE]. + * @field setting string A NULL-terminated and NULL-delimited string with contents + * "SECTION_SETTING\0SETTING\0VALUE\0" * * @param sbp An SBP object with a payload to be decoded. */ @@ -171,10 +205,8 @@ MsgSettingsReadResp.prototype.fieldSpec.push(['setting', 'string', null]); /** * SBP class for message MSG_SETTINGS_READ_BY_INDEX_REQ (0x00A2). * - * The settings message for iterating through the settings values. It will read the - * setting at an index, returning a NULL-terminated and delimited string with - * contents [SECTION_SETTING, SETTING, VALUE]. A device will only respond to this - * message when it is received from sender ID 0x42. + * The settings message for iterating through the settings values. A device will + * respond to this message with a "MSG_SETTINGS_READ_BY_INDEX_RESP". * * Fields in the SBP payload (`sbp.payload`): * @field index number (unsigned 16-bit int, 2 bytes) An index into the device settings, with values ranging from 0 to @@ -202,15 +234,20 @@ MsgSettingsReadByIndexReq.prototype.fieldSpec.push(['index', 'writeUInt16LE', 2] /** * SBP class for message MSG_SETTINGS_READ_BY_INDEX_RESP (0x00A7). * - * The settings message for iterating through the settings values. It will read the - * setting at an index, returning a NULL-terminated and delimited string with - * contents [SECTION_SETTING, SETTING, VALUE]. + * The settings message that reports the value of a setting at an index. In the + * string field, it reports NULL-terminated and delimited string with contents + * "SECTION_SETTING\0SETTING\0VALUE\0FORMAT_TYPE\0". where the '\0' escape sequence + * denotes the NULL character and where quotation marks are omitted. The + * FORMAT_TYPE field is optional and denotes possible string values of the setting + * as a hint to the user. If included, the format type portion of the string has + * the format "enum:value1,value2,value3". An example string that could be sent + * from the device is "simulator\0enabled\0True\0enum:True,False\0" * * Fields in the SBP payload (`sbp.payload`): * @field index number (unsigned 16-bit int, 2 bytes) An index into the device settings, with values ranging from 0 to * length(settings) - * @field setting string A NULL-terminated and delimited string with contents [SECTION_SETTING, SETTING, - * VALUE]. + * @field setting string A NULL-terminated and delimited string with contents + * "SECTION_SETTING\0SETTING\0VALUE\0FORMAT_TYPE\0" * * @param sbp An SBP object with a payload to be decoded. */ @@ -263,8 +300,8 @@ MsgSettingsReadByIndexDone.prototype.fieldSpec = []; * to set the initial value. * * Fields in the SBP payload (`sbp.payload`): - * @field setting string A NULL-terminated and delimited string with contents [SECTION_SETTING, SETTING, - * VALUE]. + * @field setting string A NULL-terminated and delimited string with contents + * "SECTION_SETTING\0SETTING\0VALUE". * * @param sbp An SBP object with a payload to be decoded. */ diff --git a/python/sbp/settings.py b/python/sbp/settings.py index e03128ff2d..f997e49d2a 100644 --- a/python/sbp/settings.py +++ b/python/sbp/settings.py @@ -11,13 +11,32 @@ """ -Messages for reading and writing the device's device settings. -Note that some of these messages share the same message type ID for both the -host request and the device response. See the accompanying document for -descriptions of settings configurations and examples: - -https://github.com/swift-nav/piksi\_firmware/blob/master/docs/settings.pdf +Messages for reading, writing, and discovering device settings. Settings +with a "string" field have multiple values in this field delimited with a +null character (the c style null terminator). For instance, when querying +the 'firmware_version' setting in the 'system_info' section, the following +array of characters needs to be sent for the string field in +MSG_SETTINGS_READ: "system_info\0firmware_version\0", where the delimiting +null characters are specified with the escape sequence '\0' and all +quotation marks should be omitted. + + +In the message descriptions below, the generic strings SECTION_SETTING and +SETTING are used to refer to the two strings that comprise the identifier +of an individual setting.In firmware_version example above, SECTION_SETTING +is the 'system_info', and the SETTING portion is 'firmware_version'. + +See the "Software Settings Manual" on support.swiftnav.com for detailed +documentation about all settings and sections available for each Swift +firmware version. Settings manuals are available for each firmware version +at the following link: https://support.swiftnav.com/customer/en/portal/articles/2628580-piksi-multi-specifications#settings. +The latest settings document is also available at the following link: +http://swiftnav.com/latest/piksi-multi-settings . +See lastly https://github.com/swift-nav/piksi_tools/blob/master/piksi_tools/settings.py , +the open source python command line utility for reading, writing, and +saving settings in the piksi_tools repository on github as a helpful +reference and example. """ @@ -87,17 +106,22 @@ class MsgSettingsWrite(SBP): of its fields. - The setting message writes the device configuration. + The setting message writes the device configuration for a particular +setting via A NULL-terminated and NULL-delimited string with contents +"SECTION_SETTING\0SETTING\0VALUE\0" where the '\0' escape sequence denotes +the NULL character and where quotation marks are omitted. A device will +only process to this message when it is received from sender ID 0x42. +An example string that could be sent to a device is +"solution\0soln_freq\010\0". + Parameters ---------- sbp : SBP SBP parent object to inherit from. setting : string - A NULL-terminated and delimited string with contents -[SECTION_SETTING, SETTING, VALUE]. A device will only -process to this message when it is received from sender ID -0x42. + A NULL-terminated and NULL-delimited string with contents +"SECTION_SETTING\0SETTING\0VALUE\0" sender : int Optional sender ID, defaults to SENDER_ID (see sbp/msg.py). @@ -173,7 +197,11 @@ class MsgSettingsWriteResp(SBP): Return the status of a write request with the new value of the setting. If the requested value is rejected, the current value -will be returned. +will be returned. The string field is a NULL-terminated and NULL-delimited +string with contents "SECTION_SETTING\0SETTING\0VALUE\0" where the '\0' +escape sequence denotes the NULL character and where quotation marks +are omitted. An example string that could be sent from device is +"solution\0soln_freq\010\0". Parameters @@ -184,7 +212,7 @@ class MsgSettingsWriteResp(SBP): Write status setting : string A NULL-terminated and delimited string with contents -[SECTION_SETTING, SETTING, VALUE]. +"SECTION_SETTING\0SETTING\0VALUE\0" sender : int Optional sender ID, defaults to SENDER_ID (see sbp/msg.py). @@ -261,16 +289,23 @@ class MsgSettingsReadReq(SBP): of its fields. - The setting message reads the device configuration. + The setting message that reads the device configuration. The string +field is a NULL-terminated and NULL-delimited string with contents +"SECTION_SETTING\0SETTING\0" where the '\0' escape sequence denotes the +NULL character and where quotation marks are omitted. An example +string that could be sent to a device is "solution\0soln_freq\0". A +device will only respond to this message when it is received from +sender ID 0x42. A device should respond with a MSG_SETTINGS_READ_RESP +message (msg_id 0x00A5). + Parameters ---------- sbp : SBP SBP parent object to inherit from. setting : string - A NULL-terminated and delimited string with contents -[SECTION_SETTING, SETTING]. A device will only respond to -this message when it is received from sender ID 0x42. + A NULL-terminated and NULL-delimited string with contents +"SECTION_SETTING\0SETTING\0" sender : int Optional sender ID, defaults to SENDER_ID (see sbp/msg.py). @@ -344,15 +379,23 @@ class MsgSettingsReadResp(SBP): of its fields. - The setting message reads the device configuration. + The setting message wich which the device responds after a +MSG_SETTING_READ_REQ is sent to device. The string field is a +NULL-terminated and NULL-delimited string with contents +"SECTION_SETTING\0SETTING\0VALUE\0" where the '\0' escape sequence +denotes the NULL character and where quotation marks are omitted. An +example string that could be sent from device is +"solution\0soln_freq\010\0". + Parameters ---------- sbp : SBP SBP parent object to inherit from. setting : string - A NULL-terminated and delimited string with contents -[SECTION_SETTING, SETTING, VALUE]. + A NULL-terminated and NULL-delimited string with contents +"SECTION_SETTING\0SETTING\0VALUE\0" + sender : int Optional sender ID, defaults to SENDER_ID (see sbp/msg.py). @@ -427,10 +470,8 @@ class MsgSettingsReadByIndexReq(SBP): The settings message for iterating through the settings -values. It will read the setting at an index, returning a -NULL-terminated and delimited string with contents -[SECTION_SETTING, SETTING, VALUE]. A device will only respond to -this message when it is received from sender ID 0x42. +values. A device will respond to this message with a +"MSG_SETTINGS_READ_BY_INDEX_RESP". Parameters @@ -513,10 +554,16 @@ class MsgSettingsReadByIndexResp(SBP): of its fields. - The settings message for iterating through the settings -values. It will read the setting at an index, returning a -NULL-terminated and delimited string with contents -[SECTION_SETTING, SETTING, VALUE]. + The settings message that reports the value of a setting at an index. + +In the string field, it reports NULL-terminated and delimited string +with contents "SECTION_SETTING\0SETTING\0VALUE\0FORMAT_TYPE\0". where +the '\0' escape sequence denotes the NULL character and where quotation +marks are omitted. The FORMAT_TYPE field is optional and denotes +possible string values of the setting as a hint to the user. If +included, the format type portion of the string has the format +"enum:value1,value2,value3". An example string that could be sent from +the device is "simulator\0enabled\0True\0enum:True,False\0" Parameters @@ -529,7 +576,7 @@ class MsgSettingsReadByIndexResp(SBP): setting : string A NULL-terminated and delimited string with contents -[SECTION_SETTING, SETTING, VALUE]. +"SECTION_SETTING\0SETTING\0VALUE\0FORMAT_TYPE\0" sender : int Optional sender ID, defaults to SENDER_ID (see sbp/msg.py). @@ -662,7 +709,7 @@ class MsgSettingsRegister(SBP): SBP parent object to inherit from. setting : string A NULL-terminated and delimited string with contents -[SECTION_SETTING, SETTING, VALUE]. +"SECTION_SETTING\0SETTING\0VALUE". sender : int Optional sender ID, defaults to SENDER_ID (see sbp/msg.py). diff --git a/spec/yaml/swiftnav/sbp/settings.yaml b/spec/yaml/swiftnav/sbp/settings.yaml index fced970b44..d146437eca 100644 --- a/spec/yaml/swiftnav/sbp/settings.yaml +++ b/spec/yaml/swiftnav/sbp/settings.yaml @@ -10,13 +10,33 @@ package: swiftnav.sbp.settings description: | - Messages for reading and writing the device's device settings. + + Messages for reading, writing, and discovering device settings. Settings + with a "string" field have multiple values in this field delimited with a + null character (the c style null terminator). For instance, when querying + the 'firmware_version' setting in the 'system_info' section, the following + array of characters needs to be sent for the string field in + MSG_SETTINGS_READ: "system_info\0firmware_version\0", where the delimiting + null characters are specified with the escape sequence '\0' and all + quotation marks should be omitted. - Note that some of these messages share the same message type ID for both the - host request and the device response. See the accompanying document for - descriptions of settings configurations and examples: + + In the message descriptions below, the generic strings SECTION_SETTING and + SETTING are used to refer to the two strings that comprise the identifier + of an individual setting.In firmware_version example above, SECTION_SETTING + is the 'system_info', and the SETTING portion is 'firmware_version'. + + See the "Software Settings Manual" on support.swiftnav.com for detailed + documentation about all settings and sections available for each Swift + firmware version. Settings manuals are available for each firmware version + at the following link: @@https://support.swiftnav.com/customer/en/portal/articles/2628580-piksi-multi-specifications#settings[Piksi Multi Specifications]. + The latest settings document is also available at the following link: + @@http://swiftnav.com/latest/piksi-multi-settings[Latest settings document] . + See lastly @@https://github.com/swift-nav/piksi_tools/blob/master/piksi_tools/settings.py[settings.py] , + the open source python command line utility for reading, writing, and + saving settings in the piksi_tools repository on github as a helpful + reference and example. - https://github.com/swift-nav/piksi\_firmware/blob/master/docs/settings.pdf stable: True public: True include: @@ -33,15 +53,20 @@ definitions: - MSG_SETTINGS_WRITE: id: 0x00A0 short_desc: Write device configuration settings (host => device) - desc: The setting message writes the device configuration. + desc: | + The setting message writes the device configuration for a particular + setting via A NULL-terminated and NULL-delimited string with contents + "SECTION_SETTING\0SETTING\0VALUE\0" where the '\0' escape sequence denotes + the NULL character and where quotation marks are omitted. A device will + only process to this message when it is received from sender ID 0x42. + An example string that could be sent to a device is + "solution\0soln_freq\010\0". fields: - setting: type: string desc: | - A NULL-terminated and delimited string with contents - [SECTION_SETTING, SETTING, VALUE]. A device will only - process to this message when it is received from sender ID - 0x42. + A NULL-terminated and NULL-delimited string with contents + "SECTION_SETTING\0SETTING\0VALUE\0" - MSG_SETTINGS_WRITE_RESP: id: 0x00AF @@ -49,7 +74,11 @@ definitions: desc: | Return the status of a write request with the new value of the setting. If the requested value is rejected, the current value - will be returned. + will be returned. The string field is a NULL-terminated and NULL-delimited + string with contents "SECTION_SETTING\0SETTING\0VALUE\0" where the '\0' + escape sequence denotes the NULL character and where quotation marks + are omitted. An example string that could be sent from device is + "solution\0soln_freq\010\0". fields: - status: type: u8 @@ -65,40 +94,53 @@ definitions: type: string desc: | A NULL-terminated and delimited string with contents - [SECTION_SETTING, SETTING, VALUE]. + "SECTION_SETTING\0SETTING\0VALUE\0" - MSG_SETTINGS_READ_REQ: id: 0x00A4 short_desc: Read device configuration settings (host => device) - desc: The setting message reads the device configuration. + desc: | + The setting message that reads the device configuration. The string + field is a NULL-terminated and NULL-delimited string with contents + "SECTION_SETTING\0SETTING\0" where the '\0' escape sequence denotes the + NULL character and where quotation marks are omitted. An example + string that could be sent to a device is "solution\0soln_freq\0". A + device will only respond to this message when it is received from + sender ID 0x42. A device should respond with a MSG_SETTINGS_READ_RESP + message (msg_id 0x00A5). fields: - setting: type: string desc: | - A NULL-terminated and delimited string with contents - [SECTION_SETTING, SETTING]. A device will only respond to - this message when it is received from sender ID 0x42. + A NULL-terminated and NULL-delimited string with contents + "SECTION_SETTING\0SETTING\0" - MSG_SETTINGS_READ_RESP: id: 0x00A5 short_desc: Read device configuration settings (host <= device) - desc: The setting message reads the device configuration. + desc: | + The setting message wich which the device responds after a + MSG_SETTING_READ_REQ is sent to device. The string field is a + NULL-terminated and NULL-delimited string with contents + "SECTION_SETTING\0SETTING\0VALUE\0" where the '\0' escape sequence + denotes the NULL character and where quotation marks are omitted. An + example string that could be sent from device is + "solution\0soln_freq\010\0". fields: - setting: type: string desc: | - A NULL-terminated and delimited string with contents - [SECTION_SETTING, SETTING, VALUE]. + A NULL-terminated and NULL-delimited string with contents + "SECTION_SETTING\0SETTING\0VALUE\0" + - MSG_SETTINGS_READ_BY_INDEX_REQ: id: 0x00A2 short_desc: Read setting by direct index (host => device) desc: | The settings message for iterating through the settings - values. It will read the setting at an index, returning a - NULL-terminated and delimited string with contents - [SECTION_SETTING, SETTING, VALUE]. A device will only respond to - this message when it is received from sender ID 0x42. + values. A device will respond to this message with a + "MSG_SETTINGS_READ_BY_INDEX_RESP". fields: - index: type: u16 @@ -110,10 +152,16 @@ definitions: id: 0x00A7 short_desc: Read setting by direct index (host <= device) desc: | - The settings message for iterating through the settings - values. It will read the setting at an index, returning a - NULL-terminated and delimited string with contents - [SECTION_SETTING, SETTING, VALUE]. + The settings message that reports the value of a setting at an index. + + In the string field, it reports NULL-terminated and delimited string + with contents "SECTION_SETTING\0SETTING\0VALUE\0FORMAT_TYPE\0". where + the '\0' escape sequence denotes the NULL character and where quotation + marks are omitted. The FORMAT_TYPE field is optional and denotes + possible string values of the setting as a hint to the user. If + included, the format type portion of the string has the format + "enum:value1,value2,value3". An example string that could be sent from + the device is "simulator\0enabled\0True\0enum:True,False\0" fields: - index: type: u16 @@ -124,7 +172,7 @@ definitions: type: string desc: | A NULL-terminated and delimited string with contents - [SECTION_SETTING, SETTING, VALUE]. + "SECTION_SETTING\0SETTING\0VALUE\0FORMAT_TYPE\0" - MSG_SETTINGS_READ_BY_INDEX_DONE: id: 0x00A6 @@ -145,5 +193,5 @@ definitions: type: string desc: | A NULL-terminated and delimited string with contents - [SECTION_SETTING, SETTING, VALUE]. + "SECTION_SETTING\0SETTING\0VALUE".