summaryrefslogtreecommitdiff
path: root/SmartDeviceLink/SDLRPCRequestNotification.m
blob: 4ac6250c6f9b15657e9b953cb4cef7805034f464 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
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