summaryrefslogtreecommitdiff
path: root/SmartDeviceLink/Requests/SDLRPCRequestNotification.m
diff options
context:
space:
mode:
Diffstat (limited to 'SmartDeviceLink/Requests/SDLRPCRequestNotification.m')
-rw-r--r--SmartDeviceLink/Requests/SDLRPCRequestNotification.m49
1 files changed, 49 insertions, 0 deletions
diff --git a/SmartDeviceLink/Requests/SDLRPCRequestNotification.m b/SmartDeviceLink/Requests/SDLRPCRequestNotification.m
new file mode 100644
index 000000000..4ac6250c6
--- /dev/null
+++ b/SmartDeviceLink/Requests/SDLRPCRequestNotification.m
@@ -0,0 +1,49 @@
+//
+// SDLRPCRequestNotification.m
+// SmartDeviceLink
+//
+// Created by Nicole on 2/14/19.
+// Copyright © 2019 smartdevicelink. All rights reserved.
+//
+
+#import "SDLRPCRequestNotification.h"
+
+#import "SDLNotificationConstants.h"
+#import "SDLRPCRequest.h"
+
+NS_ASSUME_NONNULL_BEGIN
+
+@implementation SDLRPCRequestNotification
+
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wimplicit-atomic-properties"
+@synthesize name = _name;
+@synthesize object = _object;
+@synthesize userInfo = _userInfo;
+#pragma clang diagnostic pop
+
+- (instancetype)initWithName:(NSString *)name object:(nullable id)object rpcRequest:(__kindof SDLRPCRequest *)request {
+ _name = name;
+ _object = object;
+ _userInfo = @{SDLNotificationUserInfoObject: request};
+
+ return self;
+}
+
+- (__kindof SDLRPCRequest *)request {
+ return _userInfo[SDLNotificationUserInfoObject];
+}
+
+- (BOOL)isRequestMemberOfClass:(Class)aClass {
+ NSAssert([self.request isMemberOfClass:aClass], @"A notification was sent with an unanticipated object");
+ return [self.request isMemberOfClass:aClass];
+}
+
+- (BOOL)isRequestKindOfClass:(Class)aClass {
+ NSAssert([self.request isKindOfClass:aClass], @"A notification was sent with an unanticipated object");
+ return [self.request isKindOfClass:aClass];
+}
+
+@end
+
+NS_ASSUME_NONNULL_END