summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorleonid lokhmatov, Luxoft <zaqqqqqqqq@gmail.com>2020-08-06 13:14:29 +0300
committerleonid lokhmatov, Luxoft <zaqqqqqqqq@gmail.com>2020-08-06 13:14:29 +0300
commita2e11671c54022f9b120a9e6839b72733e6c30ae (patch)
treebd44de146816e2d0a1e8bd9a1ec27e04844d9ab2
parentc6f79b7bdab4001641a76d70f07d486461c33404 (diff)
downloadsdl_ios-a2e11671c54022f9b120a9e6839b72733e6c30ae.tar.gz
Revert "sdl-0257 "New vehicle data HandsOffSteering": apply review comments (p3) : implement 'hands off steering' in the obj-c example application"
This reverts commit 6ddab3a46533c3035dc3c3b2411e544be8e5c400.
-rw-r--r--Example Apps/Example ObjC/ProxyManager.m1
-rw-r--r--Example Apps/Example ObjC/VehicleDataManager.h4
-rw-r--r--Example Apps/Example ObjC/VehicleDataManager.m78
-rw-r--r--Example Apps/Shared/AppConstants.h1
-rw-r--r--Example Apps/Shared/AppConstants.m2
5 files changed, 6 insertions, 80 deletions
diff --git a/Example Apps/Example ObjC/ProxyManager.m b/Example Apps/Example ObjC/ProxyManager.m
index 23f4ae123..2c5c05357 100644
--- a/Example Apps/Example ObjC/ProxyManager.m
+++ b/Example Apps/Example ObjC/ProxyManager.m
@@ -241,7 +241,6 @@ NS_ASSUME_NONNULL_BEGIN
// Send AddCommands
[self sdlex_createMenus];
[self.vehicleDataManager subscribeToVehicleOdometer];
- [self.vehicleDataManager subscribeForHandsOffSteering];
}
if ([newLevel isEqualToEnum:SDLHMILevelFull]) {
diff --git a/Example Apps/Example ObjC/VehicleDataManager.h b/Example Apps/Example ObjC/VehicleDataManager.h
index 3abe2efd6..a32c38992 100644
--- a/Example Apps/Example ObjC/VehicleDataManager.h
+++ b/Example Apps/Example ObjC/VehicleDataManager.h
@@ -19,7 +19,6 @@ typedef void(^RefreshUIHandler)(void);
@interface VehicleDataManager : NSObject
@property (copy, nonatomic, readonly) NSString *vehicleOdometerData;
-@property (copy, nonatomic, readonly, nullable) NSString *vehicleHandsOffSteeringData;
- (instancetype)init NS_UNAVAILABLE;
- (instancetype)initWithManager:(SDLManager *)manager refreshUIHandler:(RefreshUIHandler)refreshUIHandler;
@@ -27,9 +26,6 @@ typedef void(^RefreshUIHandler)(void);
- (void)subscribeToVehicleOdometer;
- (void)unsubscribeToVehicleOdometer;
-- (void)subscribeForHandsOffSteering;
-- (void)unsubscribeFromHandsOffSteering;
-
+ (void)getAllVehicleDataWithManager:(SDLManager *)manager triggerSource:(SDLTriggerSource)triggerSource vehicleDataType:(NSString *)vehicleDataType;
+ (void)checkPhoneCallCapabilityWithManager:(SDLManager *)manager phoneNumber:(NSString *)phoneNumber;
diff --git a/Example Apps/Example ObjC/VehicleDataManager.m b/Example Apps/Example ObjC/VehicleDataManager.m
index 1462bfc85..5c2d3bac2 100644
--- a/Example Apps/Example ObjC/VehicleDataManager.m
+++ b/Example Apps/Example ObjC/VehicleDataManager.m
@@ -20,7 +20,6 @@ NS_ASSUME_NONNULL_BEGIN
@property (strong, nonatomic) SDLManager *sdlManager;
@property (copy, nonatomic, readwrite) NSString *vehicleOdometerData;
-@property (copy, nonatomic, readwrite, nullable) NSString *vehicleHandsOffSteeringData;
@property (copy, nonatomic, nullable) RefreshUIHandler refreshUIHandler;
@end
@@ -38,11 +37,9 @@ NS_ASSUME_NONNULL_BEGIN
_sdlManager = manager;
_refreshUIHandler = refreshUIHandler;
_vehicleOdometerData = @"";
- _vehicleHandsOffSteeringData = @"";
[_sdlManager subscribeToRPC:SDLDidReceiveVehicleDataNotification withObserver:self selector:@selector(vehicleDataNotification:)];
[self sdlex_resetOdometer];
- [self sdlex_resetHandsOffSteering];
return self;
}
@@ -106,63 +103,6 @@ NS_ASSUME_NONNULL_BEGIN
}
/**
- * Subscribes for hands off steering data. One must subscribe for a notification with name `SDLDidReceiveVehicleData` to get the new data when the hands off steering data changes.
-*/
-- (void)subscribeForHandsOffSteering {
- SDLLogD(@"Subscribing for hands off steering vehicle data");
- SDLSubscribeVehicleData *subscribeRequest = [[SDLSubscribeVehicleData alloc] init];
- subscribeRequest.handsOffSteering = @YES;
- [self.sdlManager sendRequest:subscribeRequest withResponseHandler:^(__kindof SDLRPCRequest * _Nullable request, __kindof SDLRPCResponse * _Nullable response, NSError * _Nullable error) {
- if (error || ![response isKindOfClass:SDLSubscribeVehicleDataResponse.class]) {
- SDLLogE(@"Error sending Get Vehicle Data RPC: %@", error);
- }
-
- SDLGetVehicleDataResponse* getVehicleDataResponse = (SDLGetVehicleDataResponse *)response;
- SDLResult resultCode = getVehicleDataResponse.resultCode;
-
- NSMutableString *message = [NSMutableString stringWithFormat:@"%@: ", VehicleDataHandsOffSteering];
- if ([resultCode isEqualToEnum:SDLResultSuccess]) {
- SDLLogD(@"Subscribed for vehicle hands off steering data");
- [message appendString:@"Subscribed"];
- } else if ([resultCode isEqualToEnum:SDLResultDisallowed]) {
- SDLLogD(@"Access to vehicle data disallowed");
- [message appendString:@"Disallowed"];
- } else if ([resultCode isEqualToEnum:SDLResultUserDisallowed]) {
- SDLLogD(@"Vehicle user disabled access to vehicle data");
- [message appendString:@"Disabled"];
- } else if ([resultCode isEqualToEnum:SDLResultIgnored]) {
- SDLLogD(@"Already subscribed to hands off steering data");
- [message appendString:@"Subscribed"];
- } else if ([resultCode isEqualToEnum:SDLResultDataNotAvailable]) {
- SDLLogD(@"You granted permission to access to vehicle data, but the vehicle you are connected to did not provide any");
- [message appendString:@"Unknown"];
- } else {
- SDLLogE(@"Unknown reason for failure to get vehicle data: %@", error != nil ? error.localizedDescription : @"no error message");
- [message appendString:@"Unsubscribed"];
- }
-
- self.vehicleHandsOffSteeringData = message;
-
- if (self.refreshUIHandler && (nil != self.refreshUIHandler)) {
- self.refreshUIHandler();
- }
- }];
-}
-
-/**
- * Unsubscribes from vehicle hands off steering data.
-*/
-- (void)unsubscribeFromHandsOffSteering {
- SDLUnsubscribeVehicleData *unsubscribeRequest = [[SDLUnsubscribeVehicleData alloc] init];
- unsubscribeRequest.handsOffSteering = @YES;
- [self.sdlManager sendRequest:unsubscribeRequest withResponseHandler:^(__kindof SDLRPCRequest * _Nullable request, __kindof SDLRPCResponse * _Nullable response, NSError * _Nullable error) {
- if (response.success.boolValue) {
- [self sdlex_resetHandsOffSteering];
- }
- }];
-}
-
-/**
* Notification containing the updated vehicle data.
*
* @param notification A SDLOnVehicleData notification
@@ -174,11 +114,9 @@ NS_ASSUME_NONNULL_BEGIN
SDLOnVehicleData *onVehicleData = (SDLOnVehicleData *)notification.notification;
self.vehicleOdometerData = [NSString stringWithFormat:@"%@: %@ km", VehicleDataOdometerName, onVehicleData.odometer];
- self.vehicleOdometerData = [NSString stringWithFormat:@"%@: %@", VehicleDataHandsOffSteering, onVehicleData.handsOffSteering.boolValue ? @"YES" : @"NO"];
- if (self.refreshUIHandler && (nil != self.refreshUIHandler)) {
- self.refreshUIHandler();
- }
+ if (!self.refreshUIHandler) { return; }
+ self.refreshUIHandler();
}
/**
@@ -188,13 +126,6 @@ NS_ASSUME_NONNULL_BEGIN
self.vehicleOdometerData = [NSString stringWithFormat:@"%@: Unsubscribed", VehicleDataOdometerName];
}
-/**
- * Resets the hands off steering data
- */
-- (void)sdlex_resetHandsOffSteering {
- self.vehicleHandsOffSteeringData = [NSString stringWithFormat:@"%@: Unsubscribed", VehicleDataHandsOffSteering];
-}
-
#pragma mark - Get Vehicle Data
/**
@@ -213,7 +144,10 @@ NS_ASSUME_NONNULL_BEGIN
SDLLogD(@"App has permission to access vehicle data. Requesting vehicle data...");
- SDLGetVehicleData *getAllVehicleData = [[SDLGetVehicleData alloc] initWithGps:@YES speed:@YES rpm:@YES fuelLevel:@YES fuelLevel_State:@YES instantFuelConsumption:@YES fuelRange:@YES externalTemperature:@YES turnSignal:@YES vin:@YES prndl:@YES tirePressure:@YES odometer:@YES beltStatus:@YES bodyInformation:@YES deviceStatus:@YES driverBraking:@YES wiperStatus:@YES headLampStatus:@YES engineTorque:@YES accPedalPosition:@YES steeringWheelAngle:@YES engineOilLife:@YES electronicParkBrakeStatus:@YES cloudAppVehicleID:@YES eCallInfo:@YES airbagStatus:@YES emergencyEvent:@YES clusterModeStatus:@YES myKey:@YES handsOffSteering:@YES];
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
+ SDLGetVehicleData *getAllVehicleData = [[SDLGetVehicleData alloc] initWithAccelerationPedalPosition:YES airbagStatus:YES beltStatus:YES bodyInformation:YES clusterModeStatus:YES deviceStatus:YES driverBraking:YES eCallInfo:YES electronicParkBrakeStatus:YES emergencyEvent:YES engineOilLife:YES engineTorque:YES externalTemperature:YES fuelLevel:YES fuelLevelState:YES fuelRange:YES gps:YES headLampStatus:YES instantFuelConsumption:YES myKey:YES odometer:YES prndl:YES rpm:YES speed:YES steeringWheelAngle:YES tirePressure:YES turnSignal:YES vin:YES wiperStatus:YES];
+#pragma clang diagnostic pop
[manager sendRequest:getAllVehicleData withResponseHandler:^(__kindof SDLRPCRequest * _Nullable request, __kindof SDLRPCResponse * _Nullable response, NSError * _Nullable error) {
if (error || ![response isKindOfClass:SDLGetVehicleDataResponse.class]) {
diff --git a/Example Apps/Shared/AppConstants.h b/Example Apps/Shared/AppConstants.h
index 2d4160c3b..5fb4b25b0 100644
--- a/Example Apps/Shared/AppConstants.h
+++ b/Example Apps/Shared/AppConstants.h
@@ -131,7 +131,6 @@ extern NSString * const ExampleAppNameSpanish;
extern NSString * const ExampleAppNameFrench;
#pragma mark - SDL Vehicle Data
-extern NSString * const VehicleDataHandsOffSteering;
extern NSString * const VehicleDataOdometerName;
extern NSString * const VehicleDataSpeedName;
diff --git a/Example Apps/Shared/AppConstants.m b/Example Apps/Shared/AppConstants.m
index 1d0e8eb66..ffe4762d1 100644
--- a/Example Apps/Shared/AppConstants.m
+++ b/Example Apps/Shared/AppConstants.m
@@ -112,7 +112,6 @@ NSString * const ACTurnSignalMenuName = @"Turn Signal";
NSString * const ACVINMenuName = @"VIN";
NSString * const ACWiperStatusMenuName = @"Wiper Status";
-
#pragma mark - SDL Image Names
NSString * const AlertBWIconName = @"alert";
NSString * const CarBWIconImageName = @"car";
@@ -129,7 +128,6 @@ NSString * const ExampleAppNameSpanish = @"SDL AplicaciĆ³n de ejemplo";
NSString * const ExampleAppNameFrench = @"SDL Exemple App";
#pragma mark - SDL Vehicle Data
-NSString * const VehicleDataHandsOffSteering = @"Hands off Steering";
NSString * const VehicleDataOdometerName = @"Odometer";
NSString * const VehicleDataSpeedName = @"Speed";