Skip to content

Commit

Permalink
Merge branch 'release/4.1.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
joeljfischer committed Mar 30, 2016
2 parents a2c8226 + 487e07e commit f04beee
Show file tree
Hide file tree
Showing 8 changed files with 59 additions and 41 deletions.
21 changes: 20 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,28 @@
# 4.1.0 Release Notes
### Enhancements
* The `LAUNCH_APP` system request was implemented.
* The proxy now tracks application state and relays that information to the Head Unit on v4 and above.

### Bug Fixes
* `[SDLProxyListener onProxyOpened]` will only be called when the RPC service starts, instead of any service.
* Sending heartbeat has been deprecated. The iOS proxy will now only respond to heartbeats.
* `SYSTEM_REQUEST` RPC now properly uploads and returns data.
* `SDLStreamingMediaManager`'s version check now correctly compares versions

### Other
* Updates to the README with "Getting Started" code, and updated information on testing.
* License copyright updated to 2016.
* All testing frameworks are removed from the repository and must be bootstrapped when wanted.

### Deprecations
* Methods relating to sending heartbeat have been deprecated. This should not affect your app in any way. These lower-level classes will be removed in future versions.

# 4.0.3 Release Notes

### Enhancements
* Implement HTTP System Requests for policy updates

### Bug Fix
### Bug Fixes
* Revert the reachability code in TCP. If you were having trouble with connecting to SDL Core, this should fix that particular bug.

