From 23e46d2de44a3d49063e852a38b020e7407a78bc Mon Sep 17 00:00:00 2001 From: Paul Nettle Date: Sun, 3 Sep 2017 08:15:12 -0500 Subject: The GGK server names are no longer in Globals.h but are now configured by ggkStart() allowing an application to change them based on configuration rather than compilation. Power-off-disconnect errors hacked out of existence. A few log lines that were set to trace converted to debug log levels to reduce logspam. --- src/Mgmt.cpp | 29 +++++++++-------------------- 1 file changed, 9 insertions(+), 20 deletions(-) (limited to 'src/Mgmt.cpp') diff --git a/src/Mgmt.cpp b/src/Mgmt.cpp index c956e99..34537f0 100644 --- a/src/Mgmt.cpp +++ b/src/Mgmt.cpp @@ -139,8 +139,8 @@ Mgmt::ControllerInformation *Mgmt::getControllerInformation() // Set the adapter name and short name // // The inputs `name` and `shortName` may be truncated prior to setting them on the adapter. To ensure that `name` and -// `shortName` conform to length specifications prior to calling this method, see the constants `kMaxNameLength` and -// `kMaxShortNameLength`. In addition, the static methods `truncateName()` and `truncateShortName()` may be helpful. +// `shortName` conform to length specifications prior to calling this method, see the constants `kMaxAdvertisingNameLength` and +// `kMaxAdvertisingShortNameLength`. In addition, the static methods `truncateName()` and `truncateShortName()` may be helpful. // // Returns true on success, otherwise false bool Mgmt::setName(std::string name, std::string shortName) @@ -179,7 +179,7 @@ bool Mgmt::setName(std::string name, std::string shortName) return false; } - Logger::trace(SSTR << " + Name set to '" << request.name << "', short name set to '" << request.shortName << "'"); + Logger::info(SSTR << " + Name set to '" << request.name << "', short name set to '" << request.shortName << "'"); return true; } @@ -214,24 +214,13 @@ bool Mgmt::setState(const char *pSettingName, uint16_t commandCode, uint16_t con SResponse response; if (!hciAdapter.sendCommand(request, response, sizeof(response))) { - // Setting power to 0 doesn't actually return a response event if it's connected (it receives a disconnect instead). - // - // This is a failure on the part of GGK because it should be handling events more correctly. For now, though, we'll just - // turn those failures into debug log messages so our logs aren't cluttered up with false failures. - if (commandCode == 0x0005) - { - Logger::debug(SSTR << " + Failed to set " << pSettingName << " state to: " << static_cast(newState)); - } - else - { - Logger::info(SSTR << " + Failed to set " << pSettingName << " state to: " << static_cast(newState)); - } + Logger::warn(SSTR << " + Failed to set " << pSettingName << " state to: " << static_cast(newState)); return false; } response.toHost(); - Logger::trace(SSTR << " + " << pSettingName << " set to " << static_cast(newState) << ": " << controllerSettingsString(response.currentSettings)); + Logger::debug(SSTR << " + " << pSettingName << " set to " << static_cast(newState) << ": " << controllerSettingsString(response.currentSettings)); return true; } @@ -331,24 +320,24 @@ std::string Mgmt::controllerSettingsString(uint32_t bits) // `name` is returned. std::string Mgmt::truncateName(const std::string &name) { - if (name.length() <= kMaxNameLength) + if (name.length() <= kMaxAdvertisingNameLength) { return name; } - return name.substr(0, kMaxNameLength); + return name.substr(0, kMaxAdvertisingNameLength); } // Truncates the string `name` to the maximum allowed length for an adapter short-name. If `name` needs no truncation, a copy // of `name` is returned. std::string Mgmt::truncateShortName(const std::string &name) { - if (name.length() <= kMaxShortNameLength) + if (name.length() <= kMaxAdvertisingShortNameLength) { return name; } - return name.substr(0, kMaxShortNameLength); + return name.substr(0, kMaxAdvertisingShortNameLength); } }; // namespace ggk \ No newline at end of file -- cgit v1.2.3