diff options
Diffstat (limited to 'SmartDeviceLink/SDLLifecycleManager.h')
-rw-r--r-- | SmartDeviceLink/SDLLifecycleManager.h | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/SmartDeviceLink/SDLLifecycleManager.h b/SmartDeviceLink/SDLLifecycleManager.h index 65943d8d2..b37541688 100644 --- a/SmartDeviceLink/SDLLifecycleManager.h +++ b/SmartDeviceLink/SDLLifecycleManager.h @@ -50,7 +50,9 @@ extern SDLLifecycleState *const SDLLifecycleStateSettingUpHMI; extern SDLLifecycleState *const SDLLifecycleStateUnregistering; extern SDLLifecycleState *const SDLLifecycleStateReady; - +typedef void (^SDLMultipleRequestCompletionHandler)(BOOL success); +typedef BOOL (^SDLMultipleSequentialRequestProgressHandler)(__kindof SDLRPCRequest *request, __kindof SDLRPCResponse *__nullable response, NSError *__nullable error, float percentComplete); +typedef void (^SDLMultipleAsyncRequestProgressHandler)(__kindof SDLRPCRequest *request, __kindof SDLRPCResponse *__nullable response, NSError *__nullable error, float percentComplete); typedef void (^SDLManagerReadyBlock)(BOOL success, NSError *_Nullable error); @@ -81,6 +83,8 @@ typedef void (^SDLManagerReadyBlock)(BOOL success, NSError *_Nullable error); @property (copy, nonatomic, nullable) SDLSystemContext systemContext; @property (strong, nonatomic, nullable) SDLRegisterAppInterfaceResponse *registerResponse; +@property (strong, nonatomic) NSOperationQueue *rpcOperationQueue; + #pragma mark Lifecycle /** @@ -123,6 +127,24 @@ typedef void (^SDLManagerReadyBlock)(BOOL success, NSError *_Nullable error); */ - (void)sendRequest:(SDLRPCRequest *)request withResponseHandler:(nullable SDLResponseHandler)handler; +/** + Send all of the requests given as quickly as possible, but in order. Call the completionHandler after all requests have either failed or given a response. + + @param requests The requests to be sent + @param progressHandler A handler called every time a response is received. + @param completionHandler A handler to call when all requests have been responded to + */ +- (void)sendRequests:(NSArray<SDLRPCRequest *> *)requests progressHandler:(nullable SDLMultipleAsyncRequestProgressHandler)progressHandler completionHandler:(nullable SDLMultipleRequestCompletionHandler)completionHandler; + +/** + Send all of the requests one at a time, with the next one going out only after the previous one has received a response. Call the completionHandler after all requests have either failed or given a response. + + @param requests The requests to be sent + @param progressHandler A handler called every time a response is received + @param completionHandler A handler to call when all requests have been responded to + */ +- (void)sendSequentialRequests:(NSArray<SDLRPCRequest *> *)requests progressHandler:(nullable SDLMultipleSequentialRequestProgressHandler)progressHandler completionHandler:(nullable SDLMultipleRequestCompletionHandler)completionHandler; + @end NS_ASSUME_NONNULL_END |