summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Fischer <joeljfischer@gmail.com>2017-03-30 15:38:57 -0400
committerJoel Fischer <joeljfischer@gmail.com>2017-03-30 15:38:57 -0400
commit0eafa485ca53512033a1a450c8d047f8c516b792 (patch)
treec30930b6ec9bc76388e014b9b8be052fe3c000d7
parented66dfda70cf413c783d11e104f8873d5425036f (diff)
downloadsdl_ios-feature/issue_585_audio_pass_thru_handler.tar.gz
-rw-r--r--SmartDeviceLink/SDLPerformAudioPassThru.h2
-rw-r--r--SmartDeviceLink/SDLPerformAudioPassThru.m2
-rw-r--r--SmartDeviceLink/SDLResponseDispatcher.h3
-rw-r--r--SmartDeviceLink/SDLResponseDispatcher.m12
-rw-r--r--SmartDeviceLinkTests/DevAPISpecs/SDLResponseDispatcherSpec.m1
5 files changed, 12 insertions, 8 deletions
diff --git a/SmartDeviceLink/SDLPerformAudioPassThru.h b/SmartDeviceLink/SDLPerformAudioPassThru.h
index 985e4ac3d..9f550fe6a 100644
--- a/SmartDeviceLink/SDLPerformAudioPassThru.h
+++ b/SmartDeviceLink/SDLPerformAudioPassThru.h
@@ -106,7 +106,7 @@ NS_ASSUME_NONNULL_BEGIN
/**
* A handler that will be called whenever an `onAudioPassThru` notification is received.
*/
-@property (copy, nonatomic, nullable) SDLAudioPassThruHandler audioDataHandler;
+@property (strong, nonatomic, nullable) SDLAudioPassThruHandler audioDataHandler;
@end
diff --git a/SmartDeviceLink/SDLPerformAudioPassThru.m b/SmartDeviceLink/SDLPerformAudioPassThru.m
index 0af59e83d..f2bbbdf10 100644
--- a/SmartDeviceLink/SDLPerformAudioPassThru.m
+++ b/SmartDeviceLink/SDLPerformAudioPassThru.m
@@ -50,7 +50,7 @@ NS_ASSUME_NONNULL_BEGIN
self.bitsPerSample = bitsPerSample;
self.audioType = audioType;
self.maxDuration = @(maxDuration);
- self.audioDataHandler = [audioDataHandler copy];
+ self.audioDataHandler = audioDataHandler;
return self;
}
diff --git a/SmartDeviceLink/SDLResponseDispatcher.h b/SmartDeviceLink/SDLResponseDispatcher.h
index 3e746a75e..dae3e64a2 100644
--- a/SmartDeviceLink/SDLResponseDispatcher.h
+++ b/SmartDeviceLink/SDLResponseDispatcher.h
@@ -53,8 +53,7 @@ NS_ASSUME_NONNULL_BEGIN
/**
* Holds an audio pass thru block.
*/
-@property (copy, nonatomic, readonly, nullable) SDLAudioPassThruHandler audioPassThruHandler;
-
+@property (strong, nonatomic, readonly, nullable) SDLAudioPassThruHandler audioPassThruHandler;
/**
* Create a new response dispatcher.
diff --git a/SmartDeviceLink/SDLResponseDispatcher.m b/SmartDeviceLink/SDLResponseDispatcher.m
index c54d601ef..f8b4cc800 100644
--- a/SmartDeviceLink/SDLResponseDispatcher.m
+++ b/SmartDeviceLink/SDLResponseDispatcher.m
@@ -35,6 +35,13 @@
NS_ASSUME_NONNULL_BEGIN
+@interface SDLResponseDispatcher ()
+
+@property (strong, nonatomic, readwrite, nullable) SDLAudioPassThruHandler audioPassThruHandler;
+
+@end
+
+
@implementation SDLResponseDispatcher
- (instancetype)init {
@@ -108,7 +115,7 @@ NS_ASSUME_NONNULL_BEGIN
[self sdl_addToCustomButtonHandlerMap:show.softButtons];
} else if ([request isKindOfClass:[SDLPerformAudioPassThru class]]) {
SDLPerformAudioPassThru *performAudioPassThru = (SDLPerformAudioPassThru *)request;
- _audioPassThruHandler = [performAudioPassThru.audioDataHandler copy];
+ self.audioPassThruHandler = performAudioPassThru.audioDataHandler;
}
// Always store the request, it's needed in some cases whether or not there was a handler (e.g. DeleteCommand).
@@ -170,8 +177,7 @@ NS_ASSUME_NONNULL_BEGIN
return;
}
- // If it's a DeleteCommand or UnsubscribeButton, we need to remove handlers for the corresponding commands / buttons
- // If it's a PerformAudioPassThru, we can also remove it.
+ // If it's a DeleteCommand, UnsubscribeButton, or PerformAudioPassThru we need to remove handlers for the corresponding RPCs
if ([response isKindOfClass:[SDLDeleteCommandResponse class]]) {
SDLDeleteCommand *deleteCommandRequest = (SDLDeleteCommand *)request;
NSNumber *deleteCommandId = deleteCommandRequest.cmdID;
diff --git a/SmartDeviceLinkTests/DevAPISpecs/SDLResponseDispatcherSpec.m b/SmartDeviceLinkTests/DevAPISpecs/SDLResponseDispatcherSpec.m
index 49d4eb161..f7f04f2ce 100644
--- a/SmartDeviceLinkTests/DevAPISpecs/SDLResponseDispatcherSpec.m
+++ b/SmartDeviceLinkTests/DevAPISpecs/SDLResponseDispatcherSpec.m
@@ -711,7 +711,6 @@ describe(@"a response dispatcher", ^{
});
it(@"should store the handler" ,^{
-
expect(testDispatcher.audioPassThruHandler).toNot(beNil());
expect(testDispatcher.audioPassThruHandler).to(equal(testPerformAudioPassThru.audioDataHandler));
});