diff options
author | NicoleYarroch <nicole@livio.io> | 2017-08-04 09:15:16 -0400 |
---|---|---|
committer | NicoleYarroch <nicole@livio.io> | 2017-08-04 09:15:16 -0400 |
commit | f346e7c7fa19b501de850535a1e5830dc6ce3fd8 (patch) | |
tree | 05f680d376ae67c50d9ca13584e43f127c8df549 | |
parent | fbbdb508e864dd40d1308b82aae62bebcf7ae07c (diff) | |
download | sdl_ios-f346e7c7fa19b501de850535a1e5830dc6ce3fd8.tar.gz |
Added SDLSendHapticDataResponse class
- add SDLSendHapticDataResponse class and test cases
Signed-off-by: NicoleYarroch <nicole@livio.io>
-rw-r--r-- | SmartDeviceLink-iOS.xcodeproj/project.pbxproj | 16 | ||||
-rw-r--r-- | SmartDeviceLink/SDLNames.h | 1 | ||||
-rw-r--r-- | SmartDeviceLink/SDLNames.m | 1 | ||||
-rw-r--r-- | SmartDeviceLink/SDLSendHapticDataResponse.h | 19 | ||||
-rw-r--r-- | SmartDeviceLink/SDLSendHapticDataResponse.m | 25 | ||||
-rw-r--r-- | SmartDeviceLink/SDLSpatialStruct.m | 6 | ||||
-rw-r--r-- | SmartDeviceLinkTests/RPCSpecs/RequestSpecs/SDLSendHapticDataSpec.m | 61 | ||||
-rw-r--r-- | SmartDeviceLinkTests/RPCSpecs/ResponseSpecs/SDLSendHapticDataResponseSpec.m | 19 |
8 files changed, 147 insertions, 1 deletions
diff --git a/SmartDeviceLink-iOS.xcodeproj/project.pbxproj b/SmartDeviceLink-iOS.xcodeproj/project.pbxproj index 5a1caf2c3..5bb2a9208 100644 --- a/SmartDeviceLink-iOS.xcodeproj/project.pbxproj +++ b/SmartDeviceLink-iOS.xcodeproj/project.pbxproj @@ -900,6 +900,10 @@ 5DE5ABB71B0E38C90067BB02 /* SDLSystemRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = 5D61FBD21A84238B00846EE7 /* SDLSystemRequest.h */; }; 5DE5ABB81B0E38C90067BB02 /* SDLSystemRequestResponse.h in Headers */ = {isa = PBXBuildFile; fileRef = 5D61FBD41A84238B00846EE7 /* SDLSystemRequestResponse.h */; }; 5DFFB9151BD7C89700DB3F04 /* SDLConnectionManagerType.h in Headers */ = {isa = PBXBuildFile; fileRef = 5DFFB9141BD7C89700DB3F04 /* SDLConnectionManagerType.h */; }; + 8877F5EB1F34A3BE00DC128A /* SDLSendHapticDataSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = 8877F5EA1F34A3BE00DC128A /* SDLSendHapticDataSpec.m */; }; + 8877F5EE1F34A72200DC128A /* SDLSendHapticDataResponse.h in Headers */ = {isa = PBXBuildFile; fileRef = 8877F5EC1F34A72200DC128A /* SDLSendHapticDataResponse.h */; }; + 8877F5EF1F34A72200DC128A /* SDLSendHapticDataResponse.m in Sources */ = {isa = PBXBuildFile; fileRef = 8877F5ED1F34A72200DC128A /* SDLSendHapticDataResponse.m */; }; + 8877F5F11F34AA2D00DC128A /* SDLSendHapticDataResponseSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = 8877F5F01F34AA2D00DC128A /* SDLSendHapticDataResponseSpec.m */; }; 88EED8381F33AE1700E6C42E /* SDLSpatialStruct.h in Headers */ = {isa = PBXBuildFile; fileRef = 88EED8361F33AE1700E6C42E /* SDLSpatialStruct.h */; }; 88EED8391F33AE1700E6C42E /* SDLSpatialStruct.m in Sources */ = {isa = PBXBuildFile; fileRef = 88EED8371F33AE1700E6C42E /* SDLSpatialStruct.m */; }; 88EED83B1F33BECB00E6C42E /* SDLSpatialStructSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = 88EED83A1F33BECB00E6C42E /* SDLSpatialStructSpec.m */; }; @@ -1974,6 +1978,10 @@ 5DEE55BF1B8509CB004F0D0F /* SDLURLRequestTaskSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SDLURLRequestTaskSpec.m; path = "UtilitiesSpecs/HTTP Connection/SDLURLRequestTaskSpec.m"; sourceTree = "<group>"; }; 5DF2BB9C1B94E38A00CE5994 /* SDLURLSessionSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SDLURLSessionSpec.m; path = "UtilitiesSpecs/HTTP Connection/SDLURLSessionSpec.m"; sourceTree = "<group>"; }; 5DFFB9141BD7C89700DB3F04 /* SDLConnectionManagerType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDLConnectionManagerType.h; sourceTree = "<group>"; }; + 8877F5EA1F34A3BE00DC128A /* SDLSendHapticDataSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDLSendHapticDataSpec.m; sourceTree = "<group>"; }; + 8877F5EC1F34A72200DC128A /* SDLSendHapticDataResponse.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDLSendHapticDataResponse.h; sourceTree = "<group>"; }; + 8877F5ED1F34A72200DC128A /* SDLSendHapticDataResponse.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDLSendHapticDataResponse.m; sourceTree = "<group>"; }; + 8877F5F01F34AA2D00DC128A /* SDLSendHapticDataResponseSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDLSendHapticDataResponseSpec.m; sourceTree = "<group>"; }; 88EED8361F33AE1700E6C42E /* SDLSpatialStruct.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDLSpatialStruct.h; sourceTree = "<group>"; }; 88EED8371F33AE1700E6C42E /* SDLSpatialStruct.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDLSpatialStruct.m; sourceTree = "<group>"; }; 88EED83A1F33BECB00E6C42E /* SDLSpatialStructSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDLSpatialStructSpec.m; sourceTree = "<group>"; }; @@ -2281,6 +2289,7 @@ 162E82631A9BDE8A00906325 /* SDLUnsubscribeVehicleDataSpec.m */, DA9F7EA51DCC05F500ACAE48 /* SDLUnsubscribeWaypointsSpec.m */, 162E82641A9BDE8A00906325 /* SDLUpdateTurnListSpec.m */, + 8877F5EA1F34A3BE00DC128A /* SDLSendHapticDataSpec.m */, ); path = RequestSpecs; sourceTree = "<group>"; @@ -2334,6 +2343,7 @@ 162E828C1A9BDE8A00906325 /* SDLUnsubscribeVehicleDataResponseSpec.m */, DA9F7EAB1DCC062400ACAE48 /* SDLUnsubscribeWaypointsResponseSpec.m */, 162E828D1A9BDE8A00906325 /* SDLUpdateTurnListResponseSpec.m */, + 8877F5F01F34AA2D00DC128A /* SDLSendHapticDataResponseSpec.m */, ); path = ResponseSpecs; sourceTree = "<group>"; @@ -2885,6 +2895,8 @@ 5D61FB791A84238B00846EE7 /* SDLResetGlobalPropertiesResponse.m */, 5D61FB901A84238B00846EE7 /* SDLScrollableMessageResponse.h */, 5D61FB911A84238B00846EE7 /* SDLScrollableMessageResponse.m */, + 8877F5EC1F34A72200DC128A /* SDLSendHapticDataResponse.h */, + 8877F5ED1F34A72200DC128A /* SDLSendHapticDataResponse.m */, 5DCF76F71ACDD7CD00BB647B /* SDLSendLocationResponse.h */, 5DCF76F81ACDD7CD00BB647B /* SDLSendLocationResponse.m */, 5D61FB941A84238B00846EE7 /* SDLSetAppIconResponse.h */, @@ -4145,6 +4157,7 @@ 5D61FC721A84238C00846EE7 /* SDLDeleteCommand.h in Headers */, 5D61FC821A84238C00846EE7 /* SDLDeviceInfo.h in Headers */, 5D61FCA91A84238C00846EE7 /* SDLFileType.h in Headers */, + 8877F5EE1F34A72200DC128A /* SDLSendHapticDataResponse.h in Headers */, 5DD67CB81E661C4A009CD394 /* SDLLogTargetFile.h in Headers */, 5D61FD591A84238C00846EE7 /* SDLReadDID.h in Headers */, 5D82041A1BCD80BA00D0A41B /* SDLLockScreenConfiguration.h in Headers */, @@ -4743,6 +4756,7 @@ 97E26DED1E807AD70074A3C7 /* SDLMutableDataQueue.m in Sources */, 5D61FD641A84238C00846EE7 /* SDLResetGlobalProperties.m in Sources */, 5D60088B1BE3ED540094A505 /* SDLStateMachine.m in Sources */, + 8877F5EF1F34A72200DC128A /* SDLSendHapticDataResponse.m in Sources */, 5D61FD181A84238C00846EE7 /* SDLOnPermissionsChange.m in Sources */, 5D61FD3E1A84238C00846EE7 /* SDLPrimaryAudioSource.m in Sources */, 5D61FC2A1A84238C00846EE7 /* SDLAbstractProtocol.m in Sources */, @@ -4858,6 +4872,7 @@ 162E83281A9BDE8B00906325 /* SDLDeleteCommandSpec.m in Sources */, 162E83531A9BDE8B00906325 /* SDLDiagnosticMessageResponseSpec.m in Sources */, 162E83671A9BDE8B00906325 /* SDLSliderResponseSpec.m in Sources */, + 8877F5F11F34AA2D00DC128A /* SDLSendHapticDataResponseSpec.m in Sources */, 162E836C1A9BDE8B00906325 /* SDLSystemRequestResponseSpec.m in Sources */, 162E833C1A9BDE8B00906325 /* SDLSetMediaClockTimerSpec.m in Sources */, 162E83061A9BDE8B00906325 /* SDLVehicleDataEventStatusSpec.m in Sources */, @@ -5045,6 +5060,7 @@ 162E83321A9BDE8B00906325 /* SDLPerformAudioPassThruSpec.m in Sources */, 162E830B1A9BDE8B00906325 /* SDLVrCapabilitiesSpec.m in Sources */, 162E83081A9BDE8B00906325 /* SDLVehicleDataResultCodeSpec.m in Sources */, + 8877F5EB1F34A3BE00DC128A /* SDLSendHapticDataSpec.m in Sources */, 162E83621A9BDE8B00906325 /* SDLSetDisplayLayoutResponseSpec.m in Sources */, 162E832E1A9BDE8B00906325 /* SDLEndAudioPassThruSpec.m in Sources */, 1680B1191A9CD7AD00DBD79E /* SDLV2ProtocolMessageSpec.m in Sources */, diff --git a/SmartDeviceLink/SDLNames.h b/SmartDeviceLink/SDLNames.h index dce38ddc2..abe9fe4ad 100644 --- a/SmartDeviceLink/SDLNames.h +++ b/SmartDeviceLink/SDLNames.h @@ -352,6 +352,7 @@ extern SDLName const SDLNameSecondaryText; extern SDLName const SDLNameSecond; extern SDLName const SDLNameSeconds; extern SDLName const SDLNameSendHapticData; +extern SDLName const SDLNameSendHapticDataResponse; extern SDLName const SDLNameSendLocation; extern SDLName const SDLNameSendLocationEnabled; extern SDLName const SDLNameSetAppIcon; diff --git a/SmartDeviceLink/SDLNames.m b/SmartDeviceLink/SDLNames.m index 4ca664188..cd8002c77 100644 --- a/SmartDeviceLink/SDLNames.m +++ b/SmartDeviceLink/SDLNames.m @@ -350,6 +350,7 @@ SDLName const SDLNameSecondaryText = @"secondaryText"; SDLName const SDLNameSecond = @"second"; SDLName const SDLNameSeconds = @"seconds"; SDLName const SDLNameSendHapticData = @"sendHapticData"; +SDLName const SDLNameSendHapticDataResponse = @"sendHapticDataResponse"; SDLName const SDLNameSendLocation = @"SendLocation"; SDLName const SDLNameSendLocationEnabled = @"sendLocationEnabled"; SDLName const SDLNameSetAppIcon = @"SetAppIcon"; diff --git a/SmartDeviceLink/SDLSendHapticDataResponse.h b/SmartDeviceLink/SDLSendHapticDataResponse.h new file mode 100644 index 000000000..c811c0e22 --- /dev/null +++ b/SmartDeviceLink/SDLSendHapticDataResponse.h @@ -0,0 +1,19 @@ +// +// SDLSendHapticDataResponse.h +// SmartDeviceLink-iOS +// +// Created by Nicole on 8/4/17. +// Copyright © 2017 smartdevicelink. All rights reserved. +// + +#import "SDLRPCResponse.h" + +NS_ASSUME_NONNULL_BEGIN +/** + * SDLSendHapticDataResponse is sent when SDLSendHapticData has been called + */ +@interface SDLSendHapticDataResponse : SDLRPCResponse + +@end + +NS_ASSUME_NONNULL_END diff --git a/SmartDeviceLink/SDLSendHapticDataResponse.m b/SmartDeviceLink/SDLSendHapticDataResponse.m new file mode 100644 index 000000000..b1fa03607 --- /dev/null +++ b/SmartDeviceLink/SDLSendHapticDataResponse.m @@ -0,0 +1,25 @@ + +// +// SDLSendHapticDataResponse.m +// SmartDeviceLink-iOS +// +// Created by Nicole on 8/4/17. +// Copyright © 2017 smartdevicelink. All rights reserved. +// + +#import "SDLNames.h" +#import "SDLSendHapticDataResponse.h" + +NS_ASSUME_NONNULL_BEGIN + +@implementation SDLSendHapticDataResponse + +- (instancetype)init { + if (self = [super initWithName:SDLNameSendHapticDataResponse]) { + } + return self; +} + +@end + +NS_ASSUME_NONNULL_END diff --git a/SmartDeviceLink/SDLSpatialStruct.m b/SmartDeviceLink/SDLSpatialStruct.m index c83d1d123..c3cd93e02 100644 --- a/SmartDeviceLink/SDLSpatialStruct.m +++ b/SmartDeviceLink/SDLSpatialStruct.m @@ -10,9 +10,11 @@ #import "SDLSpatialStruct.h" #import "SDLNames.h" +NS_ASSUME_NONNULL_BEGIN + @implementation SDLSpatialStruct -- (instancetype)initWithId:(UInt32)id x:(NSNumber *)x y:(NSNumber *)y width:(NSNumber *)width height:(NSNumber *)height { +- (instancetype)initWithId:(UInt32)id x:(NSNumber<SDLFloat> *)x y:(NSNumber<SDLFloat> *)y width:(NSNumber<SDLFloat> *)width height:(NSNumber<SDLFloat> *)height { self = [self init]; if (!self) { return nil; @@ -68,3 +70,5 @@ } @end + +NS_ASSUME_NONNULL_END diff --git a/SmartDeviceLinkTests/RPCSpecs/RequestSpecs/SDLSendHapticDataSpec.m b/SmartDeviceLinkTests/RPCSpecs/RequestSpecs/SDLSendHapticDataSpec.m new file mode 100644 index 000000000..8073b103d --- /dev/null +++ b/SmartDeviceLinkTests/RPCSpecs/RequestSpecs/SDLSendHapticDataSpec.m @@ -0,0 +1,61 @@ +// +// SDLSendHapticDataSpec.m +// SmartDeviceLink-iOS +// +// Created by Nicole on 8/4/17. +// Copyright © 2017 smartdevicelink. All rights reserved. +// + +#import <Foundation/Foundation.h> + +#import <Quick/Quick.h> +#import <Nimble/Nimble.h> + +#import "SDLNames.h" +#import "SDLSendHapticData.h" +#import "SDLSpatialStruct.h" + +QuickSpecBegin(SDLSendHapticDataSpec) + +describe(@"Initialization Tests", ^ { + __block SDLSpatialStruct *testStruct = nil; + + beforeEach(^{ + testStruct = [[SDLSpatialStruct alloc] initWithId:1 x:@20 y:@30 width:@100 height:@200]; + }); + + context(@"Getter/Setter Tests", ^ { + it(@"Should set and get correctly", ^ { + SDLSendHapticData *testRequest = [[SDLSendHapticData alloc] init]; + testRequest.hapticSpatialData = [@[testStruct] mutableCopy]; + + expect(testRequest.hapticSpatialData).to(equal(@[testStruct])); + }); + }); + + context(@"Init tests", ^{ + it(@"Should get correctly when initialized with a dictionary", ^ { + NSMutableDictionary* dict = [@{SDLNameRequest: + @{SDLNameParameters: + @{SDLNameHapticSpatialData:@[testStruct]}, + SDLNameOperationName:SDLNameSendHapticData}} mutableCopy]; + SDLSendHapticData *testRequest = [[SDLSendHapticData alloc] initWithDictionary:dict]; + + expect(testRequest.hapticSpatialData).to(equal(@[testStruct])); + }); + + it(@"Should initialize correctly with initWithType:", ^{ + SDLSendHapticData *testRequest = [[SDLSendHapticData alloc] initWithHapticSpatialData:[NSMutableArray arrayWithArray:@[testStruct]]]; + + expect(testRequest.hapticSpatialData).to(equal(@[testStruct])); + }); + + it(@"Should return nil if not set", ^ { + SDLSendHapticData *testRequest = [[SDLSendHapticData alloc] init]; + + expect(testRequest.hapticSpatialData).to(beNil()); + }); + }); +}); + +QuickSpecEnd diff --git a/SmartDeviceLinkTests/RPCSpecs/ResponseSpecs/SDLSendHapticDataResponseSpec.m b/SmartDeviceLinkTests/RPCSpecs/ResponseSpecs/SDLSendHapticDataResponseSpec.m new file mode 100644 index 000000000..29be138ad --- /dev/null +++ b/SmartDeviceLinkTests/RPCSpecs/ResponseSpecs/SDLSendHapticDataResponseSpec.m @@ -0,0 +1,19 @@ +// +// SDLSendHapticDataResponseSpec.m +// SmartDeviceLink-iOS +// +// Created by Nicole on 8/4/17. +// Copyright © 2017 smartdevicelink. All rights reserved. +// + +#import <Foundation/Foundation.h> + +#import <Quick/Quick.h> +#import <Nimble/Nimble.h> + +#import "SDLNames.h" +#import "SDLSendHapticDataResponse.h" + +QuickSpecBegin(SDLSendHapticDataResponseSpec) + +QuickSpecEnd |