summaryrefslogtreecommitdiff
path: root/SmartDeviceLink/private/SDLProtocolHeader.m
diff options
context:
space:
mode:
Diffstat (limited to 'SmartDeviceLink/private/SDLProtocolHeader.m')
-rw-r--r--SmartDeviceLink/private/SDLProtocolHeader.m13
1 files changed, 13 insertions, 0 deletions
diff --git a/SmartDeviceLink/private/SDLProtocolHeader.m b/SmartDeviceLink/private/SDLProtocolHeader.m
index afe93724d..2eb4f16d2 100644
--- a/SmartDeviceLink/private/SDLProtocolHeader.m
+++ b/SmartDeviceLink/private/SDLProtocolHeader.m
@@ -3,8 +3,10 @@
#import "SDLProtocolHeader.h"
+
#import "SDLV1ProtocolHeader.h"
#import "SDLV2ProtocolHeader.h"
+#import "SDLMacros.h"
NS_ASSUME_NONNULL_BEGIN
@@ -41,6 +43,17 @@ NS_ASSUME_NONNULL_BEGIN
return description;
}
+- (NSUInteger)hash {
+ return NSUIntRotateCell(self.version, NSUIntBitCell / 2)
+ ^ NSUIntRotateCell(self.size, NSUIntBitCell / 3)
+ ^ NSUIntRotateCell(self.encrypted, NSUIntBitCell / 4)
+ ^ NSUIntRotateCell(self.frameType, NSUIntBitCell / 5)
+ ^ NSUIntRotateCell(self.serviceType, NSUIntBitCell / 6)
+ ^ NSUIntRotateCell(self.frameData, NSUIntBitCell / 7)
+ ^ NSUIntRotateCell(self.sessionID, NSUIntBitCell / 8)
+ ^ NSUIntRotateCell(self.bytesInPayload, NSUIntBitCell / 9);
+}
+
+ (__kindof SDLProtocolHeader *)headerForVersion:(UInt8)version {
// VERSION DEPENDENT CODE
switch (version) {