diff options
author | Frank Elias <francois.elias@livio.io> | 2021-08-27 11:22:17 -0400 |
---|---|---|
committer | Frank Elias <francois.elias@livio.io> | 2021-08-27 11:22:17 -0400 |
commit | 25da2498bb782ddf443cef27a9e4571bdb45dcd4 (patch) | |
tree | d17b3624c0bff56ccf5b0cf4924b61b103107f78 | |
parent | 415c24d2a5576eafc93652d507b171ab6220f0fb (diff) | |
download | sdl_ios-25da2498bb782ddf443cef27a9e4571bdb45dcd4.tar.gz |
SDLSecurityQueryErrorCode update
-rw-r--r-- | SmartDeviceLink/private/SDLProtocol.m | 6 | ||||
-rw-r--r-- | SmartDeviceLink/public/SDLSecurityQueryErrorCode.h | 2 | ||||
-rw-r--r-- | SmartDeviceLink/public/SDLSecurityQueryErrorCode.m | 36 |
3 files changed, 20 insertions, 24 deletions
diff --git a/SmartDeviceLink/private/SDLProtocol.m b/SmartDeviceLink/private/SDLProtocol.m index 8de25e21e..ffaff752d 100644 --- a/SmartDeviceLink/private/SDLProtocol.m +++ b/SmartDeviceLink/private/SDLProtocol.m @@ -791,7 +791,7 @@ NS_ASSUME_NONNULL_BEGIN SDLLogE(@"Error decoding client security query response JSON: %@", jsonDecodeError); } else { if (securityQueryErrorDictionary[@"text"] != nil) { - SDLSecurityQueryErrorCode errorCodeString = [SDLSecurityQueryError sdl_parseClientInternalError:securityQueryErrorDictionary[@"id"]]; + SDLSecurityQueryErrorCode errorCodeString = [SDLSecurityQueryError convertErrorIdToStringEnum:securityQueryErrorDictionary[@"id"]]; SDLLogE(@"Security Query client internal error: %@, code: %@", securityQueryErrorDictionary[@"text"], errorCodeString); } else { SDLLogE(@"Security Query client error: No information provided"); @@ -841,7 +841,7 @@ NS_ASSUME_NONNULL_BEGIN serverTLSPayload.sequenceNumber = 0x00; serverTLSPayload.binaryData = data; - NSData *binaryData = serverTLSPayload.data; + NSData *binaryData = serverTLSPayload.convertToData; return [SDLProtocolMessage messageWithHeader:serverMessageHeader andPayload:binaryData]; } @@ -862,7 +862,7 @@ NS_ASSUME_NONNULL_BEGIN serverTLSPayload.queryType = SDLSecurityQueryTypeNotification; serverTLSPayload.sequenceNumber = 0x00; - NSData *binaryData = serverTLSPayload.data; + NSData *binaryData = serverTLSPayload.convertToData; // TODO: (Joel F.)[2016-02-15] This is supposed to have some JSON data and json data size return [SDLProtocolMessage messageWithHeader:serverMessageHeader andPayload:binaryData]; diff --git a/SmartDeviceLink/public/SDLSecurityQueryErrorCode.h b/SmartDeviceLink/public/SDLSecurityQueryErrorCode.h index 28d7d836b..7f516c7d3 100644 --- a/SmartDeviceLink/public/SDLSecurityQueryErrorCode.h +++ b/SmartDeviceLink/public/SDLSecurityQueryErrorCode.h @@ -58,6 +58,6 @@ extern SDLSecurityQueryErrorCode const SDLSecurityQueryErrorCodeUnknownInternalE /** Compare the internal error ID with the App's security query error codes */ -+ (SDLSecurityQueryErrorCode)sdl_parseClientInternalError:(NSNumber *)errorId; ++ (SDLSecurityQueryErrorCode)convertErrorIdToStringEnum:(NSNumber *)errorId; @end diff --git a/SmartDeviceLink/public/SDLSecurityQueryErrorCode.m b/SmartDeviceLink/public/SDLSecurityQueryErrorCode.m index c07ffd94a..a1a55ea6c 100644 --- a/SmartDeviceLink/public/SDLSecurityQueryErrorCode.m +++ b/SmartDeviceLink/public/SDLSecurityQueryErrorCode.m @@ -26,27 +26,23 @@ SDLSecurityQueryErrorCode const SDLSecurityQueryErrorCodeUnknownInternalError = @implementation SDLSecurityQueryError -+ (SDLSecurityQueryErrorCode)sdl_parseClientInternalError:(NSNumber *)errorId { - NSDictionary *errorCodesDict = @{@0x00: SDLSecurityQueryErrorCodeSuccess, - @0x01: SDLSecurityQueryErrorCodeInvalidQuerySize, - @0x02: SDLSecurityQueryErrorCodeInvalidQueryID, - @0x03: SDLSecurityQueryErrorCodeNotSupported, - @0x04: SDLSecurityQueryErrorCodeServiceAlreadyProtected, - @0x05: SDLSecurityQueryErrorCodeServiceNotProtected, - @0x06: SDLSecurityQueryErrorCodeDecryptionFailed, - @0x07: SDLSecurityQueryErrorCodeEncryptionFailed, - @0x08: SDLSecurityQueryErrorCodeSSLInvalidData, - @0x09: SDLSecurityQueryErrorCodeHandshakeFailed, - @0x0A: SDLSecurityQueryErrorCodeInvalidCertificate, - @0x0B: SDLSecurityQueryErrorCodeExpiredCertificate, - @0xFF: SDLSecurityQueryErrorCodeInternal, - @0xFE: SDLSecurityQueryErrorCodeUnknownInternalError, - }; - if ([errorCodesDict objectForKey:errorId]) { - return errorCodesDict[errorId]; ++ (SDLSecurityQueryErrorCode)convertErrorIdToStringEnum:(NSNumber *)errorId { + switch (errorId.unsignedIntegerValue) { + case 0x00: return SDLSecurityQueryErrorCodeSuccess; + case 0x01: return SDLSecurityQueryErrorCodeInvalidQuerySize; + case 0x02: return SDLSecurityQueryErrorCodeInvalidQueryID; + case 0x03: return SDLSecurityQueryErrorCodeNotSupported; + case 0x04: return SDLSecurityQueryErrorCodeServiceAlreadyProtected; + case 0x05: return SDLSecurityQueryErrorCodeServiceNotProtected; + case 0x06: return SDLSecurityQueryErrorCodeDecryptionFailed; + case 0x07: return SDLSecurityQueryErrorCodeEncryptionFailed; + case 0x08: return SDLSecurityQueryErrorCodeSSLInvalidData; + case 0x09: return SDLSecurityQueryErrorCodeHandshakeFailed; + case 0x0A: return SDLSecurityQueryErrorCodeInvalidCertificate; + case 0x0B: return SDLSecurityQueryErrorCodeExpiredCertificate; + case 0xFF: return SDLSecurityQueryErrorCodeInternal; + default: return SDLSecurityQueryErrorCodeUnknownInternalError; } - - return SDLSecurityQueryErrorCodeUnknownInternalError; } @end |