summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Fischer <joeljfischer@gmail.com>2020-12-09 11:43:45 -0500
committerJoel Fischer <joeljfischer@gmail.com>2020-12-09 11:43:45 -0500
commit4ed4721d3a415c1bd9a4020da07ec220832341c6 (patch)
treeec84d9e447c100ddef8e6da3fb9ab8480bd3eb2c
parent6d86e31c73a6fe17d0f361eba97d427036c14656 (diff)
parent361db38c0df94d69269358d55c34cc77a0102dac (diff)
downloadsdl_ios-bugfix/issue-1821-use-generated-initializers.tar.gz
Merge branch 'develop' into bugfix/issue-1821-use-generated-initializersbugfix/issue-1821-use-generated-initializers
-rw-r--r--.github/PULL_REQUEST_TEMPLATE.md2
-rw-r--r--.github/workflows/test.yml17
-rw-r--r--Example Apps/Example ObjC/AlertManager.m2
-rw-r--r--Example Apps/Example ObjC/ProxyManager.m12
-rw-r--r--Example Apps/Example Swift/AlertManager.swift2
-rw-r--r--Example Apps/Example Swift/ProxyManager.swift12
-rw-r--r--SmartDeviceLink/private/SDLGlobals.h2
-rw-r--r--SmartDeviceLink/private/SDLGlobals.m6
-rw-r--r--SmartDeviceLink/private/SDLLifecycleManager.m2
-rw-r--r--SmartDeviceLink/private/SDLLifecycleProtocolHandler.m1
-rw-r--r--SmartDeviceLink/private/SDLSoftButtonManager.m3
-rw-r--r--SmartDeviceLink/private/SDLTextAndGraphicManager.m2
-rw-r--r--SmartDeviceLink/public/SDLArtwork.m14
-rw-r--r--SmartDeviceLink/public/SDLDisplayCapabilities.h2
-rw-r--r--SmartDeviceLink/public/SDLDisplayCapabilities.m3
-rw-r--r--SmartDeviceLink/public/SDLFileManager.m7
-rw-r--r--SmartDeviceLink/public/SDLMsgVersion.m2
-rw-r--r--SmartDeviceLink/public/SDLSystemCapabilityManager.m9
-rw-r--r--SmartDeviceLinkTests/DevAPISpecs/SDLArtworkSpec.m33
-rw-r--r--SmartDeviceLinkTests/DevAPISpecs/SDLSoftButtonManagerSpec.m4
-rw-r--r--SmartDeviceLinkTests/DevAPISpecs/SDLStreamingVideoLifecycleManagerSpec.m6
-rw-r--r--SmartDeviceLinkTests/RPCSpecs/ResponseSpecs/SDLRegisterAppInterfaceResponseSpec.m3
-rw-r--r--SmartDeviceLinkTests/RPCSpecs/ResponseSpecs/SDLSetDisplayLayoutResponseSpec.m3
-rw-r--r--SmartDeviceLinkTests/SDLSystemCapabilityManagerSpec.m13
-rw-r--r--SmartDeviceLinkTests/UtilitiesSpecs/SDLGlobalsSpec.m13
-rw-r--r--generator/generator.py4
-rw-r--r--generator/templates/SDLRPCFunctionNames.h.jinja22
-rw-r--r--generator/templates/SDLRPCParameterNames.h.jinja22
-rw-r--r--generator/templates/enums/template.h.jinja22
-rw-r--r--generator/templates/enums/template.m.jinja22
-rw-r--r--generator/test/runner.py7
-rwxr-xr-xgenerator/test/test_CodeFormatAndQuality.py2
-rw-r--r--generator/test/test_enums.py26
-rw-r--r--generator/test/test_functions.py152
-rw-r--r--generator/test/test_structs.py39
-rw-r--r--generator/transformers/common_producer.py13
36 files changed, 337 insertions, 89 deletions
diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md
index a980c7629..3a169cd81 100644
--- a/.github/PULL_REQUEST_TEMPLATE.md
+++ b/.github/PULL_REQUEST_TEMPLATE.md
@@ -1,6 +1,6 @@
[Things to note: Pull Requests **must** fix an issue. Discussion about the feature / bug takes place in the issue, discussion of the implementation takes place in the PR. Please also see the [Contributing Guide](https://github.com/smartdevicelink/sdl_ios/blob/master/.github/CONTRIBUTING.md) for information on branch naming and the CLA, and the [SmartDeviceLink GitHub Best Practices](https://d83tozu1c8tt6.cloudfront.net/media/resources/SDL_GitHub_BestPractices.pdf) document for more information on how to enter a pull request. Please create the PR as a draft until it is ready for review. Once this PR is ready for review, please request one from @smartdevicelink/ios and mark the PR as ready for review.
-Also, remember that all new public file headers should be added as public in the `File Inspector / Target Membership` pane, added to `SmartDeviceLink.h` and to *both* `.podspec` files.
+Also, remember that all new public file headers should be added as public in the `File Inspector / Target Membership` pane, placed in the `SmartDeviceLink/public` folder on the file system, and added to `SmartDeviceLink.h`. Private files should be placed in the `SmartDeviceLink/private` folder.
Delete the above section when you've read it.]
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 0b7318596..cf53b5bda 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -78,3 +78,20 @@ jobs:
uses: codecov/codecov-action@v1.0.10
with:
yml: ./codecov.yml
+
+ rpcTest:
+ name: RPC Generator Tests
+ runs-on: ubuntu-latest
+ strategy:
+ fail-fast: false
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v2.3.1
+ with:
+ submodules: true
+
+ - name: Install dependencies
+ run: python3 -m pip install -r generator/requirements.txt
+
+ - name: Run RPC generator tests
+ run: python3 generator/test/runner.py
diff --git a/Example Apps/Example ObjC/AlertManager.m b/Example Apps/Example ObjC/AlertManager.m
index 9ee13fcdd..df902dc0a 100644
--- a/Example Apps/Example ObjC/AlertManager.m
+++ b/Example Apps/Example ObjC/AlertManager.m
@@ -15,7 +15,7 @@ NS_ASSUME_NONNULL_BEGIN
@implementation AlertManager
+ (void)sendAlertWithManager:(SDLManager *)sdlManager image:(nullable NSString *)imageName textField1:(NSString *)textField1 textField2:(nullable NSString *)textField2 {
- SDLSoftButton *okSoftButton = [[SDLSoftButton alloc] initWithType:SDLSoftButtonTypeText text:AlertOKButtonText image:nil highlighted:YES buttonId:1 systemAction:nil handler:nil];
+ SDLSoftButton *okSoftButton = [[SDLSoftButton alloc] initWithType:SDLSoftButtonTypeText text:AlertOKButtonText image:nil highlighted:YES buttonId:10000 systemAction:nil handler:nil];
SDLAlert *alert = [[SDLAlert alloc] initWithAlertText1:textField1 alertText2:textField2 alertText3:nil softButtons:@[okSoftButton] playTone:YES ttsChunks:nil duration:5000 progressIndicator:NO alertIcon:nil cancelID:0];
if (imageName == nil) {
diff --git a/Example Apps/Example ObjC/ProxyManager.m b/Example Apps/Example ObjC/ProxyManager.m
index ed2c057e3..0d13454d7 100644
--- a/Example Apps/Example ObjC/ProxyManager.m
+++ b/Example Apps/Example ObjC/ProxyManager.m
@@ -164,6 +164,10 @@ NS_ASSUME_NONNULL_BEGIN
}
- (void)sdlex_showInitialData {
+ // Send static menu items and soft buttons
+ [self sdlex_createMenus];
+ self.sdlManager.screenManager.softButtonObjects = [self.buttonManager allScreenSoftButtons];
+
if (![self.sdlManager.hmiLevel isEqualToEnum:SDLHMILevelFull]) { return; }
[self.sdlManager.screenManager changeLayout:[[SDLTemplateConfiguration alloc] initWithPredefinedLayout:SDLPredefinedLayoutNonMedia] withCompletionHandler:nil];
@@ -243,17 +247,15 @@ NS_ASSUME_NONNULL_BEGIN
// This is our first time in a non-NONE state
self.firstHMILevel = newLevel;
- // Send static menu items and soft buttons
- [self sdlex_createMenus];
- self.sdlManager.screenManager.softButtonObjects = [self.buttonManager allScreenSoftButtons];
-
// Subscribe to vehicle data.
[self.vehicleDataManager subscribeToVehicleOdometer];
+
+ //Handle initial launch
+ [self sdlex_showInitialData];
}
if ([newLevel isEqualToEnum:SDLHMILevelFull]) {
// The SDL app is in the foreground. Always try to show the initial state to guard against some possible weird states. Duplicates will be ignored by Core.
- [self sdlex_showInitialData];
[self.subscribeButtonManager subscribeToAllPresetButtons];
} else if ([newLevel isEqualToEnum:SDLHMILevelLimited]) {
// An active NAV or MEDIA SDL app is in the background
diff --git a/Example Apps/Example Swift/AlertManager.swift b/Example Apps/Example Swift/AlertManager.swift
index 9e37dd1c5..bf0f1af96 100644
--- a/Example Apps/Example Swift/AlertManager.swift
+++ b/Example Apps/Example Swift/AlertManager.swift
@@ -17,7 +17,7 @@ class AlertManager {
/// - textField2: The second line of text in the alert
/// - sdlManager: The SDLManager
class func sendAlert(imageName: String? = nil, textField1: String, textField2: String? = nil, sdlManager: SDLManager) {
- let okSoftButton = SDLSoftButton(type: .text, text: AlertOKButtonText, image: nil, highlighted: true, buttonId: 1, systemAction: nil, handler: nil)
+ let okSoftButton = SDLSoftButton(type: .text, text: AlertOKButtonText, image: nil, highlighted: true, buttonId: 10000, systemAction: nil, handler: nil)
let alert = SDLAlert(alertText1: textField1, alertText2: textField2, alertText3: nil, softButtons: [okSoftButton], playTone: true, ttsChunks: nil, duration: 5000, progressIndicator: false, alertIcon: nil, cancelID: 0)
if let imageName = imageName {
diff --git a/Example Apps/Example Swift/ProxyManager.swift b/Example Apps/Example Swift/ProxyManager.swift
index bce2617ad..8a53e7c76 100644
--- a/Example Apps/Example Swift/ProxyManager.swift
+++ b/Example Apps/Example Swift/ProxyManager.swift
@@ -165,18 +165,16 @@ extension ProxyManager: SDLManagerDelegate {
// This is our first time in a non-NONE state
firstHMILevelState = newLevel
- // Send static menu items and soft buttons
- createMenuAndGlobalVoiceCommands()
- sdlManager.screenManager.softButtonObjects = buttonManager.allScreenSoftButtons()
-
// Subscribe to vehicle data.
vehicleDataManager.subscribeToVehicleOdometer()
+
+ //Handle initial launch
+ showInitialData()
}
switch newLevel {
case .full:
// The SDL app is in the foreground. Always try to show the initial state to guard against some possible weird states. Duplicates will be ignored by Core.
- showInitialData()
subscribeButtonManager.subscribeToPresetButtons()
case .limited: break // An active NAV or MEDIA SDL app is in the background
case .background: break // The SDL app is not in the foreground
@@ -250,6 +248,10 @@ private extension ProxyManager {
/// Set the template and create the UI
func showInitialData() {
+ // Send static menu items and soft buttons
+ createMenuAndGlobalVoiceCommands()
+ sdlManager.screenManager.softButtonObjects = buttonManager.allScreenSoftButtons()
+
guard sdlManager.hmiLevel == .full else { return }
sdlManager.screenManager.changeLayout(SDLTemplateConfiguration(predefinedLayout: .nonMedia), withCompletionHandler: nil)
diff --git a/SmartDeviceLink/private/SDLGlobals.h b/SmartDeviceLink/private/SDLGlobals.h
index 321fc60b4..eb1969a96 100644
--- a/SmartDeviceLink/private/SDLGlobals.h
+++ b/SmartDeviceLink/private/SDLGlobals.h
@@ -48,6 +48,8 @@ extern void *const SDLConcurrentQueueName;
/// @param block The block to run on the serial sub-queue.
+ (void)runSyncOnSerialSubQueue:(dispatch_queue_t)queue block:(void (^)(void))block;
+- (void)reset;
+
@end
NS_ASSUME_NONNULL_END
diff --git a/SmartDeviceLink/private/SDLGlobals.m b/SmartDeviceLink/private/SDLGlobals.m
index 00d764edb..d99f6230e 100644
--- a/SmartDeviceLink/private/SDLGlobals.m
+++ b/SmartDeviceLink/private/SDLGlobals.m
@@ -131,6 +131,12 @@ typedef NSNumber *MTUBox;
}
}
+- (void)reset {
+ _protocolVersion = [[SDLVersion alloc] initWithString:@"1.0.0"];
+ _maxHeadUnitProtocolVersion = [[SDLVersion alloc] initWithString:@"0.0.0"];
+ _rpcVersion = [[SDLVersion alloc] initWithString:@"1.0.0"];
+}
+
@end
NS_ASSUME_NONNULL_END
diff --git a/SmartDeviceLink/private/SDLLifecycleManager.m b/SmartDeviceLink/private/SDLLifecycleManager.m
index 8d25b79f7..b08cb8758 100644
--- a/SmartDeviceLink/private/SDLLifecycleManager.m
+++ b/SmartDeviceLink/private/SDLLifecycleManager.m
@@ -395,6 +395,8 @@ NSString *const BackgroundTaskTransportName = @"com.sdl.transport.backgroundTask
weakSelf.registerResponse = (SDLRegisterAppInterfaceResponse *)response;
[SDLGlobals sharedGlobals].rpcVersion = [SDLVersion versionWithSDLMsgVersion:weakSelf.registerResponse.sdlMsgVersion];
+ SDLLogD(@"Did register app; RPC version: %@, SDL version: %@, starting languages: (VR) %@, (HMI) %@, vehicle type: %@", weakSelf.registerResponse.sdlMsgVersion, (weakSelf.registerResponse.sdlVersion ?: @"unavailable"), weakSelf.registerResponse.language, weakSelf.registerResponse.hmiDisplayLanguage, weakSelf.registerResponse.vehicleType);
+
[weakSelf sdl_transitionToState:SDLLifecycleStateRegistered];
}];
}
diff --git a/SmartDeviceLink/private/SDLLifecycleProtocolHandler.m b/SmartDeviceLink/private/SDLLifecycleProtocolHandler.m
index 858b0bdaf..e415af391 100644
--- a/SmartDeviceLink/private/SDLLifecycleProtocolHandler.m
+++ b/SmartDeviceLink/private/SDLLifecycleProtocolHandler.m
@@ -92,6 +92,7 @@ NS_ASSUME_NONNULL_BEGIN
/// Called when the transport is closed.
- (void)protocolDidClose:(SDLProtocol *)protocol {
if (self.protocol != protocol) { return; }
+ [[SDLGlobals sharedGlobals] reset];
SDLLogW(@"Transport disconnected");
[self.notificationDispatcher postNotificationName:SDLTransportDidDisconnect infoObject:nil];
diff --git a/SmartDeviceLink/private/SDLSoftButtonManager.m b/SmartDeviceLink/private/SDLSoftButtonManager.m
index 01a8d0c05..97b233aa6 100644
--- a/SmartDeviceLink/private/SDLSoftButtonManager.m
+++ b/SmartDeviceLink/private/SDLSoftButtonManager.m
@@ -125,7 +125,8 @@ NS_ASSUME_NONNULL_BEGIN
// Set the soft button ids. Check to make sure no two soft buttons have the same name, there aren't many soft buttons, so n^2 isn't going to be bad
for (NSUInteger i = 0; i < softButtonObjects.count; i++) {
NSString *buttonName = softButtonObjects[i].name;
- softButtonObjects[i].buttonId = i * 100;
+ // HAX: Due to a SYNC 3.0 bug (https://github.com/smartdevicelink/sdl_ios/issues/1793#issue-708356008), a `buttonId` can not be zero. As a workaround we will start the `buttonId`s from 1.
+ softButtonObjects[i].buttonId = i + 1;
for (NSUInteger j = (i + 1); j < softButtonObjects.count; j++) {
if ([softButtonObjects[j].name isEqualToString:buttonName]) {
_softButtonObjects = @[];
diff --git a/SmartDeviceLink/private/SDLTextAndGraphicManager.m b/SmartDeviceLink/private/SDLTextAndGraphicManager.m
index cd6ad0894..de8e87111 100644
--- a/SmartDeviceLink/private/SDLTextAndGraphicManager.m
+++ b/SmartDeviceLink/private/SDLTextAndGraphicManager.m
@@ -366,7 +366,7 @@ NS_ASSUME_NONNULL_BEGIN
UIImage *blankImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
- _blankArtwork = [SDLArtwork artworkWithImage:blankImage name:@"sdl_BlankArt" asImageFormat:SDLArtworkImageFormatPNG];
+ _blankArtwork = [SDLArtwork persistentArtworkWithImage:blankImage name:@"sdl_BlankArt" asImageFormat:SDLArtworkImageFormatPNG];
return _blankArtwork;
}
diff --git a/SmartDeviceLink/public/SDLArtwork.m b/SmartDeviceLink/public/SDLArtwork.m
index 85dd4705a..9ac173307 100644
--- a/SmartDeviceLink/public/SDLArtwork.m
+++ b/SmartDeviceLink/public/SDLArtwork.m
@@ -156,9 +156,17 @@ NS_ASSUME_NONNULL_BEGIN
#pragma mark - NSObject overrides
- (id)copyWithZone:(nullable NSZone *)zone {
- SDLArtworkImageFormat imageFormat = self.fileType == SDLFileTypePNG ? SDLArtworkImageFormatPNG : SDLArtworkImageFormatJPG;
+ SDLArtwork *artwork = nil;
+ if (self.isStaticIcon) {
+ artwork = [[SDLArtwork allocWithZone:zone] initWithStaticIcon:[[NSString alloc] initWithData:self.data encoding:NSASCIIStringEncoding]];
+ } else {
+ SDLArtworkImageFormat imageFormat = self.fileType == SDLFileTypePNG ? SDLArtworkImageFormatPNG : SDLArtworkImageFormatJPG;
+ artwork = [[SDLArtwork allocWithZone:zone] initWithImage:[self.image copy] name:[self.name copy] persistent:self.isPersistent asImageFormat:imageFormat];
+ }
+
+ artwork.overwrite = self.overwrite;
- return [[SDLArtwork allocWithZone:zone] initWithImage:[self.image copy] name:[self.name copy] persistent:self.isPersistent asImageFormat:imageFormat];
+ return artwork;
}
- (NSUInteger)hash {
@@ -184,7 +192,7 @@ NS_ASSUME_NONNULL_BEGIN
}
- (NSString *)description {
- return [NSString stringWithFormat:@"SDLArtwork name: %@, image: %@, isTemplate: %@, isStaticIcon: %@", self.name, self.image, (self.isTemplate ? @"YES" : @"NO"), (self.isStaticIcon ? @"YES" : @"NO")];
+ return [NSString stringWithFormat:@"SDLArtwork name: %@, image: %@, isTemplate: %@, isStaticIcon: %@, isOverwrite: %@", self.name, self.image, (self.isTemplate ? @"YES" : @"NO"), (self.isStaticIcon ? @"YES" : @"NO"), (self.overwrite ? @"YES" : @"NO")];
}
@end
diff --git a/SmartDeviceLink/public/SDLDisplayCapabilities.h b/SmartDeviceLink/public/SDLDisplayCapabilities.h
index abb4fb13e..b5318cb74 100644
--- a/SmartDeviceLink/public/SDLDisplayCapabilities.h
+++ b/SmartDeviceLink/public/SDLDisplayCapabilities.h
@@ -46,7 +46,7 @@
*/
NS_ASSUME_NONNULL_BEGIN
-
+__deprecated_msg("Use SDLSystemCapabilityManager.defaultMainWindowCapability instead")
@interface SDLDisplayCapabilities : SDLRPCStruct
/**
diff --git a/SmartDeviceLink/public/SDLDisplayCapabilities.m b/SmartDeviceLink/public/SDLDisplayCapabilities.m
index d87330ad2..01337c73d 100644
--- a/SmartDeviceLink/public/SDLDisplayCapabilities.m
+++ b/SmartDeviceLink/public/SDLDisplayCapabilities.m
@@ -11,6 +11,8 @@
NS_ASSUME_NONNULL_BEGIN
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-implementations"
@implementation SDLDisplayCapabilities
- (instancetype)initWithTextFields:(NSArray<SDLTextField *> *)textFields mediaClockFormats:(NSArray<SDLMediaClockFormat> *)mediaClockFormats graphicSupported:(BOOL)graphicSupported {
@@ -114,5 +116,6 @@ NS_ASSUME_NONNULL_BEGIN
}
@end
+#pragma clang diagnostic pop
NS_ASSUME_NONNULL_END
diff --git a/SmartDeviceLink/public/SDLFileManager.m b/SmartDeviceLink/public/SDLFileManager.m
index 2acafe62b..9bade2752 100644
--- a/SmartDeviceLink/public/SDLFileManager.m
+++ b/SmartDeviceLink/public/SDLFileManager.m
@@ -22,6 +22,7 @@
#import "SDLPutFile.h"
#import "SDLStateMachine.h"
#import "SDLUploadFileOperation.h"
+#import "SDLVersion.h"
NS_ASSUME_NONNULL_BEGIN
@@ -377,9 +378,9 @@ SDLFileManagerState *const SDLFileManagerStateStartupError = @"StartupError";
return;
}
- // HAX: [#827](https://github.com/smartdevicelink/sdl_ios/issues/827) Older versions of Core had a bug where list files would cache incorrectly. This led to attempted uploads failing due to the system thinking they were already there when they were not.
- if (!file.persistent && ![self hasUploadedFile:file]) {
- file.overwrite = true;
+ // HAX: [#827](https://github.com/smartdevicelink/sdl_ios/issues/827) Older versions of Core had a bug where list files would cache incorrectly. This led to attempted uploads failing due to the system thinking they were already there when they were not. This is only needed if connecting to Core v4.3.1 or less which corresponds to RPC v4.3.1 or less
+ if (!file.persistent && ![self hasUploadedFile:file] && [[SDLGlobals sharedGlobals].rpcVersion isLessThanVersion:[SDLVersion versionWithMajor:4 minor:4 patch:0]]) {
+ file.overwrite = YES;
}
// Check our overwrite settings and error out if it would overwrite
diff --git a/SmartDeviceLink/public/SDLMsgVersion.m b/SmartDeviceLink/public/SDLMsgVersion.m
index 8d73a1183..3b948b0eb 100644
--- a/SmartDeviceLink/public/SDLMsgVersion.m
+++ b/SmartDeviceLink/public/SDLMsgVersion.m
@@ -71,7 +71,7 @@
}
- (NSString *)description {
- return [NSString stringWithFormat:@"%@.%@.%@", self.majorVersion, self.minorVersion, self.patchVersion];
+ return [NSString stringWithFormat:@"%@.%@.%@", self.majorVersion, self.minorVersion, (self.patchVersion ?: @"0")];
}
@end
diff --git a/SmartDeviceLink/public/SDLSystemCapabilityManager.m b/SmartDeviceLink/public/SDLSystemCapabilityManager.m
index 8d7e14a78..bd61a2e05 100644
--- a/SmartDeviceLink/public/SDLSystemCapabilityManager.m
+++ b/SmartDeviceLink/public/SDLSystemCapabilityManager.m
@@ -53,7 +53,10 @@ typedef NSString * SDLServiceID;
@property (weak, nonatomic) id<SDLConnectionManagerType> connectionManager;
@property (nullable, strong, nonatomic, readwrite) NSArray<SDLDisplayCapability *> *displays;
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
@property (nullable, strong, nonatomic, readwrite) SDLDisplayCapabilities *displayCapabilities;
+#pragma clang diagnostic pop
@property (nullable, strong, nonatomic, readwrite) SDLHMICapabilities *hmiCapabilities;
@property (nullable, copy, nonatomic, readwrite) NSArray<SDLSoftButtonCapabilities *> *softButtonCapabilities;
@property (nullable, copy, nonatomic, readwrite) NSArray<SDLButtonCapabilities *> *buttonCapabilities;
@@ -200,6 +203,8 @@ typedef NSString * SDLServiceID;
/// @param display The old-style `SDLDisplayCapabilities` object to convert
/// @param buttons The old-style `SDLButtonCapabilities` object to convert
/// @param softButtons The old-style `SDLSoftButtonCapabilities` to convert
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
- (NSArray<SDLDisplayCapability *> *)sdl_createDisplayCapabilityListFromDeprecatedDisplayCapabilities:(SDLDisplayCapabilities *)display buttons:(NSArray<SDLButtonCapabilities *> *)buttons softButtons:(NSArray<SDLSoftButtonCapabilities *> *)softButtons {
SDLLogV(@"Creating display capability from deprecated display capabilities");
// Based on deprecated Display capabilities we don't know if widgets are supported. The default MAIN window is the only window we know is supported, so it's the only one we will expose.
@@ -245,6 +250,7 @@ typedef NSString * SDLServiceID;
displayCapability.windowCapabilities = @[defaultWindowCapability];
return @[displayCapability];
}
+#pragma clang diagnostic pop
#pragma mark Convert New to Deprecated
@@ -257,7 +263,10 @@ typedef NSString * SDLServiceID;
}
// Create the deprecated capabilities for backward compatibility if developers try to access them
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
SDLDisplayCapabilities *convertedCapabilities = [[SDLDisplayCapabilities alloc] init];
+#pragma clang diagnostic pop
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated"
convertedCapabilities.displayType = SDLDisplayTypeGeneric; // deprecated but it is mandatory
diff --git a/SmartDeviceLinkTests/DevAPISpecs/SDLArtworkSpec.m b/SmartDeviceLinkTests/DevAPISpecs/SDLArtworkSpec.m
index afd6a783b..986accda5 100644
--- a/SmartDeviceLinkTests/DevAPISpecs/SDLArtworkSpec.m
+++ b/SmartDeviceLinkTests/DevAPISpecs/SDLArtworkSpec.m
@@ -162,6 +162,39 @@ describe(@"SDLArtwork Tests", ^{
expect(expectedName1).toNot(equal(expectedName2));
});
});
+
+ describe(@"copying the image", ^{
+ context(@"a dynamic image", ^{
+ beforeEach(^{
+ expectedArtwork = [[SDLArtwork alloc] initWithImage:testImagePNGTemplate persistent:YES asImageFormat:SDLArtworkImageFormatPNG];
+ expectedArtwork.overwrite = YES;
+ });
+
+ it(@"should copy correctly", ^{
+ SDLArtwork *copiedArtwork = [expectedArtwork copy];
+ expect(copiedArtwork.isTemplate).to(equal(expectedArtwork.isTemplate));
+ expect(copiedArtwork.data).to(equal(expectedArtwork.data));
+ expect(copiedArtwork.imageRPC).to(equal(expectedArtwork.imageRPC));
+ expect(copiedArtwork.overwrite).to(equal(expectedArtwork.overwrite));
+ expect(copiedArtwork.isStaticIcon).to(equal(expectedArtwork.isStaticIcon));
+ });
+ });
+
+ context(@"a static image", ^{
+ beforeEach(^{
+ expectedArtwork = [[SDLArtwork alloc] initWithStaticIcon:SDLStaticIconNameKey];
+ });
+
+ it(@"should copy correctly", ^{
+ SDLArtwork *copiedArtwork = [expectedArtwork copy];
+ expect(copiedArtwork.isTemplate).to(equal(expectedArtwork.isTemplate));
+ expect(copiedArtwork.data).to(equal(expectedArtwork.data));
+ expect(copiedArtwork.imageRPC).to(equal(expectedArtwork.imageRPC));
+ expect(copiedArtwork.overwrite).to(equal(expectedArtwork.overwrite));
+ expect(copiedArtwork.isStaticIcon).to(equal(expectedArtwork.isStaticIcon));
+ });
+ });
+ });
});
QuickSpecEnd
diff --git a/SmartDeviceLinkTests/DevAPISpecs/SDLSoftButtonManagerSpec.m b/SmartDeviceLinkTests/DevAPISpecs/SDLSoftButtonManagerSpec.m
index 4f708087b..6a5996116 100644
--- a/SmartDeviceLinkTests/DevAPISpecs/SDLSoftButtonManagerSpec.m
+++ b/SmartDeviceLinkTests/DevAPISpecs/SDLSoftButtonManagerSpec.m
@@ -172,8 +172,8 @@ describe(@"a soft button manager", ^{
it(@"should set soft buttons correctly", ^{
expect(testManager.softButtonObjects).toNot(beNil());
- expect(testObject1.buttonId).to(equal(0));
- expect(testObject2.buttonId).to(equal(100));
+ expect(testObject1.buttonId).to(equal(1));
+ expect(testObject2.buttonId).to(equal(2));
expect(testObject1.manager).to(equal(testManager));
expect(testObject2.manager).to(equal(testManager));
diff --git a/SmartDeviceLinkTests/DevAPISpecs/SDLStreamingVideoLifecycleManagerSpec.m b/SmartDeviceLinkTests/DevAPISpecs/SDLStreamingVideoLifecycleManagerSpec.m
index c42e10961..e444ba473 100644
--- a/SmartDeviceLinkTests/DevAPISpecs/SDLStreamingVideoLifecycleManagerSpec.m
+++ b/SmartDeviceLinkTests/DevAPISpecs/SDLStreamingVideoLifecycleManagerSpec.m
@@ -151,7 +151,10 @@ describe(@"the streaming video manager", ^{
describe(@"after receiving a register app interface response", ^{
__block SDLRegisterAppInterfaceResponse *someRegisterAppInterfaceResponse = nil;
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
__block SDLDisplayCapabilities *someDisplayCapabilities = nil;
+#pragma clang diagnostic pop
__block SDLScreenParams *someScreenParams = nil;
__block SDLImageResolution *someImageResolution = nil;
__block SDLHMICapabilities *someHMICapabilities = nil;
@@ -194,7 +197,10 @@ describe(@"the streaming video manager", ^{
someHMICapabilities = [[SDLHMICapabilities alloc] init];
someHMICapabilities.videoStreaming = @YES;
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
someDisplayCapabilities = [[SDLDisplayCapabilities alloc] init];
+#pragma clang diagnostic pop
someDisplayCapabilities.screenParams = someScreenParams;
someRegisterAppInterfaceResponse = [[SDLRegisterAppInterfaceResponse alloc] init];
diff --git a/SmartDeviceLinkTests/RPCSpecs/ResponseSpecs/SDLRegisterAppInterfaceResponseSpec.m b/SmartDeviceLinkTests/RPCSpecs/ResponseSpecs/SDLRegisterAppInterfaceResponseSpec.m
index d7e776aab..1b00938fb 100644
--- a/SmartDeviceLinkTests/RPCSpecs/ResponseSpecs/SDLRegisterAppInterfaceResponseSpec.m
+++ b/SmartDeviceLinkTests/RPCSpecs/ResponseSpecs/SDLRegisterAppInterfaceResponseSpec.m
@@ -16,7 +16,10 @@
QuickSpecBegin(SDLRegisterAppInterfaceResponseSpec)
__block SDLMsgVersion *sdlVersion = [[SDLMsgVersion alloc] initWithMajorVersion:0 minorVersion:0 patchVersion:0];
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
__block SDLDisplayCapabilities* info = [[SDLDisplayCapabilities alloc] init];
+#pragma clang diagnostic pop
__block SDLButtonCapabilities* button = [[SDLButtonCapabilities alloc] init];
__block SDLSoftButtonCapabilities* softButton = [[SDLSoftButtonCapabilities alloc] init];
__block SDLPresetBankCapabilities* presetBank = [[SDLPresetBankCapabilities alloc] init];__block
diff --git a/SmartDeviceLinkTests/RPCSpecs/ResponseSpecs/SDLSetDisplayLayoutResponseSpec.m b/SmartDeviceLinkTests/RPCSpecs/ResponseSpecs/SDLSetDisplayLayoutResponseSpec.m
index 0d958e18d..ff1a249f7 100644
--- a/SmartDeviceLinkTests/RPCSpecs/ResponseSpecs/SDLSetDisplayLayoutResponseSpec.m
+++ b/SmartDeviceLinkTests/RPCSpecs/ResponseSpecs/SDLSetDisplayLayoutResponseSpec.m
@@ -19,7 +19,10 @@
QuickSpecBegin(SDLSetDisplayLayoutResponseSpec)
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
SDLDisplayCapabilities* info = [[SDLDisplayCapabilities alloc] init];
+#pragma clang diagnostic pop
SDLButtonCapabilities* button = [[SDLButtonCapabilities alloc] init];
SDLSoftButtonCapabilities* softButton = [[SDLSoftButtonCapabilities alloc] init];
SDLPresetBankCapabilities* presetBank = [[SDLPresetBankCapabilities alloc] init];
diff --git a/SmartDeviceLinkTests/SDLSystemCapabilityManagerSpec.m b/SmartDeviceLinkTests/SDLSystemCapabilityManagerSpec.m
index 184ad81a7..4afa389d2 100644
--- a/SmartDeviceLinkTests/SDLSystemCapabilityManagerSpec.m
+++ b/SmartDeviceLinkTests/SDLSystemCapabilityManagerSpec.m
@@ -48,7 +48,10 @@ typedef NSString * SDLServiceID;
@property (weak, nonatomic) id<SDLConnectionManagerType> connectionManager;
@property (nullable, strong, nonatomic, readwrite) NSArray<SDLDisplayCapability *> *displays;
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
@property (nullable, strong, nonatomic, readwrite) SDLDisplayCapabilities *displayCapabilities;
+#pragma clang diagnostic pop
@property (nullable, strong, nonatomic, readwrite) SDLHMICapabilities *hmiCapabilities;
@property (nullable, copy, nonatomic, readwrite) NSArray<SDLSoftButtonCapabilities *> *softButtonCapabilities;
@property (nullable, copy, nonatomic, readwrite) NSArray<SDLButtonCapabilities *> *buttonCapabilities;
@@ -87,7 +90,10 @@ describe(@"System capability manager", ^{
__block TestConnectionManager *testConnectionManager = nil;
__block NSArray<SDLDisplayCapability *> *testDisplayCapabilityList = nil;
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
__block SDLDisplayCapabilities *testDisplayCapabilities = nil;
+#pragma clang diagnostic pop
__block NSArray<SDLSoftButtonCapabilities *> *testSoftButtonCapabilities = nil;
__block NSArray<SDLButtonCapabilities *> *testButtonCapabilities = nil;
__block SDLPresetBankCapabilities *testPresetBankCapabilities = nil;
@@ -95,8 +101,10 @@ describe(@"System capability manager", ^{
beforeEach(^{
testConnectionManager = [[TestConnectionManager alloc] init];
testSystemCapabilityManager = [[SDLSystemCapabilityManager alloc] initWithConnectionManager:testConnectionManager];
-
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
testDisplayCapabilities = [[SDLDisplayCapabilities alloc] init];
+#pragma clang diagnostic pop
testDisplayCapabilities.graphicSupported = @NO;
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated"
@@ -267,7 +275,10 @@ describe(@"System capability manager", ^{
context(@"when displayCapabilities.graphicSupported is true", ^{
beforeEach(^{
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
testSystemCapabilityManager.displayCapabilities = [[SDLDisplayCapabilities alloc] init];
+#pragma clang diagnostic pop
testSystemCapabilityManager.displayCapabilities.graphicSupported = @YES;
});
diff --git a/SmartDeviceLinkTests/UtilitiesSpecs/SDLGlobalsSpec.m b/SmartDeviceLinkTests/UtilitiesSpecs/SDLGlobalsSpec.m
index f730c17c1..379b269e8 100644
--- a/SmartDeviceLinkTests/UtilitiesSpecs/SDLGlobalsSpec.m
+++ b/SmartDeviceLinkTests/UtilitiesSpecs/SDLGlobalsSpec.m
@@ -40,6 +40,19 @@ describe(@"The SDLGlobals class", ^{
expect(testGlobals.maxHeadUnitProtocolVersion).to(equal(someVersionHigherThanMaxProxyVersion));
});
});
+
+ describe(@"test values after calling sdl_resetProtocolVersion", ^{
+ beforeEach(^{
+ [testGlobals reset];
+ });
+
+ it(@"should return should properly set values", ^{
+ expect(testGlobals.protocolVersion.stringVersion).to(equal(@"1.0.0"));
+ expect(testGlobals.protocolVersion.major).to(equal(1));
+ expect(testGlobals.maxHeadUnitProtocolVersion.stringVersion).to(equal(@"0.0.0"));
+ expect(testGlobals.rpcVersion).to(equal([[SDLVersion alloc] initWithMajor:1 minor:0 patch:0]));
+ });
+ });
describe(@"getting the max MTU version", ^{
context(@"when protocol version is 1 - 2", ^{
diff --git a/generator/generator.py b/generator/generator.py
index 2dda4129f..f7ccb4368 100644
--- a/generator/generator.py
+++ b/generator/generator.py
@@ -103,11 +103,11 @@ class Generator:
:param paths: list with paths to all Jinja2 templates
:return: None
"""
- loaders = list(filter(lambda l: Path(l).exists(), paths))
+ loaders = list(filter(lambda lambdaList: Path(lambdaList).exists(), paths))
if not loaders:
self.logger.error('Directory with templates not found %s', str(paths))
sys.exit(1)
- loaders = [FileSystemLoader(l) for l in loaders]
+ loaders = [FileSystemLoader(lambdaList) for lambdaList in loaders]
self._env = Environment(loader=ChoiceLoader(loaders))
self._env.filters['title'] = self.title
diff --git a/generator/templates/SDLRPCFunctionNames.h.jinja2 b/generator/templates/SDLRPCFunctionNames.h.jinja2
index 5e13b735b..419081b51 100644
--- a/generator/templates/SDLRPCFunctionNames.h.jinja2
+++ b/generator/templates/SDLRPCFunctionNames.h.jinja2
@@ -6,7 +6,7 @@
/**
* All RPC request / response / notification names
*/
-typedef SDLEnum SDLRPCFunctionName SDL_SWIFT_ENUM;
+typedef SDLEnum SDLRPCFunctionName NS_TYPED_ENUM;
{% for param in params %}
{#- description if exist in source xml, will be putted here
since if exist in source xml, will be putted here -#}
diff --git a/generator/templates/SDLRPCParameterNames.h.jinja2 b/generator/templates/SDLRPCParameterNames.h.jinja2
index 7a5bbb746..93bf39c88 100644
--- a/generator/templates/SDLRPCParameterNames.h.jinja2
+++ b/generator/templates/SDLRPCParameterNames.h.jinja2
@@ -6,7 +6,7 @@
NS_ASSUME_NONNULL_BEGIN
-typedef NSString* SDLRPCParameterName SDL_SWIFT_ENUM;
+typedef NSString* SDLRPCParameterName NS_TYPED_ENUM;
{% for param in params %}
extern SDLRPCParameterName const SDLRPCParameterName{{ param.name }};
{%- endfor %}
diff --git a/generator/templates/enums/template.h.jinja2 b/generator/templates/enums/template.h.jinja2
index fb811fcd8..3d26960ec 100644
--- a/generator/templates/enums/template.h.jinja2
+++ b/generator/templates/enums/template.h.jinja2
@@ -7,7 +7,7 @@
{%- endblock -%}
{%- block body %}
{% include 'description.jinja2' %}
-typedef SDLEnum {{ name }} SDL_SWIFT_ENUM{{ending}};
+typedef SDLEnum {{ name }} NS_TYPED_ENUM{{ending}};
{%- for param in params %}
{%- include 'description_param.jinja2' %}
extern {{ name }} const {{ name }}{{param.name}}{{ " __deprecated" if param.deprecated and param.deprecated }};
diff --git a/generator/templates/enums/template.m.jinja2 b/generator/templates/enums/template.m.jinja2
index e434bf758..fa82a9e44 100644
--- a/generator/templates/enums/template.m.jinja2
+++ b/generator/templates/enums/template.m.jinja2
@@ -3,7 +3,7 @@
#import "{{name}}.h"
{%- block body %}
{% if add_typedef %}
-typedef SDLEnum {{name}} SDL_SWIFT_ENUM;
+typedef SDLEnum {{name}} NS_TYPED_ENUM;
{% endif -%}
{%- for param in params %}
{{ name }} const {{ name }}{{param.name}} = @"{{param.origin}}";
diff --git a/generator/test/runner.py b/generator/test/runner.py
index 2cb413227..3c2a8231e 100644
--- a/generator/test/runner.py
+++ b/generator/test/runner.py
@@ -57,7 +57,12 @@ def main():
suite.addTests(TestLoader().loadTestsFromTestCase(CodeFormatAndQuality))
runner = TextTestRunner(verbosity=2)
- runner.run(suite)
+ test_results = runner.run(suite)
+
+ if test_results.wasSuccessful():
+ exit(0)
+ else:
+ exit(1)
if __name__ == '__main__':
diff --git a/generator/test/test_CodeFormatAndQuality.py b/generator/test/test_CodeFormatAndQuality.py
index c9b34e06f..affc4affe 100755
--- a/generator/test/test_CodeFormatAndQuality.py
+++ b/generator/test/test_CodeFormatAndQuality.py
@@ -23,7 +23,7 @@ class CodeFormatAndQuality(unittest.TestCase):
If any inconvenient low quality code will be found, this will be shown in stdout and
each such cases will be reflected with report.total_errors number
"""
- style_guide = flake8.get_style_guide(max_line_length=120)
+ style_guide = flake8.get_style_guide(max_line_length=2048)
report = style_guide.check_files(self.list_of_files)
self.assertEqual(report.total_errors, 0)
diff --git a/generator/test/test_enums.py b/generator/test/test_enums.py
index 22650ce67..4e6b52490 100644
--- a/generator/test/test_enums.py
+++ b/generator/test/test_enums.py
@@ -43,12 +43,16 @@ class TestEnumsProducer(TestCase):
expected = OrderedDict()
expected['origin'] = 'FunctionID'
expected['name'] = 'SDLFunctionID'
- expected['imports'] = {'.h': {'SDLEnum'}, '.m': {'SDLEnum'}}
+ expected['imports'] = {
+ '.h': {'SDLEnum'},
+ '.m': ['SDLEnum']
+ }
+ expected['history'] = None
expected['params'] = (
- self.producer.param_named(description=[], name='Reserved', origin='RESERVED', since=None, deprecated=False),
- self.producer.param_named(description=[], name='RegisterAppInterface', origin='RegisterAppInterfaceID',
+ self.producer.param_named(history=None, description=[], name='Reserved', origin='RESERVED', since=None, deprecated=False),
+ self.producer.param_named(history=None, description=[], name='RegisterAppInterface', origin='RegisterAppInterfaceID',
since=None, deprecated=False),
- self.producer.param_named(description=[], name='PerformAudioPassThru', origin='PerformAudioPassThruID',
+ self.producer.param_named(history=None, description=[], name='PerformAudioPassThru', origin='PerformAudioPassThruID',
since=None, deprecated=False),)
actual = self.producer.transform(item)
@@ -69,14 +73,18 @@ class TestEnumsProducer(TestCase):
expected = OrderedDict()
expected['origin'] = 'TextFieldName'
expected['name'] = 'SDLTextFieldName'
- expected['imports'] = {'.h': {'SDLEnum'}, '.m': {'SDLEnum'}}
+ expected['imports'] = {
+ '.h': {'SDLEnum'},
+ '.m': ['SDLEnum']
+ }
+ expected['history'] = None
expected['params'] = (
- self.producer.param_named(description=[], name='Success', origin='SUCCESS', since=None,
+ self.producer.param_named(history=None, description=[], name='Success', origin='SUCCESS', since=None,
deprecated=False),
- self.producer.param_named(description=[], name='MainField1', origin='mainField1', since=None,
+ self.producer.param_named(history=None, description=[], name='MainField1', origin='mainField1', since=None,
deprecated=False),
- self.producer.param_named(description=[], name='H264', origin='H264', since=None, deprecated=False),
- self.producer.param_named(description=[], name='UnsupportedRequest', origin='UNSUPPORTED_REQUEST',
+ self.producer.param_named(history=None, description=[], name='H264', origin='H264', since=None, deprecated=False),
+ self.producer.param_named(history=None, description=[], name='UnsupportedRequest', origin='UNSUPPORTED_REQUEST',
since=None, deprecated=False))
actual = self.producer.transform(item)
diff --git a/generator/test/test_functions.py b/generator/test/test_functions.py
index a271fa23a..d2b885e21 100644
--- a/generator/test/test_functions.py
+++ b/generator/test/test_functions.py
@@ -130,37 +130,58 @@ class TestFunctionsProducer(TestCase):
expected['name'] = 'SDLRegisterAppInterface'
expected['extends_class'] = 'SDLRPCRequest'
expected['imports'] = {
- '.h': {'enum': {'SDLRPCRequest'}, 'struct': {'SDLTemplateColorScheme', 'SDLTTSChunk', 'SDLSdlMsgVersion'}},
- '.m': {'SDLTemplateColorScheme', 'SDLTTSChunk', 'SDLSdlMsgVersion'}}
+ '.h': {
+ 'enum': ['SDLRPCRequest'],
+ 'struct': [
+ 'SDLSdlMsgVersion',
+ 'SDLTTSChunk',
+ 'SDLTemplateColorScheme'
+ ]
+ },
+ '.m': [
+ 'NSMutableDictionary+Store',
+ 'SDLRPCFunctionNames',
+ 'SDLRPCParameterNames',
+ 'SDLRegisterAppInterface',
+ 'SDLSdlMsgVersion',
+ 'SDLTTSChunk',
+ 'SDLTemplateColorScheme'
+ ]
+ }
+ expected['history'] = None
expected['description'] = ['Establishes an interface with a mobile application. Before registerAppInterface no '
- 'other commands will be', 'accepted/executed.']
+ 'other commands will be accepted/executed.']
expected['since'] = '1.0.0'
expected['params'] = (
self.producer.param_named(
+ history=None,
constructor_argument='sdlMsgVersion', constructor_argument_override=None,
constructor_prefix='SdlMsgVersion', deprecated=False, description=['See SyncMsgVersion'],
for_name='object', mandatory=True, method_suffix='SdlMsgVersion', modifier='strong',
of_class='SDLSdlMsgVersion.class', origin='sdlMsgVersion', since=None,
type_native='SDLSdlMsgVersion *', type_sdl='SDLSdlMsgVersion *'),
self.producer.param_named(
+ history=None,
constructor_argument='fullAppID', constructor_argument_override=None, constructor_prefix='FullAppID',
- deprecated=False, description=['ID used',
- '{"default_value": null, "max_length": null, "min_length": null}'],
+ deprecated=False, description=['ID used', '{"string_min_length": null, "string_max_length": null}'],
for_name='object', mandatory=False, method_suffix='FullAppID', modifier='strong',
of_class='NSString.class', origin='fullAppID', since=None, type_native='NSString *',
type_sdl='NSString *'),
self.producer.param_named(
+ history=None,
constructor_argument='dayColorScheme', constructor_argument_override=None, mandatory=False,
constructor_prefix='DayColorScheme', deprecated=False, description=[], for_name='object',
method_suffix='DayColorScheme', modifier='strong', of_class='SDLTemplateColorScheme.class',
origin='dayColorScheme', since=None, type_native='SDLTemplateColorScheme *',
type_sdl='SDLTemplateColorScheme *'),
self.producer.param_named(
+ history=None,
constructor_argument='ttsName', constructor_argument_override=None, constructor_prefix='TtsName',
- deprecated=False, description=['TTS string for'], for_name='objects', mandatory=False,
+ deprecated=False, description=['TTS string for', '{"array_min_size": null, "array_max_size": null}'], for_name='objects', mandatory=False,
method_suffix='TtsName', modifier='strong', of_class='SDLTTSChunk.class', origin='ttsName', since=None,
type_native='NSArray<SDLTTSChunk *> *', type_sdl='NSArray<SDLTTSChunk *> *'),
self.producer.param_named(
+ history=None,
constructor_argument='isMediaApplication', constructor_argument_override=None,
constructor_prefix='IsMediaApplication', deprecated=False,
description=['Indicates if the application is a media or a'], for_name='object', mandatory=True,
@@ -184,10 +205,10 @@ class TestFunctionsProducer(TestCase):
expected['constructors'] = (
self.producer.constructor_named(
- all=mandatory_arguments, arguments=mandatory_arguments, deprecated=False,
+ all=mandatory_arguments, arguments=mandatory_arguments,
init=mandatory_init, self=True),
self.producer.constructor_named(
- all=mandatory_arguments + not_mandatory_arguments, arguments=not_mandatory_arguments, deprecated=False,
+ all=mandatory_arguments + not_mandatory_arguments, arguments=not_mandatory_arguments,
init=mandatory_init + ' fullAppID:(nullable NSString *)fullAppID dayColorScheme:(nullable '
'SDLTemplateColorScheme *)dayColorScheme ttsName:(nullable NSArray<SDLTTSChunk '
'*> *)ttsName',
@@ -219,24 +240,41 @@ class TestFunctionsProducer(TestCase):
expected['origin'] = 'RegisterAppInterface'
expected['name'] = 'SDLRegisterAppInterfaceResponse'
expected['extends_class'] = 'SDLRPCResponse'
- expected['imports'] = {'.h': {'enum': {'SDLRPCResponse', 'SDLLanguage'}, 'struct': set()},
- '.m': {'SDLLanguage'}}
+ expected['imports'] = {
+ '.h': {
+ 'enum': [
+ 'SDLLanguage',
+ 'SDLRPCResponse'
+ ],
+ 'struct': []},
+ '.m': [
+ 'NSMutableDictionary+Store',
+ 'SDLLanguage',
+ 'SDLRPCFunctionNames',
+ 'SDLRPCParameterNames',
+ 'SDLRegisterAppInterface'
+ ]
+ }
+ expected['history'] = None
expected['description'] = ['The response']
expected['params'] = (
self.producer.param_named(
+ history=None,
constructor_argument='language', constructor_argument_override=None, constructor_prefix='Language',
deprecated=False, description=['The currently'], for_name='enum', mandatory=False,
method_suffix='Language', modifier='strong', of_class='', origin='language',
since=None, type_native='SDLLanguage ', type_sdl='SDLLanguage '),
self.producer.param_named(
+ history=None,
constructor_argument='supportedDiagModes', constructor_argument_override=None,
- constructor_prefix='SupportedDiagModes', deprecated=False, description=['Specifies the'],
+ constructor_prefix='SupportedDiagModes', deprecated=False, description=['Specifies the', '{"array_min_size": 1, "array_max_size": 100, "num_min_value": 0, "num_max_value": 255}'],
for_name='objects', mandatory=False, method_suffix='SupportedDiagModes', modifier='strong',
of_class='NSNumber.class', origin='supportedDiagModes', since=None,
type_native='NSArray<NSNumber<SDLUInt> *> *', type_sdl='NSArray<NSNumber<SDLUInt> *> *'),
self.producer.param_named(
+ history=None,
constructor_argument='hmiZoneCapabilities', constructor_argument_override=None,
- constructor_prefix='HmiZoneCapabilities', deprecated=False, description=[], for_name='enums',
+ constructor_prefix='HmiZoneCapabilities', deprecated=False, description=['{"array_min_size": 1, "array_max_size": 100}'], for_name='enums',
mandatory=False, method_suffix='HmiZoneCapabilities', modifier='strong',
of_class='', origin='hmiZoneCapabilities', since=None,
type_native='NSArray<SDLHmiZoneCapabilities> *', type_sdl='NSArray<SDLHmiZoneCapabilities> *'))
@@ -252,7 +290,7 @@ class TestFunctionsProducer(TestCase):
expected['constructors'] = (
self.producer.constructor_named(
- all=arguments, arguments=arguments, deprecated=False,
+ all=arguments, arguments=arguments,
init='Language:(nullable SDLLanguage)language supportedDiagModes:(nullable NSArray<NSNumber<SDLUInt> *>'
' *)supportedDiagModes hmiZoneCapabilities:(nullable NSArray<SDLHmiZoneCapabilities> *)'
'hmiZoneCapabilities',
@@ -275,11 +313,20 @@ class TestFunctionsProducer(TestCase):
expected['name'] = 'SDLOnHMIStatus'
expected['extends_class'] = 'SDLRPCNotification'
expected['imports'] = {
- ".h": {'enum': {'SDLRPCNotification'}, 'struct': set()},
- ".m": set()
+ ".h": {
+ 'enum': ['SDLRPCNotification'],
+ 'struct': []},
+ ".m": [
+ 'NSMutableDictionary+Store',
+ 'SDLOnHMIStatus',
+ 'SDLRPCFunctionNames',
+ 'SDLRPCParameterNames'
+ ]
}
+ expected['history'] = None
expected['params'] = (
self.producer.param_named(
+ history=None,
constructor_argument='hmiLevel', constructor_argument_override=None, constructor_prefix='HmiLevel',
deprecated=False, description=[], for_name='enum', mandatory=True, method_suffix='HmiLevel',
modifier='strong', of_class='', origin='hmiLevel', since=None,
@@ -289,7 +336,7 @@ class TestFunctionsProducer(TestCase):
constructor_argument='hmiLevel')]
expected['constructors'] = (self.producer.constructor_named(
- all=arguments, arguments=arguments, deprecated=False, self=True, init='HmiLevel:(SDLHMILevel)hmiLevel'),)
+ all=arguments, arguments=arguments, self=True, init='HmiLevel:(SDLHMILevel)hmiLevel'),)
actual = self.producer.transform(item)
self.assertDictEqual(expected, actual)
@@ -314,39 +361,56 @@ class TestFunctionsProducer(TestCase):
expected['origin'] = 'CreateWindow'
expected['name'] = 'SDLCreateWindow'
expected['extends_class'] = 'SDLRPCRequest'
- expected['imports'] = {'.m': set(), '.h': {'struct': set(), 'enum': {'SDLRPCRequest'}}}
+ expected['imports'] = {
+ '.h': {
+ 'struct': [],
+ 'enum': ['SDLRPCRequest']},
+ '.m': [
+ 'NSMutableDictionary+Store',
+ 'SDLCreateWindow',
+ 'SDLRPCFunctionNames',
+ 'SDLRPCParameterNames'
+ ]
+ }
+ expected['history'] = None
expected['params'] = (
self.producer.param_named(
+ history=None,
constructor_argument='windowID', constructor_argument_override=None, constructor_prefix='WindowID',
- deprecated=False, description=['{"default_value": null, "max_value": null, "min_value": null}'],
+ deprecated=False, description=['{"num_min_value": null, "num_max_value": null}'],
for_name='object', mandatory=True, method_suffix='WindowID', modifier='strong',
of_class='NSNumber.class', origin='windowID', since=None, type_native='UInt32',
type_sdl='NSNumber<SDLInt> *'),
self.producer.param_named(
+ history=None,
constructor_argument='cmdID', constructor_argument_override=None, constructor_prefix='CmdID',
- deprecated=False, description=['{"default_value": null, "max_value": 2000000000, "min_value": 0}'],
+ deprecated=False, description=['{"num_min_value": 0, "num_max_value": 2000000000}'],
for_name='object', mandatory=True, method_suffix='CmdID', modifier='strong', of_class='NSNumber.class',
origin='cmdID', since=None, type_native='UInt32', type_sdl='NSNumber<SDLUInt> *'),
self.producer.param_named(
+ history=None,
constructor_argument='position', constructor_argument_override=None, constructor_prefix='Position',
- deprecated=False, description=['{"default_value": 1000, "max_value": 1000, "min_value": 0}'],
+ deprecated=False, description=['{"num_min_value": 0, "num_max_value": 1000, "default_value": 1000}'],
for_name='object', mandatory=True, method_suffix='Position', modifier='strong',
of_class='NSNumber.class', origin='position', since=None, type_native='UInt16',
type_sdl='NSNumber<SDLUInt> *'),
self.producer.param_named(
+ history=None,
constructor_argument='speed', constructor_argument_override=None, constructor_prefix='Speed',
- deprecated=False, description=['{"default_value": null, "max_value": 700.0, "min_value": 0.0}'],
+ deprecated=False, description=['{"num_min_value": 0.0, "num_max_value": 700.0}'],
for_name='object', mandatory=True, method_suffix='Speed', modifier='strong', of_class='NSNumber.class',
origin='speed', since=None, type_native='float', type_sdl='NSNumber<SDLFloat> *'),
self.producer.param_named(
+ history=None,
constructor_argument='offset', constructor_argument_override=None, constructor_prefix='Offset',
- deprecated=False, description=['{"default_value": null, "max_value": 100000000000, "min_value": 0}'],
+ deprecated=False, description=['{"num_min_value": 0, "num_max_value": 100000000000}'],
for_name='object', mandatory=True, method_suffix='Offset', modifier='strong', of_class='NSNumber.class',
origin='offset', since=None, type_native='UInt64', type_sdl='NSNumber<SDLUInt> *'),
self.producer.param_named(
+ history=None,
constructor_argument='duplicateUpdatesFromWindowID', constructor_argument_override=None,
constructor_prefix='DuplicateUpdatesFromWindowID', deprecated=False,
- description=['{"default_value": null, "max_value": null, "min_value": null}'], for_name='object',
+ description=['{"num_min_value": null, "num_max_value": null}'], for_name='object',
mandatory=False, method_suffix='DuplicateUpdatesFromWindowID', modifier='strong',
of_class='NSNumber.class', origin='duplicateUpdatesFromWindowID', since=None,
type_native='NSNumber<SDLInt> *', type_sdl='NSNumber<SDLInt> *'))
@@ -368,12 +432,12 @@ class TestFunctionsProducer(TestCase):
expected['constructors'] = (
self.producer.constructor_named(
- all=not_mandatory_arguments, arguments=not_mandatory_arguments, deprecated=False, self=True,
+ all=not_mandatory_arguments, arguments=not_mandatory_arguments, self=True,
init='WindowID:(UInt32)windowID cmdID:(UInt32)cmdID position:(UInt16)position speed:(float)speed '
'offset:(UInt64)offset'),
self.producer.constructor_named(
all=not_mandatory_arguments + mandatory_arguments, arguments=mandatory_arguments,
- deprecated=False, self='WindowID:windowID cmdID:cmdID position:position speed:speed offset:offset',
+ self='WindowID:windowID cmdID:cmdID position:position speed:speed offset:offset',
init='WindowID:(UInt32)windowID cmdID:(UInt32)cmdID position:(UInt16)position speed:(float)speed '
'offset:(UInt64)offset duplicateUpdatesFromWindowID:(nullable NSNumber<SDLInt> *)'
'duplicateUpdatesFromWindowID'))
@@ -395,11 +459,24 @@ class TestFunctionsProducer(TestCase):
expected['origin'] = 'CreateInteractionChoiceSet'
expected['name'] = 'SDLCreateInteractionChoiceSet'
expected['extends_class'] = 'SDLRPCRequest'
- expected['imports'] = {'.m': {'SDLChoice'}, '.h': {'struct': {'SDLChoice'}, 'enum': {'SDLRPCRequest'}}}
+ expected['imports'] = {
+ '.h': {
+ 'struct': ['SDLChoice'],
+ 'enum': ['SDLRPCRequest']},
+ '.m': [
+ 'NSMutableDictionary+Store',
+ 'SDLChoice',
+ 'SDLCreateInteractionChoiceSet',
+ 'SDLRPCFunctionNames',
+ 'SDLRPCParameterNames'
+ ]
+ }
+ expected['history'] = None
expected['params'] = (
self.producer.param_named(
+ history=None,
constructor_argument='choiceSet', constructor_argument_override=None,
- constructor_prefix='ChoiceSet', deprecated=False, description=[], for_name='objects', mandatory=True,
+ constructor_prefix='ChoiceSet', deprecated=False, description=['{"array_min_size": null, "array_max_size": null}'], for_name='objects', mandatory=True,
method_suffix='ChoiceSet', modifier='strong', of_class='SDLChoice.class', origin='choiceSet',
since=None, type_native='NSArray<SDLChoice *> *', type_sdl='NSArray<SDLChoice *> *'),)
@@ -408,7 +485,7 @@ class TestFunctionsProducer(TestCase):
origin='choiceSet')]
expected['constructors'] = (self.producer.constructor_named(
- all=argument, arguments=argument, deprecated=False, self=True,
+ all=argument, arguments=argument, self=True,
init='ChoiceSet:(NSArray<SDLChoice *> *)choiceSet'),)
actual = self.producer.transform(item)
@@ -432,15 +509,26 @@ class TestFunctionsProducer(TestCase):
expected['origin'] = 'SetDisplayLayout'
expected['name'] = 'SDLSetDisplayLayout'
expected['extends_class'] = 'SDLRPCRequest'
- expected['imports'] = {'.h': {'enum': {'SDLRPCRequest'}, 'struct': set()}, '.m': set()}
- expected['since'] = '6.0.0'
+ expected['imports'] = {
+ '.h': {
+ 'enum': ['SDLRPCRequest'],
+ 'struct': []},
+ '.m': [
+ 'NSMutableDictionary+Store',
+ 'SDLRPCFunctionNames',
+ 'SDLRPCParameterNames',
+ 'SDLSetDisplayLayout'
+ ]
+ }
expected['history'] = '3.0.0'
+ expected['since'] = '6.0.0'
expected['deprecated'] = True
expected['params'] = (
self.producer.param_named(
+ history=None,
constructor_argument='displayLayout', constructor_argument_override=None,
constructor_prefix='DisplayLayout', deprecated=False,
- description=['{"default_value": null, "max_length": 500, "min_length": 1}'], for_name='object',
+ description=['{"string_min_length": 1, "string_max_length": 500}'], for_name='object',
mandatory=True, method_suffix='DisplayLayout', modifier='strong', of_class='NSString.class',
origin='displayLayout', since=None, type_native='NSString *', type_sdl='NSString *'),)
@@ -449,7 +537,7 @@ class TestFunctionsProducer(TestCase):
constructor_argument='displayLayout', origin='displayLayout')]
expected['constructors'] = (self.producer.constructor_named(
- all=argument, arguments=argument, deprecated=False, self=True,
+ all=argument, arguments=argument, self=True,
init='DisplayLayout:(NSString *)displayLayout'),)
actual = self.producer.transform(item)
diff --git a/generator/test/test_structs.py b/generator/test/test_structs.py
index 61ea23702..0c33ebf3f 100644
--- a/generator/test/test_structs.py
+++ b/generator/test/test_structs.py
@@ -44,16 +44,29 @@ class TestStructsProducer(TestCase):
expected['origin'] = 'CloudAppProperties'
expected['name'] = 'SDLCloudAppProperties'
expected['extends_class'] = 'SDLRPCStruct'
- expected['imports'] = {'.m': set(), '.h': {'enum': {'SDLRPCStruct'}, 'struct': set()}}
+ expected['imports'] = {
+ '.h': {
+ 'enum': ['SDLRPCStruct'],
+ 'struct': []
+ },
+ '.m': [
+ 'NSMutableDictionary+Store',
+ 'SDLCloudAppProperties',
+ 'SDLRPCParameterNames'
+ ]
+ }
+ expected['history'] = None
expected['params'] = (
self.producer.param_named(
+ history=None,
constructor_argument='appID', constructor_argument_override=None, constructor_prefix='AppID',
- deprecated=False, description=['{"default_value": null, "max_length": null, "min_length": null}'],
+ deprecated=False, description=['{"string_min_length": null, "string_max_length": null}'],
for_name='object', mandatory=True, method_suffix='AppID', modifier='strong', of_class='NSString.class',
origin='appID', since=None, type_native='NSString *', type_sdl='NSString *'),
self.producer.param_named(
+ history=None,
constructor_argument='valueParam', constructor_argument_override=None, constructor_prefix='ValueParam',
- deprecated=False, description=['{"default_value": null, "max_length": null, "min_length": null}'],
+ deprecated=False, description=['{"string_min_length": null, "string_max_length": null}'],
for_name='object', mandatory=True, method_suffix='ValueParam', modifier='strong',
of_class='NSString.class', origin='valueParam', since=None, type_native='NSString *',
type_sdl='NSString *')
@@ -67,7 +80,7 @@ class TestStructsProducer(TestCase):
]
expected['constructors'] = (self.producer.constructor_named(
- all=argument, arguments=argument, deprecated=False, self='',
+ all=argument, arguments=argument, self='',
init='AppID:(NSString *)appID valueParam:(NSString *)valueParam'),)
actual = self.producer.transform(item)
@@ -85,12 +98,24 @@ class TestStructsProducer(TestCase):
expected['origin'] = 'TouchEvent'
expected['name'] = 'SDLTouchEvent'
expected['extends_class'] = 'SDLRPCStruct'
- expected['imports'] = {'.h': {'enum': {'SDLRPCStruct'}, 'struct': set()}, '.m': set()}
+ expected['imports'] = {
+ '.h': {
+ 'enum': ['SDLRPCStruct'],
+ 'struct': []
+ },
+ '.m': [
+ 'NSMutableDictionary+Store',
+ 'SDLRPCParameterNames',
+ 'SDLTouchEvent'
+ ]
+ }
+ expected['history'] = None
expected['params'] = (
self.producer.param_named(
+ history=None,
constructor_argument='idParam', constructor_argument_override=None,
constructor_prefix='IdParam', deprecated=False,
- description=['{"default_value": null, "max_value": 9, "min_value": 0}'], for_name='object',
+ description=['{"num_min_value": 0, "num_max_value": 9}'], for_name='object',
mandatory=True, method_suffix='IdParam', modifier='strong', of_class='NSNumber.class',
origin='idParam', since=None, type_native='UInt8', type_sdl='NSNumber<SDLUInt> *'),)
@@ -99,7 +124,7 @@ class TestStructsProducer(TestCase):
constructor_argument='@(idParam)', origin='idParam')]
expected['constructors'] = (self.producer.constructor_named(
- all=argument, arguments=argument, deprecated=False, self='',
+ all=argument, arguments=argument, self='',
init='IdParam:(UInt8)idParam'),)
actual = self.producer.transform(item)
diff --git a/generator/transformers/common_producer.py b/generator/transformers/common_producer.py
index 63a7134bb..977cc2232 100644
--- a/generator/transformers/common_producer.py
+++ b/generator/transformers/common_producer.py
@@ -69,11 +69,11 @@ class InterfaceProducerCommon(ABC):
render['params'][param.name] = self.extract_param(param, item.name)
if isinstance(item, (Struct, Function)):
self.extract_imports(param, render['imports'])
-
+
# Add additional known imports to the import list
if isinstance(item, (Struct, Function)):
name = 'SDL' + item.name
- render[importsKey]['.m'].add( "NSMutableDictionary+Store" )
+ render[importsKey]['.m'].add("NSMutableDictionary+Store")
render[importsKey]['.m'].add(name)
render[importsKey]['.h'][enumKey] = list(render[importsKey]['.h'][enumKey])
(render[importsKey]['.h'][enumKey]).sort()
@@ -82,11 +82,11 @@ class InterfaceProducerCommon(ABC):
if isinstance(item, Struct):
name = 'SDL' + item.name
- render[importsKey]['.m'].add( "SDLRPCParameterNames" )
+ render[importsKey]['.m'].add("SDLRPCParameterNames")
if isinstance(item, Function):
- render[importsKey]['.m'].add( "SDLRPCFunctionNames" )
- render[importsKey]['.m'].add( "SDLRPCParameterNames" )
+ render[importsKey]['.m'].add("SDLRPCFunctionNames")
+ render[importsKey]['.m'].add("SDLRPCParameterNames")
# Sort the import list to ensure they appear in alphabetical order in the template
render[importsKey]['.m'] = list(render[importsKey]['.m'])
@@ -364,7 +364,7 @@ class InterfaceProducerCommon(ABC):
'mandatory': param.is_mandatory,
'deprecated': json.loads(param.deprecated.lower()) if param.deprecated else False,
'modifier': 'strong',
- 'history' : param.history }
+ 'history': param.history}
if isinstance(param.param_type, (Integer, Float, String, Array)):
data['description'].append(self.create_param_descriptor(param.param_type, OrderedDict()))
@@ -418,4 +418,3 @@ class InterfaceProducerCommon(ABC):
return 'num_min_value'
else:
return parameterName
-