summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Gluck <justin.gluck@livio.io>2020-01-22 13:03:33 -0500
committerJustin Gluck <justin.gluck@livio.io>2020-01-22 13:03:33 -0500
commit77cfd53d41459ae0ded67ff3c2234e64465f1ebe (patch)
tree7aaa9466463be5ffd47cb74f4bdace1f25abf81e
parent26fc6bff0670aa87cb350951790a0441b4d95c9a (diff)
downloadsdl_ios-77cfd53d41459ae0ded67ff3c2234e64465f1ebe.tar.gz
creating inits to set radio data for XM, AM and FM
-rw-r--r--SmartDeviceLink/SDLRadioControlData.h32
-rw-r--r--SmartDeviceLink/SDLRadioControlData.m61
2 files changed, 93 insertions, 0 deletions
diff --git a/SmartDeviceLink/SDLRadioControlData.h b/SmartDeviceLink/SDLRadioControlData.h
index c3d07eaff..bea276856 100644
--- a/SmartDeviceLink/SDLRadioControlData.h
+++ b/SmartDeviceLink/SDLRadioControlData.h
@@ -41,6 +41,38 @@ NS_ASSUME_NONNULL_BEGIN
*/
- (instancetype)initWithFrequencyInteger:(nullable NSNumber<SDLInt> *)frequencyInteger frequencyFraction:(nullable NSNumber<SDLInt> *)frequencyFraction band:(nullable SDLRadioBand)band hdChannel:(nullable NSNumber<SDLInt> *)hdChannel radioEnable:(nullable NSNumber<SDLBool> *)radioEnable hdRadioEnable:(nullable NSNumber<SDLBool> *)hdRadioEnable;
+
+/// Constructs a newly allocated SDLRadioControlCapabilities object with given parameters.
+///
+/// @param frequencyInteger Must be between 875 and 1080
+/// @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;
+
+/// Constructs a newly allocated SDLRadioControlCapabilities object with given parameters.
+///
+/// @param frequencyInteger Must be between 875 and 1080
+/// @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;
+
+/// Constructs a newly allocated SDLRadioControlCapabilities object with given parameters.
+///
+/// @param frequencyInteger Must be between 1 and 1710
+/// @return An instance of the SDLRadioControlData class
+- (instancetype)initXMWithFrequencyInteger:(nullable NSNumber<SDLInt> *)frequencyInteger;
+
/**
* The integer part of the frequency ie for 101.7 this value should be 101
*
diff --git a/SmartDeviceLink/SDLRadioControlData.m b/SmartDeviceLink/SDLRadioControlData.m
index 9e4f37c85..5d40ca372 100644
--- a/SmartDeviceLink/SDLRadioControlData.m
+++ b/SmartDeviceLink/SDLRadioControlData.m
@@ -43,6 +43,67 @@ NS_ASSUME_NONNULL_BEGIN
return self;
}
+- (instancetype)initFMWithFrequencyInteger:(nullable NSNumber<SDLInt> *)frequencyInteger frequencyFraction:(nullable NSNumber<SDLInt> *)frequencyFraction {
+ self = [self init];
+ if(!self) {
+ return nil;
+ }
+
+ self.band = SDLRadioBandFM;
+ self.frequencyInteger = frequencyInteger;
+ self.frequencyFraction = frequencyFraction;
+
+ return self;
+}
+
+- (instancetype)initAMWithFrequencyInteger:(nullable NSNumber<SDLInt> *)frequencyInteger {
+ self = [self init];
+ if(!self) {
+ return nil;
+ }
+
+ self.frequencyInteger = frequencyInteger;
+ self.band = SDLRadioBandAM;
+
+ return self;
+}
+
+- (instancetype)initXMWithFrequencyInteger:(nullable NSNumber<SDLInt> *)frequencyInteger {
+ self = [self init];
+ if(!self) {
+ return nil;
+ }
+
+ self.frequencyInteger = frequencyInteger;
+ self.band = SDLRadioBandXM;
+
+ 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];
}