/** * Parse the BlueFly Vario parameter values. * Sent Upon a BST request. */ bool BlueFlyDevice::ParseSET(const char *content, NMEAInfo &info) { // e.g. SET 0 100 20 1 1 1 180 1000 100 400 100 20 5 5 100 50 0 10 21325 207 1 0 1 34 const char *values, *token; unsigned long value; if (!settings.version || !settings_keys) /* we did not receive the previous BFV and BST, abort */ return true; token = StringToken(settings_keys, " "); values = content; /* the first value should be ignored */ if (!ParseUlong(&values, value)) return true; mutex_settings.Lock(); while (token && ParseUlong(&values, value)) { settings.Parse(token, value); token = StringToken(nullptr, " "); } settings_ready = true; settings_cond.broadcast(); mutex_settings.Unlock(); return true; }
/** * Parse the BlueFly Vario parameter values. * Sent Upon a BST request. */ bool BlueFlyDevice::ParseSET(const char *content, NMEAInfo &info) { // e.g. SET 0 100 20 1 1 1 180 1000 100 400 100 20 5 5 100 50 0 10 21325 207 1 0 1 34 const char *values; unsigned long value; if (!settings.version || !settings_keys) /* we did not receive the previous BFV and BST, abort */ return true; values = content; /* the first value should be ignored */ if (!ParseUlong(&values, value)) return true; { ScopeLock lock(mutex_settings); for (const auto token : IterableSplitString(settings_keys, ' ')) { if (!ParseUlong(&values, value)) break; settings.Parse(token, value); } settings_ready = true; settings_cond.broadcast(); } return true; }
/** * Parse the BlueFly Vario version. * Sent Upon a BST request. */ bool BlueFlyDevice::ParseBFV(const char *content, NMEAInfo &info) { // e.g. BFV 9 unsigned long value; if (ParseUlong(&content, value)) { assert(value <= UINT_MAX); settings.version = value; } return true; }