Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement SDL 0071 Remote Control Baseline (no zones, no driver/passenger, immediate control) #692

Merged
merged 27 commits into from Sep 25, 2017

Conversation

jamescs
Copy link
Contributor

@jamescs jamescs commented Aug 17, 2017

Fixes #650

This PR is ready for review.

Risk

This PR makes minor API changes.

Testing Plan

Added unit tests for each RPC.

Summary

Implements SDL 0071

Changelog

Enhancements
  • [Enhancement info]

Tasks Remaining:

  • Add convenience initializers for new RPC's
  • Add code documentation

CLA

@jamescs jamescs changed the title Feature/rc rpcs WIP: Implment 0071 SDL Remote Control Baseline (no zones, no driver/passenger, immediate control) Aug 17, 2017
@jamescs jamescs changed the title WIP: Implment 0071 SDL Remote Control Baseline (no zones, no driver/passenger, immediate control) WIP: Implement 0071 SDL Remote Control Baseline (no zones, no driver/passenger, immediate control) Aug 17, 2017
@jamescs jamescs changed the title WIP: Implement 0071 SDL Remote Control Baseline (no zones, no driver/passenger, immediate control) WIP: Implement SDL 0071 Remote Control Baseline (no zones, no driver/passenger, immediate control) Aug 17, 2017
@joeljfischer joeljfischer self-requested a review August 17, 2017 13:05
@joeljfischer joeljfischer added the proposal Accepted SDL Evolution Proposal label Aug 17, 2017
@joeljfischer joeljfischer added this to the 5.0.0 milestone Aug 17, 2017
@joeljfischer joeljfischer added this to In Progress in v5.0.0 Aug 17, 2017
@joeljfischer joeljfischer removed this from In Progress in v5.0.0 Aug 17, 2017
Copy link
Contributor

@joeljfischer joeljfischer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a full review, only of the first bunch of files, but I found some general stuff to watch for.

