Skip to content

Commit

Permalink
Merge pull request #13 from lillialexis/55791
Browse files Browse the repository at this point in the history
[55791] Added an api method to RVI node to take jwt credentials dynam…
  • Loading branch information
lillialexis committed Mar 21, 2016
2 parents d254884 + 3edf4b6 commit 3963be2
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
1 change: 1 addition & 0 deletions HVACDemo/HVACManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ - (void)start
[self.node setServerUrl:@"192.168.16.132"];
[self.node setServerPort:8820];
[self.node setServerCertificate:@"lilli_ios_cert" serverDomain:RVI_DOMAIN clientCertificate:@"client" clientCertificatePassword:@"password"];
[self.node addJWTCredentials:@"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJyaWdodF90b19pbnZva2UiOlsiZ2VuaXZpLm9yZyJdLCJpc3MiOiJqbHIuY29tIiwiZGV2aWNlX2NlcnQiOiJNSUlCOHpDQ0FWd0NBUUV3RFFZSktvWklodmNOQVFFTEJRQXdRakVMTUFrR0ExVUVCaE1DVlZNeER6QU5CZ05WQkFnTUJrOXlaV2R2YmpFUk1BOEdBMVVFQnd3SVVHOXlkR3hoYm1ReER6QU5CZ05WQkFvTUJrZEZUa2xXU1RBZUZ3MHhOVEV4TWpjeU16RTBOVEphRncweE5qRXhNall5TXpFME5USmFNRUl4Q3pBSkJnTlZCQVlUQWxWVE1ROHdEUVlEVlFRSURBWlBjbVZuYjI0eEVUQVBCZ05WQkFjTUNGQnZjblJzWVc1a01ROHdEUVlEVlFRS0RBWkhSVTVKVmtrd2daOHdEUVlKS29aSWh2Y05BUUVCQlFBRGdZMEFNSUdKQW9HQkFKdHZpTThBUklyRnF1UGMwbXlCOUJ1RjlNZGtBLzJTYXRxYlpNV2VUT1VKSEdyakJERUVNTFE3ems4QXlCbWk3UnF1WVlaczY3U3lMaHlsVkdLaDZzSkFsZWN4YkhVd2o3Y1pTUzFibUtNamU2TDYxZ0t3eEJtMk5JRlUxY1ZsMmpKbFRhVTlWWWhNNHhrNTd5ajI4bmtOeFNZV1AxdmJGWDJORFgyaUg3YjVBZ01CQUFFd0RRWUpLb1pJaHZjTkFRRUxCUUFEZ1lFQWhicVZyOUUvME03MjluYzZESStxZ3FzUlNNZm95dkEzQ21uL0VDeGwxeWJHa3V6TzdzQjhmR2pnTVE5enpjYjZxMXVQM3dHalBpb3FNeW1pWVlqVW1DVHZ6ZHZSQlorNlNEanJaZndVdVlleGlLcUk5QVA2WEthSGxBTDE0K3JLKzZITjR1SWtaY0l6UHdTTUhpaDFic1RScHlZNVozQ1VEY0RKa1l0VmJZcz0iLCJ2YWxpZGl0eSI6eyJzdGFydCI6MTQ1MjE5Mjc3Nywic3RvcCI6MTQ4MzcyODc3N30sInJpZ2h0X3RvX3JlZ2lzdGVyIjpbImdlbml2aS5vcmciXSwiY3JlYXRlX3RpbWVzdGFtcCI6MTQ1MjE5Mjc3NywiaWQiOiJpbnNlY3VyZV9jcmVkZW50aWFscyJ9.TBDUJFL1IQ039Lz7SIkcblhz62jO35STJ8OiclL_xlxEE_L_EjnELrDOGvkIh7zhhl8RMHkUJcTFQKF7P6WDJ5rUJejXJlkTRf-aVmHqEhpspRw6xD2u_2A9wmTWLJF94_wsEb7M7xWCXVrbexu_oik85zmuxRQgRE5wrTC7DDQ"];

if (self.hvacBundle != NULL)
[self.node removeBundle:self.hvacBundle];
Expand Down
7 changes: 7 additions & 0 deletions RVI/SDK/RVINode.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,13 @@ typedef enum
*/
- (void)setServerCertificate:(NSString *)serverCertificate serverDomain:(NSString *)serverDomain clientCertificate:(NSString *)clientCertificate clientCertificatePassword:(NSString *)clientCertificatePassword;

/**
* Method to pass the SDK your app's JWT-encoded json credentials for invoking services on a remote node and receiving service invocations from a remote node.
*
* @param jwtString a jwt-encoded credentials string
*/
- (void)addJWTCredentials:(NSString *)jwtString;

/**
* Sets the device address of the remote Bluetooth receiver on the remote RVI node, when using a Bluetooth link to interface with a remote node.
*
Expand Down
9 changes: 8 additions & 1 deletion RVI/SDK/RVINode.m
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ - (void)addRemoteService:(NSString *)serviceIdentifier withNodeIdentifier:(NSStr


@interface RVINode () <RVIRemoteConnectionManagerDelegate>
@property (nonatomic, strong) NSMutableArray *credentials;
@property (nonatomic, strong) NSMutableDictionary *allServiceBundles;
@property (nonatomic, strong) RVIRemoteConnectionManager *remoteConnectionManager;
@property (nonatomic, readwrite) bool isConnected;
Expand All @@ -52,6 +53,7 @@ - (id)init
{
if ((self = [super init]))
{
_credentials = [NSMutableArray array];
_allServiceBundles = [NSMutableDictionary dictionary];
_remoteConnectionManager = [RVIRemoteConnectionManager remoteConnectionManager];

Expand Down Expand Up @@ -81,6 +83,11 @@ - (void)setServerCertificate:(NSString *)serverCertificate serverDomain:(NSStrin
[self.remoteConnectionManager setServerCertificate:serverCertificate serverDomain:serverDomain clientCertificate:clientCertificate clientCertificatePassword:clientCertificatePassword];
}

- (void)addJWTCredentials:(NSString *)jwtString
{
[self.credentials addObject:jwtString];
}

- (void)setBluetoothDeviceAddress:(NSString *)deviceAddress
{
[self.remoteConnectionManager setBluetoothDeviceAddress:deviceAddress];
Expand Down Expand Up @@ -260,7 +267,7 @@ - (void)onRVIDidConnect
self.isConnected = YES;
[self.delegate nodeDidConnect];

[self.remoteConnectionManager sendPacket:[RVIDlinkAuthPacket authPacketWithCredentials:@[@"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJyaWdodF90b19pbnZva2UiOlsiZ2VuaXZpLm9yZyJdLCJpc3MiOiJqbHIuY29tIiwiZGV2aWNlX2NlcnQiOiJNSUlCOHpDQ0FWd0NBUUV3RFFZSktvWklodmNOQVFFTEJRQXdRakVMTUFrR0ExVUVCaE1DVlZNeER6QU5CZ05WQkFnTUJrOXlaV2R2YmpFUk1BOEdBMVVFQnd3SVVHOXlkR3hoYm1ReER6QU5CZ05WQkFvTUJrZE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sEb7M7xWCXVrbexu_oik85zmuxRQgRE5wrTC7DDQ"]]];
[self.remoteConnectionManager sendPacket:[RVIDlinkAuthPacket authPacketWithCredentials:self.credentials]];
}

- (void)onRVIDidDisconnect:(NSError *)error
Expand Down

0 comments on commit 3963be2

Please sign in to comment.