diff options
author | Sven Gothel <[email protected]> | 2020-09-14 22:03:50 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2020-09-14 22:03:50 +0200 |
commit | c4286d1ff5798ca9ad7a7c52a35b01688d7283bf (patch) | |
tree | 4248b6b7ede6f2bf86f36fde12fc3120933e23ed /api | |
parent | 022ba274e0cf9f01ea356f67509def21e1d8edc2 (diff) |
C++ noexcept: HCITypes and MgmtTypes
Diffstat (limited to 'api')
-rw-r--r-- | api/direct_bt/HCITypes.hpp | 20 | ||||
-rw-r--r-- | api/direct_bt/MgmtTypes.hpp | 22 |
2 files changed, 21 insertions, 21 deletions
diff --git a/api/direct_bt/HCITypes.hpp b/api/direct_bt/HCITypes.hpp index 7581e6b9..d510677f 100644 --- a/api/direct_bt/HCITypes.hpp +++ b/api/direct_bt/HCITypes.hpp @@ -459,10 +459,10 @@ namespace direct_bt { } } - virtual std::string baseString() const { + virtual std::string baseString() const noexcept { return "opcode="+uint16HexString(number(getOpcode()))+" "+getOpcodeString(); } - virtual std::string valueString() const { + virtual std::string valueString() const noexcept { const int psz = getParamSize(); const std::string ps = psz > 0 ? bytesHexString(getParam(), 0, psz, true /* lsbFirst */, true /* leading0X */) : ""; return "param[size "+std::to_string(getParamSize())+", data "+ps+"], tsz "+std::to_string(getTotalSize()); @@ -496,7 +496,7 @@ namespace direct_bt { uint8_t getParamSize() const noexcept { return pdu.get_uint8_nc(3); } const uint8_t* getParam() const noexcept { return pdu.get_ptr_nc(number(HCIConstU8::COMMAND_HDR_SIZE)); } - std::string toString() const { + std::string toString() const noexcept { return "HCICommand["+baseString()+", "+valueString()+"]"; } }; @@ -576,10 +576,10 @@ namespace direct_bt { } } - virtual std::string baseString() const { + virtual std::string baseString() const noexcept { return "event="+uint8HexString(number(getEventType()))+" "+getEventTypeString(); } - virtual std::string valueString() const { + virtual std::string valueString() const noexcept { const int d_sz_base = getBaseParamSize(); const int d_sz = getParamSize(); const std::string d_str = d_sz > 0 ? bytesHexString(getParam(), 0, d_sz, true /* lsbFirst */, true /* leading0X */) : ""; @@ -648,7 +648,7 @@ namespace direct_bt { virtual bool validate(const HCICommand & cmd) const noexcept { (void)cmd; return true; } - std::string toString() const { + std::string toString() const noexcept { return "HCIEvent["+baseString()+", "+valueString()+"]"; } }; @@ -699,7 +699,7 @@ namespace direct_bt { class HCIDisconnectionCompleteEvent : public HCIEvent { protected: - std::string baseString() const override { + std::string baseString() const noexcept override { return HCIEvent::baseString()+ ", status "+uint8HexString(static_cast<uint8_t>(getStatus()), true)+" "+getHCIStatusCodeString(getStatus())+ ", handle "+uint16HexString(getHandle())+ @@ -734,7 +734,7 @@ namespace direct_bt { class HCICommandCompleteEvent : public HCIEvent { protected: - std::string baseString() const override { + std::string baseString() const noexcept override { return HCIEvent::baseString()+", opcode="+uint16HexString(static_cast<uint16_t>(getOpcode()))+ " "+getHCIOpcodeString(getOpcode())+ ", ncmd "+std::to_string(getNumCommandPackets()); @@ -787,7 +787,7 @@ namespace direct_bt { class HCICommandStatusEvent : public HCIEvent { protected: - std::string baseString() const override { + std::string baseString() const noexcept override { return HCIEvent::baseString()+", opcode="+uint16HexString(static_cast<uint16_t>(getOpcode()))+ " "+getHCIOpcodeString(getOpcode())+ ", ncmd "+std::to_string(getNumCommandPackets())+ @@ -839,7 +839,7 @@ namespace direct_bt { } } - virtual std::string baseString() const override { + virtual std::string baseString() const noexcept override { return "event="+uint8HexString(number(getMetaEventType()))+" "+getMetaEventTypeString()+" (le-meta)"; } diff --git a/api/direct_bt/MgmtTypes.hpp b/api/direct_bt/MgmtTypes.hpp index fa7c7306..0f32afd6 100644 --- a/api/direct_bt/MgmtTypes.hpp +++ b/api/direct_bt/MgmtTypes.hpp @@ -191,10 +191,10 @@ namespace direct_bt { } } - virtual std::string baseString() const { + virtual std::string baseString() const noexcept { return "opcode="+uint16HexString(static_cast<uint16_t>(getOpcode()))+" "+getOpcodeString()+", devID "+uint16HexString(getDevID()); } - virtual std::string valueString() const { + virtual std::string valueString() const noexcept { const int psz = getParamSize(); const std::string ps = psz > 0 ? bytesHexString(getParam(), 0, psz, true /* lsbFirst */, true /* leading0X */) : ""; return "param[size "+std::to_string(getParamSize())+", data "+ps+"], tsz "+std::to_string(getTotalSize()); @@ -231,7 +231,7 @@ namespace direct_bt { uint16_t getParamSize() const noexcept { return pdu.get_uint16_nc(4); } const uint8_t* getParam() const noexcept { return pdu.get_ptr_nc(MGMT_HEADER_SIZE); } - std::string toString() const { + std::string toString() const noexcept { return "MgmtReq["+baseString()+", "+valueString()+"]"; } }; @@ -253,7 +253,7 @@ namespace direct_bt { class MgmtDisconnectCmd : public MgmtCommand { protected: - std::string valueString() const override { + std::string valueString() const noexcept override { const std::string ps = "address "+getAddress().toString()+", addressType "+getBDAddressTypeString(getAddressType()); return "param[size "+std::to_string(getParamSize())+", data["+ps+"]], tsz "+std::to_string(getTotalSize()); } @@ -275,7 +275,7 @@ namespace direct_bt { class MgmtGetConnectionInfoCmd : public MgmtCommand { protected: - std::string valueString() const override { + std::string valueString() const noexcept override { const std::string ps = "address "+getAddress().toString()+", addressType "+getBDAddressTypeString(getAddressType()); return "param[size "+std::to_string(getParamSize())+", data["+ps+"]], tsz "+std::to_string(getTotalSize()); } @@ -299,7 +299,7 @@ namespace direct_bt { class MgmtPinCodeReplyCmd : public MgmtCommand { protected: - std::string valueString() const override { + std::string valueString() const noexcept override { const std::string ps = "address "+getAddress().toString()+", addressType "+getBDAddressTypeString(getAddressType())+ ", pin "+getPinCode().toString(); return "param[size "+std::to_string(getParamSize())+", data["+ps+"]], tsz "+std::to_string(getTotalSize()); @@ -327,7 +327,7 @@ namespace direct_bt { class MgmtPinCodeNegativeReplyCmd : public MgmtCommand { protected: - std::string valueString() const override { + std::string valueString() const noexcept override { const std::string ps = "address "+getAddress().toString()+", addressType "+getBDAddressTypeString(getAddressType()); return "param[size "+std::to_string(getParamSize())+", data["+ps+"]], tsz "+std::to_string(getTotalSize()); } @@ -350,7 +350,7 @@ namespace direct_bt { class MgmtAddDeviceToWhitelistCmd : public MgmtCommand { protected: - std::string valueString() const override { + std::string valueString() const noexcept override { const std::string ps = "address "+getAddress().toString()+", addressType "+getBDAddressTypeString(getAddressType())+ ", connectionType "+std::to_string(static_cast<uint8_t>(getConnectionType())); return "param[size "+std::to_string(getParamSize())+", data["+ps+"]], tsz "+std::to_string(getTotalSize()); @@ -375,7 +375,7 @@ namespace direct_bt { class MgmtRemoveDeviceFromWhitelistCmd : public MgmtCommand { protected: - std::string valueString() const override { + std::string valueString() const noexcept override { const std::string ps = "address "+getAddress().toString()+", addressType "+getBDAddressTypeString(getAddressType()); return "param[size "+std::to_string(getParamSize())+", data["+ps+"]], tsz "+std::to_string(getTotalSize()); } @@ -398,7 +398,7 @@ namespace direct_bt { class MgmtSetLocalNameCmd : public MgmtCommand { protected: - std::string valueString() const override { + std::string valueString() const noexcept override { const std::string ps = "name '"+getName()+"', shortName '"+getShortName()+"'"; return "param[size "+std::to_string(getParamSize())+", data["+ps+"]], tsz "+std::to_string(getTotalSize()); } @@ -448,7 +448,7 @@ namespace direct_bt { } protected: - std::string valueString() const override { + std::string valueString() const noexcept override { const int paramCount = getParamCount(); std::string ps = "count "+std::to_string(paramCount)+": "; for(int i=0; i<paramCount; i++) { |