summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Gluck <justin.gluck@livio.io>2020-01-24 15:39:13 -0500
committerJustin Gluck <justin.gluck@livio.io>2020-01-24 15:39:13 -0500
commit3a3be8bd730f89b547612c0999b61979e7dfb7f5 (patch)
tree5d498b9d4b606e23d11d6a22a87e23191497c239
parent63bb31ad99bd75af3cad3747400a0ce83f0b2328 (diff)
downloadsdl_ios-3a3be8bd730f89b547612c0999b61979e7dfb7f5.tar.gz
-rw-r--r--SmartDeviceLink/SDLRadioControlData.h14
-rw-r--r--SmartDeviceLink/SDLRadioControlData.m32
-rw-r--r--SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLRadioControlDataSpec.m20
3 files changed, 11 insertions, 55 deletions
diff --git a/SmartDeviceLink/SDLRadioControlData.h b/SmartDeviceLink/SDLRadioControlData.h
index 45be5ab1b..182e6105e 100644
--- a/SmartDeviceLink/SDLRadioControlData.h
+++ b/SmartDeviceLink/SDLRadioControlData.h
@@ -45,26 +45,16 @@ NS_ASSUME_NONNULL_BEGIN
///
/// @param frequencyInteger Must be between 0 and 1710
/// @param frequencyFraction Must be between 0 and 9
-/// @return An instance of the SDLRadioControlData class
-- (instancetype)initFMWithFrequencyInteger:(nullable NSNumber<SDLInt> *)frequencyInteger frequencyFraction:(nullable NSNumber<SDLInt> *)frequencyFraction;
-
-/// Constructs a newly allocated SDLRadioControlCapabilities object with given parameters.
-///
/// @param hdChannel Must be between 0 and 7
/// @return An instance of the SDLRadioControlData class
-- (instancetype)initFMWithHdChannel:(nullable NSNumber<SDLInt> *)hdChannel;
+- (instancetype)initFMWithFrequencyInteger:(nullable NSNumber<SDLInt> *)frequencyInteger frequencyFraction:(nullable NSNumber<SDLInt> *)frequencyFraction hdChannel:(nullable NSNumber<SDLInt> *)hdChannel;
/// Constructs a newly allocated SDLRadioControlCapabilities object with given parameters.
///
/// @param frequencyInteger Must be between 0 and 1710
-/// @return An instance of the SDLRadioControlData class
-- (instancetype)initAMWithFrequencyInteger:(nullable NSNumber<SDLInt> *)frequencyInteger;
-
-/// Constructs a newly allocated SDLRadioControlCapabilities object with given parameters.
-///
/// @param hdChannel Must be between 0 and 7
/// @return An instance of the SDLRadioControlData class
-- (instancetype)initAMWithHdChannel:(nullable NSNumber<SDLInt> *)hdChannel;
+- (instancetype)initAMWithFrequencyInteger:(nullable NSNumber<SDLInt> *)frequencyInteger hdChannel:(nullable NSNumber<SDLInt> *)hdChannel;
/// Constructs a newly allocated SDLRadioControlCapabilities object with given parameters.
///
diff --git a/SmartDeviceLink/SDLRadioControlData.m b/SmartDeviceLink/SDLRadioControlData.m
index cc4c37154..9fb82f080 100644
--- a/SmartDeviceLink/SDLRadioControlData.m
+++ b/SmartDeviceLink/SDLRadioControlData.m
@@ -43,7 +43,7 @@ NS_ASSUME_NONNULL_BEGIN
return self;
}
-- (instancetype)initFMWithFrequencyInteger:(nullable NSNumber<SDLInt> *)frequencyInteger frequencyFraction:(nullable NSNumber<SDLInt> *)frequencyFraction {
+- (instancetype)initFMWithFrequencyInteger:(nullable NSNumber<SDLInt> *)frequencyInteger frequencyFraction:(nullable NSNumber<SDLInt> *)frequencyFraction hdChannel:(nullable NSNumber<SDLInt> *)hdChannel {
self = [self init];
if(!self) {
return nil;
@@ -52,18 +52,20 @@ NS_ASSUME_NONNULL_BEGIN
self.band = SDLRadioBandFM;
self.frequencyInteger = frequencyInteger;
self.frequencyFraction = frequencyFraction;
+ self.hdChannel = hdChannel;
return self;
}
-- (instancetype)initAMWithFrequencyInteger:(nullable NSNumber<SDLInt> *)frequencyInteger {
+- (instancetype)initAMWithFrequencyInteger:(nullable NSNumber<SDLInt> *)frequencyInteger hdChannel:(nullable NSNumber<SDLInt> *)hdChannel {
self = [self init];
if(!self) {
return nil;
}
- self.frequencyInteger = frequencyInteger;
self.band = SDLRadioBandAM;
+ self.frequencyInteger = frequencyInteger;
+ self.hdChannel = hdChannel;
return self;
}
@@ -80,30 +82,6 @@ NS_ASSUME_NONNULL_BEGIN
return self;
}
-- (instancetype)initFMWithHdChannel:(nullable NSNumber<SDLInt> *)hdChannel {
- self = [self init];
- if(!self) {
- return nil;
- }
-
- self.hdChannel = hdChannel;
- self.band = SDLRadioBandFM;
-
- return self;
-}
-
-- (instancetype)initAMWithHdChannel:(nullable NSNumber<SDLInt> *)hdChannel {
- self = [self init];
- if(!self) {
- return nil;
- }
-
- self.hdChannel = hdChannel;
- self.band = SDLRadioBandAM;
-
- return self;
-}
-
- (void)setFrequencyInteger:(nullable NSNumber<SDLInt> *)frequencyInteger {
[self.store sdl_setObject:frequencyInteger forName:SDLRPCParameterNameFrequencyInteger];
}
diff --git a/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLRadioControlDataSpec.m b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLRadioControlDataSpec.m
index d6e56fb3d..a29ff574d 100644
--- a/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLRadioControlDataSpec.m
+++ b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLRadioControlDataSpec.m
@@ -156,32 +156,20 @@ describe(@"Initialization tests", ^{
});
it(@"Should get correctly when initialized FM radio control capabilities parameters", ^ {
- SDLRadioControlData* testStruct = [[SDLRadioControlData alloc] initFMWithFrequencyInteger:@101 frequencyFraction:@7];
+ SDLRadioControlData* testStruct = [[SDLRadioControlData alloc] initFMWithFrequencyInteger:@101 frequencyFraction:@7 hdChannel:@2];
expect(testStruct.frequencyInteger).to(equal(@101));
expect(testStruct.frequencyFraction).to(equal(@7));
expect(testStruct.band).to(equal(SDLRadioBandFM));
- });
-
- it(@"Should get correctly when initialized FM radio control capabilities parameters", ^ {
- SDLRadioControlData* testStruct = [[SDLRadioControlData alloc] initFMWithHdChannel:@5];
-
- expect(testStruct.hdChannel).to(equal(@5));
- expect(testStruct.band).to(equal(SDLRadioBandFM));
+ expect(testStruct.hdChannel).to(equal(@2));
});
it(@"Should get correctly when initialized AM radio control capabilities parameters", ^ {
- SDLRadioControlData* testStruct = [[SDLRadioControlData alloc] initAMWithFrequencyInteger:@101];
+ SDLRadioControlData* testStruct = [[SDLRadioControlData alloc] initAMWithFrequencyInteger:@101 hdChannel:@2];
expect(testStruct.frequencyInteger).to(equal(@101));
expect(testStruct.band).to(equal(SDLRadioBandAM));
- });
-
- it(@"Should get correctly when initialized AM radio control capabilities parameters", ^ {
- SDLRadioControlData* testStruct = [[SDLRadioControlData alloc] initAMWithHdChannel:@5];
-
- expect(testStruct.hdChannel).to(equal(@5));
- expect(testStruct.band).to(equal(SDLRadioBandAM));
+ expect(testStruct.hdChannel).to(equal(@2));
});
it(@"Should get correctly when initialized XM radio control capabilities parameters", ^ {