diff options
author | Muller, Alexander (A.) <amulle19@ford.com> | 2016-03-15 10:04:45 -0700 |
---|---|---|
committer | Muller, Alexander (A.) <amulle19@ford.com> | 2016-03-15 10:04:45 -0700 |
commit | db5ca2372ac1decb52c6f0b7c56a04c4504eecac (patch) | |
tree | 34f551f1eee1b460a5b795fc61d09aa53517fc0e | |
parent | ac9951db03291299ba465347ffd3a0fe96581c42 (diff) | |
parent | a702ea3b1238503cb4ba58a5e01729f621503148 (diff) | |
download | sdl_ios-db5ca2372ac1decb52c6f0b7c56a04c4504eecac.tar.gz |
Removed ability for in-app sending of heartbeats. Support for heartbeat now only exists as a heartbeat acknowledgement.
-rw-r--r-- | SmartDeviceLink-iOS/SmartDeviceLink/SDLAbstractProtocol.h | 2 | ||||
-rw-r--r-- | SmartDeviceLink-iOS/SmartDeviceLink/SDLProtocol.m | 32 |
2 files changed, 1 insertions, 33 deletions
diff --git a/SmartDeviceLink-iOS/SmartDeviceLink/SDLAbstractProtocol.h b/SmartDeviceLink-iOS/SmartDeviceLink/SDLAbstractProtocol.h index 22608f3d6..01a4c7e9d 100644 --- a/SmartDeviceLink-iOS/SmartDeviceLink/SDLAbstractProtocol.h +++ b/SmartDeviceLink-iOS/SmartDeviceLink/SDLAbstractProtocol.h @@ -20,7 +20,7 @@ - (void)sendEndSessionWithType:(SDLServiceType)serviceType; - (void)sendRPC:(SDLRPCMessage *)message; - (void)sendRPCRequest:(SDLRPCRequest *)rpcRequest __deprecated_msg(("Use sendRPC: instead")); -- (void)sendHeartbeat; +- (void)sendHeartbeat __deprecated_msg("Heartbeat is no longer used."); - (void)sendRawDataStream:(NSInputStream *)inputStream withServiceType:(SDLServiceType)serviceType; - (void)sendRawData:(NSData *)data withServiceType:(SDLServiceType)serviceType; diff --git a/SmartDeviceLink-iOS/SmartDeviceLink/SDLProtocol.m b/SmartDeviceLink-iOS/SmartDeviceLink/SDLProtocol.m index d1b5e15ef..cee0d7791 100644 --- a/SmartDeviceLink-iOS/SmartDeviceLink/SDLProtocol.m +++ b/SmartDeviceLink-iOS/SmartDeviceLink/SDLProtocol.m @@ -34,8 +34,6 @@ @property (assign) UInt8 sessionID; @property (strong) NSMutableData *receiveBuffer; @property (strong) SDLProtocolReceivedMessageRouter *messageRouter; -@property (nonatomic) BOOL heartbeatACKed; -@property (nonatomic, strong) SDLTimer *heartbeatTimer; @end @@ -45,7 +43,6 @@ if (self = [super init]) { _messageID = 0; _sessionID = 0; - _heartbeatACKed = NO; _receiveQueue = dispatch_queue_create("com.sdl.protocol.receive", DISPATCH_QUEUE_SERIAL); _sendQueue = dispatch_queue_create("com.sdl.protocol.transmit", DISPATCH_QUEUE_SERIAL); _prioritizedCollection = [[SDLPrioritizedObjectCollection alloc] init]; @@ -273,23 +270,6 @@ [self sendDataToTransport:message.data withPriority:header.serviceType]; } -- (void)startHeartbeatTimerWithDuration:(float)duration { - self.heartbeatTimer = [[SDLTimer alloc] initWithDuration:duration repeat:YES]; - __weak typeof(self) weakSelf = self; - self.heartbeatTimer.elapsedBlock = ^void() { - __strong typeof(weakSelf) strongSelf = weakSelf; - if (strongSelf.heartbeatACKed) { - strongSelf.heartbeatACKed = NO; - [strongSelf sendHeartbeat]; - } else { - NSString *logMessage = [NSString stringWithFormat:@"Heartbeat ack not received. Goodbye."]; - [SDLDebugTool logInfo:logMessage withType:SDLDebugType_RPC toOutput:SDLDebugOutput_All toGroup:strongSelf.debugConsoleGroupName]; - [strongSelf onProtocolClosed]; - } - }; - [self.heartbeatTimer start]; -} - - (void)sendRawData:(NSData *)data withServiceType:(SDLServiceType)serviceType { SDLV2ProtocolHeader *header = [[SDLV2ProtocolHeader alloc] initWithVersion:[SDLGlobals globals].protocolVersion]; header.frameType = SDLFrameType_Single; @@ -319,10 +299,6 @@ case SDLServiceType_RPC: { self.sessionID = sessionID; [SDLGlobals globals].maxHeadUnitVersion = version; - if ([SDLGlobals globals].protocolVersion >= 3) { - self.heartbeatACKed = YES; // Ensures a first heartbeat is sent - [self startHeartbeatTimerWithDuration:5.0]; - } } break; default: break; @@ -382,8 +358,6 @@ } - (void)handleHeartbeatACK { - self.heartbeatACKed = YES; - for (id<SDLProtocolListener> listener in self.protocolDelegateTable.allObjects) { if ([listener respondsToSelector:@selector(handleHeartbeatACK)]) { [listener handleHeartbeatACK]; @@ -392,11 +366,6 @@ } - (void)onProtocolMessageReceived:(SDLProtocolMessage *)msg { - if ([SDLGlobals globals].protocolVersion >= 3 && self.heartbeatTimer != nil) { - self.heartbeatACKed = YES; // All messages count as heartbeats - [self.heartbeatTimer start]; - } - for (id<SDLProtocolListener> listener in self.protocolDelegateTable.allObjects) { if ([listener respondsToSelector:@selector(onProtocolMessageReceived:)]) { [listener onProtocolMessageReceived:msg]; @@ -438,7 +407,6 @@ self.messageRouter = nil; self.transport = nil; self.protocolDelegateTable = nil; - self.heartbeatTimer = nil; } } |