summaryrefslogtreecommitdiff
path: root/SmartDeviceLink/SDLFunctionID.m
blob: f96bc83c601bb8284dd51feac247ecaf8c055d59 (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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
//  SDLFunctionID.m
//


#import "SDLFunctionID.h"

NS_ASSUME_NONNULL_BEGIN

@interface SDLFunctionID ()

@property (nonatomic, strong, nonnull) NSDictionary* functionIds;

@end

@implementation SDLFunctionID

+ (instancetype)sharedInstance {
    static SDLFunctionID* functionId = nil;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        functionId = [[SDLFunctionID alloc] init];
    });
    return functionId;
}

- (instancetype)init {
    self = [super init];
    if (!self) {
        return nil;
    }

    self.functionIds = @{
                         @0: SDLNameReserved,
                         @1: SDLNameRegisterAppInterface,
                         @2: SDLNameUnregisterAppInterface,
                         @3: SDLNameSetGlobalProperties,
                         @4: SDLNameResetGlobalProperties,
                         @5: SDLNameAddCommand,
                         @6: SDLNameDeleteCommand,
                         @7: SDLNameAddSubMenu,
                         @8: SDLNameDeleteSubMenu,
                         @9: SDLNameCreateInteractionChoiceSet,
                         @10: SDLNamePerformInteraction,
                         @11: SDLNameDeleteInteractionChoiceSet,
                         @12: SDLNameAlert,
                         @13: SDLNameShow,
                         @14: SDLNameSpeak,
                         @15: SDLNameSetMediaClockTimer,
                         @16: SDLNamePerformAudioPassThru,
                         @17: SDLNameEndAudioPassThru,
                         @18: SDLNameSubscribeButton,
                         @19: SDLNameUnsubscribeButton,
                         @20: SDLNameSubscribeVehicleData,
                         @21: SDLNameUnsubscribeVehicleData,
                         @22: SDLNameGetVehicleData,
                         @23: SDLNameReadDID,
                         @24: SDLNameGetDTCs,
                         @25: SDLNameScrollableMessage,
                         @26: SDLNameSlider,
                         @27: SDLNameShowConstantTBT,
                         @28: SDLNameAlertManeuver,
                         @29: SDLNameUpdateTurnList,
                         @30: SDLNameChangeRegistration,
                         @31: SDLNameGenericResponse,
                         @32: SDLNamePutFile,
                         @33: SDLNameDeleteFile,
                         @34: SDLNameListFiles,
                         @35: SDLNameSetAppIcon,
                         @36: SDLNameSetDisplayLayout,
                         @37: SDLNameDiagnosticMessage,
                         @38: SDLNameSystemRequest,
                         @39: SDLNameSendLocation,
                         @40: SDLNameDialNumber,
                         @41: SDLNameButtonPress,
                         @43: SDLNameGetInteriorVehicleData,
                         @44: SDLNameSetInteriorVehicleData,
                         @45: SDLNameGetWayPoints,
                         @46: SDLNameSubscribeWayPoints,
                         @47: SDLNameUnsubscribeWayPoints,
                         @48: SDLNameGetSystemCapability,
                         @49: SDLNameSendHapticData,
                         @32768: SDLNameOnHMIStatus,
                         @32769: SDLNameOnAppInterfaceUnregistered,
                         @32770: SDLNameOnButtonEvent,
                         @32771: SDLNameOnButtonPress,
                         @32772: SDLNameOnVehicleData,
                         @32773: SDLNameOnCommand,
                         @32774: SDLNameOnTBTClientState,
                         @32775: SDLNameOnDriverDistraction,
                         @32776: SDLNameOnPermissionsChange,
                         @32777: SDLNameOnAudioPassThru,
                         @32778: SDLNameOnLanguageChange,
                         @32779: SDLNameOnKeyboardInput,
                         @32780: SDLNameOnTouchEvent,
                         @32781: SDLNameOnSystemRequest,
                         @32782: SDLNameOnHashChange,
                         @32783: SDLNameOnInteriorVehicleData,
                         @32784: SDLNameOnWayPointChange,
                         @32785: SDLNameOnRCStatus,
                         @65536: SDLNameEncodedSyncPData,
                         @65537: SDLNameSyncPData,
                         @98304: SDLNameOnEncodedSyncPData,
                         @98305: SDLNameOnSyncPData
                         };
    return self;
}

- (nullable SDLName)functionNameForId:(UInt32)functionID {
    return self.functionIds[@(functionID)];
}

- (nullable NSNumber<SDLInt> *)functionIdForName:(SDLName)functionName {
    return [[self.functionIds allKeysForObject:functionName] firstObject];
}

@end

NS_ASSUME_NONNULL_END