diff options
author | Justin Gluck <justin.gluck@livio.io> | 2019-09-25 15:35:38 -0400 |
---|---|---|
committer | Justin Gluck <justin.gluck@livio.io> | 2019-09-25 15:35:38 -0400 |
commit | e444d578896e8060f5cdcf063d0163120c562a77 (patch) | |
tree | 9b5d4fa1c423c7088df2bf71d81257e8635c11a7 | |
parent | b962a21d9d2e6901a8461c00dc2773a422904cf4 (diff) | |
download | sdl_ios-e444d578896e8060f5cdcf063d0163120c562a77.tar.gz |
adding check for 4.5
-rw-r--r-- | SmartDeviceLink/SDLStreamingVideoLifecycleManager.m | 8 | ||||
-rw-r--r-- | SmartDeviceLinkTests/DevAPISpecs/SDLStreamingVideoLifecycleManagerSpec.m | 34 |
2 files changed, 40 insertions, 2 deletions
diff --git a/SmartDeviceLink/SDLStreamingVideoLifecycleManager.m b/SmartDeviceLink/SDLStreamingVideoLifecycleManager.m index 96139b93e..3296829c1 100644 --- a/SmartDeviceLink/SDLStreamingVideoLifecycleManager.m +++ b/SmartDeviceLink/SDLStreamingVideoLifecycleManager.m @@ -44,6 +44,7 @@ #import "SDLVehicleType.h" #import "SDLVideoEncoderDelegate.h" #import "SDLVideoStreamingCapability.h" +#import "SDLVersion.h" static NSUInteger const FramesToSendOnBackground = 30; @@ -563,9 +564,12 @@ typedef void(^SDLVideoCapabilityResponseHandler)(SDLVideoStreamingCapability *_N SDLLogV(@"Determining whether streaming is supported"); #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated" - _streamingSupported = registerResponse.hmiCapabilities.videoStreaming ? registerResponse.hmiCapabilities.videoStreaming.boolValue : registerResponse.displayCapabilities.graphicSupported.boolValue; + if ([SDLGlobals.sharedGlobals.rpcVersion isGreaterThanOrEqualToVersion:[[SDLVersion alloc] initWithMajor:4 minor:5 patch:0]]) { + _streamingSupported = registerResponse.hmiCapabilities.videoStreaming ? registerResponse.hmiCapabilities.videoStreaming.boolValue : registerResponse.displayCapabilities.graphicSupported.boolValue; + } else { + _streamingSupported = YES; + } #pragma clang diagnostic pop - if (!self.isStreamingSupported) { SDLLogE(@"Graphics are not supported on this head unit. We are are assuming screen size is also unavailable and exiting."); return; diff --git a/SmartDeviceLinkTests/DevAPISpecs/SDLStreamingVideoLifecycleManagerSpec.m b/SmartDeviceLinkTests/DevAPISpecs/SDLStreamingVideoLifecycleManagerSpec.m index d557ce52c..9e57c4995 100644 --- a/SmartDeviceLinkTests/DevAPISpecs/SDLStreamingVideoLifecycleManagerSpec.m +++ b/SmartDeviceLinkTests/DevAPISpecs/SDLStreamingVideoLifecycleManagerSpec.m @@ -36,6 +36,7 @@ #import "SDLVideoStreamingCapability.h" #import "SDLVideoStreamingState.h" #import "TestConnectionManager.h" +#import "SDLVersion.h" @interface SDLStreamingVideoLifecycleManager () @property (copy, nonatomic, readonly) NSString *appName; @@ -149,6 +150,10 @@ describe(@"the streaming video manager", ^{ someDisplayCapabilities.screenParams = someScreenParams; + SDLVersion *oldVersion = [SDLVersion versionWithMajor:6 minor:0 patch:0]; + id globalMock = OCMPartialMock([SDLGlobals sharedGlobals]); + OCMStub([globalMock rpcVersion]).andReturn(oldVersion); + someRegisterAppInterfaceResponse = [[SDLRegisterAppInterfaceResponse alloc] init]; #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated" @@ -172,6 +177,10 @@ describe(@"the streaming video manager", ^{ someDisplayCapabilities.screenParams = someScreenParams; + SDLVersion *oldVersion = [SDLVersion versionWithMajor:6 minor:0 patch:0]; + id globalMock = OCMPartialMock([SDLGlobals sharedGlobals]); + OCMStub([globalMock rpcVersion]).andReturn(oldVersion); + someRegisterAppInterfaceResponse = [[SDLRegisterAppInterfaceResponse alloc] init]; #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated" @@ -188,6 +197,31 @@ describe(@"the streaming video manager", ^{ expect(@(CGSizeEqualToSize(streamingLifecycleManager.screenSize, CGSizeMake(600, 100)))).to(equal(@YES)); }); }); + + context(@"version is less then 4.5.0", ^{ + beforeEach(^{ + someDisplayCapabilities = [[SDLDisplayCapabilities alloc] init]; + someDisplayCapabilities.screenParams = someScreenParams; + + SDLVersion *oldVersion = [SDLVersion versionWithMajor:4 minor:0 patch:0]; + id globalMock = OCMPartialMock([SDLGlobals sharedGlobals]); + OCMStub([globalMock rpcVersion]).andReturn(oldVersion); + + someRegisterAppInterfaceResponse = [[SDLRegisterAppInterfaceResponse alloc] init]; +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated" + someRegisterAppInterfaceResponse.displayCapabilities = someDisplayCapabilities; +#pragma clang diagnostic pop + SDLRPCResponseNotification *notification = [[SDLRPCResponseNotification alloc] initWithName:SDLDidReceiveRegisterAppInterfaceResponse object:self rpcResponse:someRegisterAppInterfaceResponse]; + + [[NSNotificationCenter defaultCenter] postNotification:notification]; + [NSThread sleepForTimeInterval:0.1]; + }); + + it(@"should support streaming", ^{ + expect(@(streamingLifecycleManager.isStreamingSupported)).to(equal(@YES)); + }); + }); }); describe(@"if the app state is active", ^{ |