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

Security manager set for secondary protocol #1482

Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions SmartDeviceLink/SDLNotificationConstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,9 @@ extern SDLNotificationName const SDLDidBecomeReady;
/// Name for a notification sent by the user when their CarWindow view has been updated
extern SDLNotificationName const SDLDidUpdateProjectionView;

// Name for a security manager set notification
extern SDLNotificationName const SDLSecurityManagerSet;
joeljfischer marked this conversation as resolved.
Show resolved Hide resolved

/**
* NSNotification names associated with specific RPC responses.
*/
Expand Down
2 changes: 2 additions & 0 deletions SmartDeviceLink/SDLNotificationConstants.m
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
SDLNotificationName const SDLDidBecomeReady = @"com.sdl.notification.managerReady";
SDLNotificationName const SDLDidReceiveVehicleIconNotification = @"com.sdl.notification.vehicleIcon";
SDLNotificationName const SDLDidUpdateProjectionView = @"com.sdl.notification.projectionViewUpdate";
SDLNotificationName const SDLSecurityManagerSet = @"com.sdl.notification.securityManagerSet";
joeljfischer marked this conversation as resolved.
Show resolved Hide resolved


#pragma mark - RPC Responses
SDLNotificationName const SDLDidReceiveAddCommandResponse = @"com.sdl.response.addCommand";
Expand Down
2 changes: 2 additions & 0 deletions SmartDeviceLink/SDLProxy.m
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,8 @@ - (void)handleRegisterAppInterfaceResponse:(SDLRPCResponse *)response {
if (self.protocol.securityManager && [self.protocol.securityManager respondsToSelector:@selector(setAppId:)]) {
self.protocol.securityManager.appId = self.appId;
}
// Post Notification that the securityManager is set
[[NSNotificationCenter defaultCenter] postNotificationName:SDLSecurityManagerSet object:nil];

joeljfischer marked this conversation as resolved.
Show resolved Hide resolved
joeljfischer marked this conversation as resolved.
Show resolved Hide resolved
if ([SDLGlobals sharedGlobals].protocolVersion.major >= 4) {
[self sendMobileHMIState];
Expand Down
8 changes: 8 additions & 0 deletions SmartDeviceLink/SDLSecondaryTransportManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#import "SDLLogMacros.h"
#import "SDLProtocol.h"
#import "SDLProtocolHeader.h"
#import "SDLNotificationConstants.h"
#import "SDLSecondaryTransportPrimaryProtocolHandler.h"
#import "SDLStateMachine.h"
#import "SDLTCPTransport.h"
Expand Down Expand Up @@ -119,6 +120,9 @@ - (instancetype)initWithStreamingProtocolDelegate:(id<SDLStreamingProtocolDelega
@(SDLServiceTypeVideo):@(SDLTransportClassInvalid)} mutableCopy];
_tcpPort = TCPPortUnspecified;

// Listen for Security Manager set event and update the security manager
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(securityManagerWasSet) name:SDLSecurityManagerSet object:nil];

return self;
}

Expand Down Expand Up @@ -705,6 +709,10 @@ - (SDLSecondaryTransportType)sdl_getTransportTypeFromProtocol:(SDLProtocol *)pro
}
}

- (void)securityManagerWasSet {
joeljfischer marked this conversation as resolved.
Show resolved Hide resolved
self.secondaryProtocol.securityManager = self.primaryProtocol.securityManager;
joeljfischer marked this conversation as resolved.
Show resolved Hide resolved
}

@end

NS_ASSUME_NONNULL_END