### Other
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ See the [changelog](https://github.com/smartdevicelink/sdl_ios/blob/master/CHANG

You can install this library using [Cocoapods](https://cocoapods.org/pods/SmartDeviceLink-iOS). You can get started with Cocoapods by [following their install guide](https://guides.cocoapods.org/using/getting-started.html#getting-started), and learn how to use Cocoapods to install dependencies [by following this guide](https://guides.cocoapods.org/using/using-cocoapods.html).

In your podfile, you want to add `pod 'SmartDeviceLink-iOS', '4.0.3'`. Then run `pod install` inside your terminal. With Cocoapods, we support iOS 6+.
In your podfile, you want to add `pod 'SmartDeviceLink-iOS', '4.1.0'`. Then run `pod install` inside your terminal. With Cocoapods, we support iOS 6+.

##### Carthage

Expand Down Expand Up @@ -188,7 +188,7 @@ if (self.proxy != nil) {
```

#### onOnHMIStatus
When your app receives `onOnHMIStatus` it has changed HMI states on the head unit. For example, your application can be put into `HMI_FULL` meaning that it has full access to the vehicle screen. For more info on HMI Levels, [see the Cocoadoc documentation on the enum](http://cocoadocs.org/docsets/SmartDeviceLink-iOS/4.0.0-alpha.2/Classes/SDLHMILevel.html).
When your app receives `onOnHMIStatus` it has changed HMI states on the head unit. For example, your application can be put into `HMI_FULL` meaning that it has full access to the vehicle screen. For more info on HMI Levels, [see the Cocoadoc documentation on the enum](http://cocoadocs.org/docsets/SmartDeviceLink-iOS/4.0.3/Classes/SDLHMILevel.html).

You will want to track your first HMI FULL, for instance with a boolean value. The example application has extremely basic tracking of this type in the `onOnHMIStatus` callback.

Expand Down
4 changes: 2 additions & 2 deletions SmartDeviceLink-iOS.podspec
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
Pod::Spec.new do |s|

s.name = "SmartDeviceLink-iOS"
s.version = "4.0.3"
s.version = "4.1.0"
s.summary = "Connect your app with cars!"
s.homepage = "https://github.com/smartdevicelink/SmartDeviceLink-iOS"
s.license = { :type => "New BSD", :file => "LICENSE" }
s.author = { "SmartDeviceLink Team" => "joel@livio.io" }
s.platform = :ios, "6.0"
s.source = { :git => "https://github.com/smartdevicelink/sdl_ios.git", :tag => "4.0.3" }
s.source = { :git => "https://github.com/smartdevicelink/sdl_ios.git", :tag => "4.1.0" }
s.source_files = "SmartDeviceLink-iOS/SmartDeviceLink/*.{h,m}"
s.requires_arc = true

Expand Down
2 changes: 1 addition & 1 deletion SmartDeviceLink-iOS/SmartDeviceLink/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>4.0.3</string>
<string>4.1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
Expand Down
2 changes: 1 addition & 1 deletion SmartDeviceLink-iOS/SmartDeviceLink/SDLAbstractProtocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
- (void)sendEndSessionWithType:(SDLServiceType)serviceType;
- (void)sendRPC:(SDLRPCMessage *)message;
- (void)sendRPCRequest:(SDLRPCRequest *)rpcRequest __deprecated_msg(("Use sendRPC: instead"));
- (void)sendHeartbeat;
- (void)sendHeartbeat __deprecated_msg("Heartbeat is no longer used.");
- (void)sendRawDataStream:(NSInputStream *)inputStream withServiceType:(SDLServiceType)serviceType;
- (void)sendRawData:(NSData *)data withServiceType:(SDLServiceType)serviceType;

Expand Down
32 changes: 0 additions & 32 deletions SmartDeviceLink-iOS/SmartDeviceLink/SDLProtocol.m
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ @interface SDLProtocol () {
@property (assign) UInt8 sessionID;
@property (strong) NSMutableData *receiveBuffer;
@property (strong) SDLProtocolReceivedMessageRouter *messageRouter;
@property (nonatomic) BOOL heartbeatACKed;
@property (nonatomic, strong) SDLTimer *heartbeatTimer;
@end


Expand All @@ -45,7 +43,6 @@ - (instancetype)init {
if (self = [super init]) {
_messageID = 0;
_sessionID = 0;
_heartbeatACKed = NO;
_receiveQueue = dispatch_queue_create("com.sdl.protocol.receive", DISPATCH_QUEUE_SERIAL);
_sendQueue = dispatch_queue_create("com.sdl.protocol.transmit", DISPATCH_QUEUE_SERIAL);
_prioritizedCollection = [[SDLPrioritizedObjectCollection alloc] init];
Expand Down Expand Up @@ -273,23 +270,6 @@ - (void)sendHeartbeat {
[self sendDataToTransport:message.data withPriority:header.serviceType];
}

- (void)startHeartbeatTimerWithDuration:(float)duration {
self.heartbeatTimer = [[SDLTimer alloc] initWithDuration:duration repeat:YES];
__weak typeof(self) weakSelf = self;
self.heartbeatTimer.elapsedBlock = ^void() {
__strong typeof(weakSelf) strongSelf = weakSelf;
if (strongSelf.heartbeatACKed) {
strongSelf.heartbeatACKed = NO;
[strongSelf sendHeartbeat];
} else {
NSString *logMessage = [NSString stringWithFormat:@"Heartbeat ack not received. Goodbye."];
[SDLDebugTool logInfo:logMessage withType:SDLDebugType_RPC toOutput:SDLDebugOutput_All toGroup:strongSelf.debugConsoleGroupName];
[strongSelf onProtocolClosed];
}
};
[self.heartbeatTimer start];
}

- (void)sendRawData:(NSData *)data withServiceType:(SDLServiceType)serviceType {
SDLV2ProtocolHeader *header = [[SDLV2ProtocolHeader alloc] initWithVersion:[SDLGlobals globals].protocolVersion];
header.frameType = SDLFrameType_Single;
Expand Down Expand Up @@ -319,10 +299,6 @@ - (void)handleProtocolStartSessionACK:(SDLServiceType)serviceType sessionID:(Byt
case SDLServiceType_RPC: {
self.sessionID = sessionID;
[SDLGlobals globals].maxHeadUnitVersion = version;
if ([SDLGlobals globals].protocolVersion >= 3) {
self.heartbeatACKed = YES; // Ensures a first heartbeat is sent
[self startHeartbeatTimerWithDuration:5.0];
}
} break;
default:
break;
Expand Down Expand Up @@ -382,8 +358,6 @@ - (void)handleHeartbeatForSession:(Byte)session {
}

- (void)handleHeartbeatACK {
self.heartbeatACKed = YES;

for (id<SDLProtocolListener> listener in self.protocolDelegateTable.allObjects) {
if ([listener respondsToSelector:@selector(handleHeartbeatACK)]) {
[listener handleHeartbeatACK];
Expand All @@ -392,11 +366,6 @@ - (void)handleHeartbeatACK {
}

- (void)onProtocolMessageReceived:(SDLProtocolMessage *)msg {
if ([SDLGlobals globals].protocolVersion >= 3 && self.heartbeatTimer != nil) {
self.heartbeatACKed = YES; // All messages count as heartbeats
[self.heartbeatTimer start];
}

for (id<SDLProtocolListener> listener in self.protocolDelegateTable.allObjects) {
if ([listener respondsToSelector:@selector(onProtocolMessageReceived:)]) {
[listener onProtocolMessageReceived:msg];
Expand Down Expand Up @@ -438,7 +407,6 @@ - (void)destructObjects {
self.messageRouter = nil;
self.transport = nil;
self.protocolDelegateTable = nil;
self.heartbeatTimer = nil;
}
}

Expand Down
2 changes: 1 addition & 1 deletion SmartDeviceLink-iOS/SmartDeviceLink/SDLProxy.m
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
typedef void (^URLSessionTaskCompletionHandler)(NSData *data, NSURLResponse *response, NSError *error);
typedef void (^URLSessionDownloadTaskCompletionHandler)(NSURL *location, NSURLResponse *response, NSError *error);

NSString *const SDLProxyVersion = @"4.0.3";
NSString *const SDLProxyVersion = @"4.1.0";
const float startSessionTime = 10.0;
const float notifyProxyClosedDelay = 0.1;
const int POLICIES_CORRELATION_ID = 65535;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -317,8 +317,11 @@
expect(dataSent).to(equal([NSData dataWithBytes:testHeader length:8]));
}] sendData:[OCMArg any]];
testProtocol.transport = transportMock;


#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
[testProtocol sendHeartbeat];
#pragma clang diagnostic pop

expect(@(verified)).toEventually(beTruthy());
});
Expand All @@ -344,7 +347,10 @@
}] sendData:[OCMArg any]];
testProtocol.transport = transportMock;

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
[testProtocol sendHeartbeat];
#pragma clang diagnostic pop

expect(@(verified)).toEventually(beTruthy());
});
Expand Down Expand Up @@ -381,6 +387,31 @@
});
});

describe(@"HandleHeartbeatForSession Tests", ^{
// TODO: Test automatically sending data to head unit (dependency injection?)
it(@"Should pass information along to delegate", ^ {
SDLProtocol* testProtocol = [[SDLProtocol alloc] init];

id delegateMock = OCMProtocolMock(@protocol(SDLProtocolListener));

__block BOOL verified = NO;
[[[[delegateMock stub] andDo:^(NSInvocation* invocation) {
verified = YES;
Byte sessionID;

[invocation getArgument:&sessionID atIndex:2];

expect(@(sessionID)).to(equal(@0x44));
}] ignoringNonObjectArgs] handleHeartbeatForSession:0];

[testProtocol.protocolDelegateTable addObject:delegateMock];

[testProtocol handleHeartbeatForSession:0x44];

expect(@(verified)).to(beTruthy());
});
});

describe(@"OnProtocolMessageReceived Tests", ^ {
it(@"Should pass information along to delegate", ^ {
SDLProtocol* testProtocol = [[SDLProtocol alloc] init];
Expand Down

0 comments on commit f04beee

Please sign in to comment.