@@ -47,6 +47,7 @@ ss.public_header_files = [
'SmartDeviceLink/SDLAddSubMenu.h',
'SmartDeviceLink/SDLAlert.h',
'SmartDeviceLink/SDLAlertManeuver.h',
'SmartDeviceLink/SDLButtonPress.h',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The podspecs need to list every public file, based on looking at the pbxproj changes, most of the new public files are not included.

/**
* @abstract Represents AC max button *
*/
extern SDLButtonName const SDLButtonNameAcMax;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Ac" here would be "AC" because it's an acronym. Acronyms should be all the same (upper or lower).

/**
* @abstract Represents AC button *
*/
extern SDLButtonName const SDLButtonNameAc;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also should be "AC"

@interface SDLClimateControlCapabilities : SDLRPCStruct

/**
* @abstractThe short friendly name of the climate control module.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't believe we need the @abstract anymore in the latest versions of Xcode.

}

- (void)setDefrostZone:(nullable NSArray <SDLDefrostZone>*)defrostZone {
[store sdl_setObject:defrostZone forName:SDLNameDefrostZone];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Careful of random extra spaces.

}

- (nullable NSArray<SDLDefrostZone> *)defrostZone {
return [store sdl_objectForName:SDLNameDefrostZone];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this is supposed to use sdl_objectsForName:ofClass:

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SDLDefrostZone is an SDLEnum, I believe this one may be ok based on the description found here:
#713

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

}

- (nullable SDLTemperature *)desiredTemperature {
return [store sdl_objectForName:SDLNameDesiredTemperature];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this is supposed to use sdlObjectForName:ofClass:

@@ -28,7 +28,7 @@ - (instancetype)init {
if (!self) {
return nil;
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Careful of adding extra whitespace. I'd recommend turning on Xcode->Preferences->Text Editing->Automatically trim trailing whitespace (and also Including whitespace-only lines)

@joeljfischer joeljfischer assigned jamescs and unassigned jamescs Aug 18, 2017
@joeljfischer
Copy link
Contributor

@jamescs Note that this branch now has conflicts, sorry!

@@ -47,6 +56,7 @@
SDLName const SDLNameButtonCapabilities = @"buttonCapabilities";
SDLName const SDLNameButtonEventMode = @"buttonEventMode";
SDLName const SDLNameButtonName = @"buttonName";
SDLName const SDLNameButtonPress = @"buttonPress";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we please change @"buttonPress"; to @"ButtonPress"; to match spec.

/**
* @abstract A SDLDefrostZone with the value of *NORTH*
*/
extern SDLVentilationMode const SDLVentilationModeNorth;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please change North to None

SDLVentilationMode const SDLVentilationModeUpper = @"UPPER";
SDLVentilationMode const SDLVentilationModeLower = @"LOWER";
SDLVentilationMode const SDLVentilationModeBoth = @"BOTH";
SDLVentilationMode const SDLVentilationModeNorth = @"NONE";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please change North to None

* @abstract Represents Radio state as ACQUIRING
*
*/
extern SDLRadioState const SDLRadioBandAcquiring;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please change SDLRadioBandAcquiring to SDLRadioStateAcquiring


#import "SDLRadioState.h"

SDLRadioState const SDLRadioBandAcquiring = @"ACQUIRING";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please change SDLRadioBandAcquiring to SDLRadioStateAcquiring

odvcencio and others added 8 commits August 28, 2017 14:20
# Conflicts:
#	SmartDeviceLink-iOS.podspec
#	SmartDeviceLink-iOS.xcodeproj/project.pbxproj
#	SmartDeviceLink.podspec
#	SmartDeviceLink/SDLFunctionID.m
#	SmartDeviceLink/SDLNames.h
#	SmartDeviceLink/SDLNames.m
#	SmartDeviceLink/SmartDeviceLink.h
@jamescs jamescs changed the title WIP: Implement SDL 0071 Remote Control Baseline (no zones, no driver/passenger, immediate control) Implement SDL 0071 Remote Control Baseline (no zones, no driver/passenger, immediate control) Sep 14, 2017
@@ -164,6 +172,8 @@ ss.public_header_files = [
'SmartDeviceLink/SDLOnDriverDistraction.h',
'SmartDeviceLink/SDLOnEncodedSyncPData.h',
'SmartDeviceLink/SDLOnHashChange.h',
'SmartDeviceLink/SDLOnInteriorVehicleData.h',
'SmartDeviceLink/SDLOnInteriorVehicleData',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Appears to be an extra.

@@ -283,6 +303,7 @@ ss.public_header_files = [
'SmartDeviceLink/SDLTransportDelegate.h',
'SmartDeviceLink/SDLTriggerSource.h',
'SmartDeviceLink/SDLTTSChunk.h',
'SmartDeviceLink/SDLTTSChunkFactory.h',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file no longer exists.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that this and the above comment do not appear on the below SmartDeviceLink.podspec.

*/
extern SDLButtonName const SDLButtonNameAC;


Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sometimes this uses one newline, sometimes it two, it should be one.

extern SDLButtonName const SDLButtonNameShuffle;

/**
* @abstract Represents a Repeat button *
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove the *


@interface SDLButtonPress : SDLRPCRequest


Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make the 2 lines and 1 line consistent with other files. If you stick with 1 line, you should be okay.

}

-(instancetype) initWithUnit: (SDLTemperatureUnit) unit andValue:(NSNumber<SDLFloat> *) value {
self = [self init];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if (!self)

#import "SDLModuleData.h"

QuickSpecBegin(SDLOnInteriorVehicleDataSpec)
SDLModuleData* someModuleData = [[SDLModuleData alloc] init];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be in a describe in a beforeEach so that it's reset every time.

#import "SDLNames.h"

QuickSpecBegin(SDLGetInteriorVehicleDataResponseSpec)
SDLModuleData* someModuleData = [[SDLModuleData alloc] init];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be in a describe block in a beforeEach


QuickSpecBegin(SDLSetInteriorVehicleDataResponseSpec)

SDLModuleData *someModuleData = [[SDLModuleData alloc] init];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be in a describe block in a beforeEach

#import "SDLNames.h"

QuickSpecBegin(SDLClimateControlDataSpec)
__block SDLTemperature* currentTemp = [[SDLTemperature alloc] init];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be in a describe block in a beforeEach

@joeljfischer
Copy link
Contributor

@mrapitis I'm seeing a merge conflict again

@mrapitis
Copy link
Contributor

@joeljfischer thanks, it looks like project.pbxproj is conflicting. We will merge the base and resolve the conflict.

Conflicts:
	SmartDeviceLink-iOS.xcodeproj/project.pbxproj
@mrapitis
Copy link
Contributor

@joeljfischer base branch has been merged and conflicting file resolved. thanks.

@codecov-io
Copy link

codecov-io commented Sep 21, 2017

Codecov Report

Merging #692 into release/5.0.0 will increase coverage by 0.02%.
The diff coverage is 55.05%.

@@                Coverage Diff                @@
##           release/5.0.0     #692      +/-   ##
=================================================
+ Coverage          54.43%   54.45%   +0.02%     
=================================================
  Files                318      333      +15     
  Lines               7299     7586     +287     
  Branches             662      677      +15     
=================================================
+ Hits                3973     4131     +158     
- Misses              3085     3213     +128     
- Partials             241      242       +1


NS_ASSUME_NONNULL_BEGIN

@interface SDLRdsData : SDLRPCStruct
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because RDS is an acronym, this class should be SDLRDSData


@interface SDLRadioControlData : SDLRPCStruct

- (instancetype)initWithFrequencyInteger:(nullable NSNumber<SDLInt> *)frequencyInteger frequencyFraction:(nullable NSNumber<SDLInt> *)frequencyFraction band:(nullable SDLRadioBand)band rdsData:(nullable SDLRdsData *)rdsData availableHDs:(nullable NSNumber<SDLInt> *)availableHDs hdChannel:(nullable NSNumber<SDLInt> *)hdChannel signalStrength:(nullable NSNumber<SDLInt> *)signalStrength signalChangeThreshold:(nullable NSNumber<SDLInt> *)signalChangeThreshold radioEnable:(nullable NSNumber<SDLBool> *)radioEnable state:(nullable SDLRadioState)state;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This initializer should only contain properties such that are actually currently settable by developers (e.g. rdsData is readonly).

*
*SDLRdsData
*/
@property (nullable, strong, nonatomic) SDLRdsData *rdsData;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A number of these properties are readonly, and the documentation should note it is such.

*
* Optional
*/
@property (nullable, strong, nonatomic) SDLTemperature *currentTemperature;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This property is readonly and the documentation should mark it as such.


@interface SDLClimateControlData : SDLRPCStruct

- (instancetype)initWithFanSpeed:(nullable NSNumber<SDLInt> *)fanSpeed currentTemperature:(nullable SDLTemperature *)currentTemperature desiredTemperature:(nullable SDLTemperature *)desiredTemperature acEnable:(nullable NSNumber<SDLBool> *)acEnable circulateAirEnable:(nullable NSNumber<SDLBool> *)circulateAirEnable autoModeEnable:(nullable NSNumber<SDLBool> *)autoModeEnable defrostZone:(nullable SDLDefrostZone)defrostZone dualModeEnable:(nullable NSNumber<SDLBool> *)dualModeEnable acMaxEnable:(nullable NSNumber<SDLBool> *)acMaxEnable ventilationMode:(nullable SDLVentilationMode)ventilationMode;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This initializer should not contain the currentTemperature due to it being a readonly parameter

@@ -56,6 +66,10 @@
SDLName const SDLNameCharacterSet = @"characterSet";
SDLName const SDLNameChoiceId = @"choiceID";
SDLName const SDLNameChoiceSet = @"choiceSet";
SDLName const SDLNameCirculateAirEnable = @"circulateAirEnableAvailable";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be circulateAirEnable

@@ -16,7 +16,7 @@ NS_ASSUME_NONNULL_BEGIN

@interface SDLRadioControlData : SDLRPCStruct

- (instancetype)initWithFrequencyInteger:(nullable NSNumber<SDLInt> *)frequencyInteger frequencyFraction:(nullable NSNumber<SDLInt> *)frequencyFraction band:(nullable SDLRadioBand)band rdsData:(nullable SDLRdsData *)rdsData availableHDs:(nullable NSNumber<SDLInt> *)availableHDs hdChannel:(nullable NSNumber<SDLInt> *)hdChannel signalStrength:(nullable NSNumber<SDLInt> *)signalStrength signalChangeThreshold:(nullable NSNumber<SDLInt> *)signalChangeThreshold radioEnable:(nullable NSNumber<SDLBool> *)radioEnable state:(nullable SDLRadioState)state;
- (instancetype)initWithFrequencyInteger:(nullable NSNumber<SDLInt> *)frequencyInteger frequencyFraction:(nullable NSNumber<SDLInt> *)frequencyFraction band:(nullable SDLRadioBand)band availableHDs:(nullable NSNumber<SDLInt> *)availableHDs hdChannel:(nullable NSNumber<SDLInt> *)hdChannel signalStrength:(nullable NSNumber<SDLInt> *)signalStrength signalChangeThreshold:(nullable NSNumber<SDLInt> *)signalChangeThreshold radioEnable:(nullable NSNumber<SDLBool> *)radioEnable state:(nullable SDLRadioState)state;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

availableHDs, signalStrength signalChangeThreshold state are read only and should be removed from this initializer

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It also appears that a few documentation notes about read only are missing.

@@ -39,6 +39,13 @@
expect(testRequest.systemCapabilityType).to(beNil());
});

it(@"Should get correctly when initialized with systemCapabilityType", ^ {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This appears to be an entirely identical test to the below test.

@@ -75,6 +75,21 @@
expect(testStruct.ventilationModeAvailable).to(equal(@NO));
expect(testStruct.ventilationMode).to(equal([@[SDLVentilationModeUpper] copy]));
});

it(@"Should get correctly when initialized with module data and other climate control capabilite's parameters", ^ {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spelling "capabilite's" -> "capabilities"

expect(testStruct.radioControlData).to(equal(someRadioData));
});

it(@"Should get correctly when initialized with ClimateControlData", ^ {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test and the above test should also test the other parameters and make sure they're nil (see above for how to do that), or whatever they should be.

@joeljfischer joeljfischer merged commit 941d8f8 into smartdevicelink:release/5.0.0 Sep 25, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
proposal Accepted SDL Evolution Proposal
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants