Skip to content

Commit

Permalink
Merge pull request #3 from iotivity/v3.1.0
Browse files Browse the repository at this point in the history
v3.1.0
  • Loading branch information
AntGarrido authored Oct 7, 2021
2 parents 5b351c7 + e088c5f commit 619f1a2
Show file tree
Hide file tree
Showing 28 changed files with 306 additions and 69 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ cd <iotivity-lite>/port/android
```
3. Execute the command to build the library.
```
make NDK_HOME=<ndk-directory> ANDROID_API=21 DEBUG=1 SECURE=1 IPV4=1 TCP=0 PKI=1 DYNAMIC=1 CLOUD=0 JAVA=1 IDD=1
make NDK_HOME=<ndk-directory> ANDROID_API=21 DEBUG=1 SECURE=1 IPV4=1 TCP=1 PKI=1 DYNAMIC=1 CLOUD=1 JAVA=1 IDD=1
```

Once built, the library can be found at:
Expand Down
2 changes: 1 addition & 1 deletion otgc/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ android {
minSdkVersion 21
targetSdkVersion 28
versionCode 13
versionName "3.0.0"
versionName "3.1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

compileOptions {
Expand Down
11 changes: 11 additions & 0 deletions otgc/src/main/assets/cloudca.pem
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
-----BEGIN CERTIFICATE-----
MIIBhDCCASmgAwIBAgIQdAMxveYP9Nb48xe9kRm3ajAKBggqhkjOPQQDAjAxMS8w
LQYDVQQDEyZPQ0YgQ2xvdWQgUHJpdmF0ZSBDZXJ0aWZpY2F0ZXMgUm9vdCBDQTAe
Fw0xOTExMDYxMjAzNTJaFw0yOTExMDMxMjAzNTJaMDExLzAtBgNVBAMTJk9DRiBD
bG91ZCBQcml2YXRlIENlcnRpZmljYXRlcyBSb290IENBMFkwEwYHKoZIzj0CAQYI
KoZIzj0DAQcDQgAEaNJi86t5QlZiLcJ7uRMNlcwIpmFiJf9MOqyz2GGnGVBypU6H
lwZHY2/l5juO/O4EH2s9h3HfcR+nUG2/tFzFEaMjMCEwDgYDVR0PAQH/BAQDAgEG
MA8GA1UdEwEB/wQFMAMBAf8wCgYIKoZIzj0EAwIDSQAwRgIhAM7gFe39UJPIjIDE
KrtyPSIGAk0OAO8txhow1BAGV486AiEAqszg1fTfOHdE/pfs8/9ZP5gEVVkexRHZ
JCYVaa2Spbg=
-----END CERTIFICATE-----
42 changes: 21 additions & 21 deletions otgc/src/main/assets/kyrio-ee-cert.pem
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
-----BEGIN CERTIFICATE-----
MIIEEzCCA7mgAwIBAgIJAI0K+3tTsk07MAoGCCqGSM49BAMCMFsxDDAKBgNVBAoM
MIID/jCCA6OgAwIBAgIJAI0K+3tTslNtMAoGCCqGSM49BAMCMFsxDDAKBgNVBAoM
A09DRjEiMCAGA1UECwwZS3lyaW8gVGVzdCBJbmZyYXN0cnVjdHVyZTEnMCUGA1UE
AwweS3lyaW8gVEVTVCBJbnRlcm1lZGlhdGUgQ0EwMDAyMB4XDTE5MTEyODEzMzYw
OVoXDTE5MTIyODEzMzYwOVowYTEMMAoGA1UECgwDT0NGMSIwIAYDVQQLDBlLeXJp
byBUZXN0IEluZnJhc3RydWN0dXJlMS0wKwYDVQQDDCQxZTFiZWJmYi04ZjAzLTQ3
ODUtNWZhNy0xYjcwNGU2NTQzNjAwWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAAQS
rNS0ha8XBiRD+Q7nL+R3uX7f5FPgQO75Wh9PqaiVLhMFewF/Yrbr+KhCdj8e6MNz
WGDbVtMVc59RBHyvgzbho4ICXjCCAlowCQYDVR0TBAIwADAOBgNVHQ8BAf8EBAMC
A4gwKQYDVR0lBCIwIAYIKwYBBQUHAwIGCCsGAQUFBwMBBgorBgEEAYLefAEGMB0G
A1UdDgQWBBR1GbdeJoLZj6iMx9ZDNEv+aoECrjAfBgNVHSMEGDAWgBQZc2oEGgsH
cE9TeVM2h/wMunyuCzCBlgYIKwYBBQUHAQEEgYkwgYYwXQYIKwYBBQUHMAKGUWh0
dHA6Ly90ZXN0cGtpLmt5cmlvLmNvbS9vY2YvY2FjZXJ0cy9CQkU2NEY5QTdFRTM3
RDI5QTA1RTRCQjc3NTk1RjMwOEJFNDFFQjA3LmNydDAlBggrBgEFBQcwAYYZaHR0
cDovL3Rlc3RvY3NwLmt5cmlvLmNvbTBfBgNVHR8EWDBWMFSgUqBQhk5odHRwOi8v
dGVzdHBraS5reXJpby5jb20vb2NmL2NybHMvQkJFNjRGOUE3RUUzN0QyOUEwNUU0
QkI3NzU5NUYzMDhCRTQxRUIwNy5jcmwwGAYDVR0gBBEwDzANBgsrBgEEAYORVgAB
AjBgBgorBgEEAYORVgEABFIwUDAJAgECAgEAAgEAMDYMGTEuMy42LjEuNC4xLjUx
NDE0LjAuMC4xLjAMGTEuMy42LjEuNC4xLjUxNDE0LjAuMC4yLjAMBE9UR0MMBURF
S1JBMCoGCisGAQQBg5FWAQEEHDAaBgsrBgEEAYORVgEBAAYLKwYBBAGDkVYBAQEw
MAYKKwYBBAGDkVYBAgQiMCAMDjEuMy42LjEuNC4xLjcxDAlEaXNjb3ZlcnkMAzEu
MDAKBggqhkjOPQQDAgNIADBFAiAP9ttApmZfcFoipNra7ZqFa1kdD7JxmD84fuMH
XXyTBgIhAIIrpiVkOxAQqTlfDpJZk3F8byz/x2c9xpNeQEZTllMc
AwweS3lyaW8gVEVTVCBJbnRlcm1lZGlhdGUgQ0EwMDAyMB4XDTIxMTAwNjA5Mjcz
NVoXDTIxMTEwNTA5MjczNVowRjEMMAoGA1UECgwDT0NGMSIwIAYDVQQLDBlLeXJp
byBUZXN0IEluZnJhc3RydWN0dXJlMRIwEAYDVQQDDAlwa2lfY2VydHMwWTATBgcq
hkjOPQIBBggqhkjOPQMBBwNCAARPhgvrI3VG5KDAy4QQnPndI4en9yoIIQWO9PY7
gT60mfwIElH2PbeEFJwS+6RmNtSnGeo1Vb2UQx3bgpEgULMBo4ICYzCCAl8wCQYD
VR0TBAIwADAOBgNVHQ8BAf8EBAMCA4gwKQYDVR0lBCIwIAYIKwYBBQUHAwIGCCsG
AQUFBwMBBgorBgEEAYLefAEGMB0GA1UdDgQWBBRDsU3IcO3AHYvyWp0NjWm4ob6a
uzAfBgNVHSMEGDAWgBQZc2oEGgsHcE9TeVM2h/wMunyuCzCBlgYIKwYBBQUHAQEE
gYkwgYYwXQYIKwYBBQUHMAKGUWh0dHA6Ly90ZXN0cGtpLmt5cmlvLmNvbS9vY2Yv
Y2FjZXJ0cy9CQkU2NEY5QTdFRTM3RDI5QTA1RTRCQjc3NTk1RjMwOEJFNDFFQjA3
LmNydDAlBggrBgEFBQcwAYYZaHR0cDovL3Rlc3RvY3NwLmt5cmlvLmNvbTBfBgNV
HR8EWDBWMFSgUqBQhk5odHRwOi8vdGVzdHBraS5reXJpby5jb20vb2NmL2NybHMv
QkJFNjRGOUE3RUUzN0QyOUEwNUU0QkI3NzU5NUYzMDhCRTQxRUIwNy5jcmwwGAYD
VR0gBBEwDzANBgsrBgEEAYORVgABAjBlBgorBgEEAYORVgEABFcwVTAJAgECAgEA
AgEAMDYMGTEuMy42LjEuNC4xLjUxNDE0LjAuMC4xLjAMGTEuMy42LjEuNC4xLjUx
NDE0LjAuMC4yLjAMC0RldmljZU5hbWUxDANPQ0YwKgYKKwYBBAGDkVYBAQQcMBoG
CysGAQQBg5FWAQEABgsrBgEEAYORVgEBATAwBgorBgEEAYORVgECBCIwIAwOMS4z
LjYuMS40LjEuNzEMCURpc2NvdmVyeQwDMS4wMAoGCCqGSM49BAMCA0kAMEYCIQCn
bJELNfcNIMF/o7fD1GMVo5bipfBgKe45TkUTFxHqJAIhAJocMkb89i5l1htY6Zxh
6IrWOduBtpU7LaNfhLyWQZA0
-----END CERTIFICATE-----
6 changes: 3 additions & 3 deletions otgc/src/main/assets/kyrio-ee-key.pem
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
BggqhkjOPQMBBw==
-----END EC PARAMETERS-----
-----BEGIN EC PRIVATE KEY-----
MHcCAQEEIDFeXNSayEnCQIlEjbV+4vGKeqRAmjnspnA8ICW0FnAwoAoGCCqGSM49
AwEHoUQDQgAEEqzUtIWvFwYkQ/kO5y/kd7l+3+RT4EDu+VofT6molS4TBXsBf2K2
6/ioQnY/HujDc1hg21bTFXOfUQR8r4M24Q==
MHcCAQEEIDKAzV1vjeRU1ET9HVHcQVTjr6ClMoGt1Yhjrky2MYyaoAoGCCqGSM49
AwEHoUQDQgAET4YL6yN1RuSgwMuEEJz53SOHp/cqCCEFjvT2O4E+tJn8CBJR9j23
hBScEvukZjbUpxnqNVW9lEMd24KRIFCzAQ==
-----END EC PRIVATE KEY-----
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,26 @@ public Completable provisionRoleCertificate(String deviceId, String roleId, Stri
});
}

public Completable provisionTrustAnchor(byte[] certificate, String sid, String deviceId) {
return Completable.create(emitter -> {
OCUuid di = OCUuidUtil.stringToUuid(deviceId);

OCObtStatusHandler handler = (int status) -> {
if (status >= 0) {
Timber.d("Provision trust anchor succeeded");
emitter.onComplete();
} else {
emitter.onError(new Exception("Provision trust anchor error"));
}
};

int ret = OCObt.provisionTrustAnchor(certificate, sid, di, handler);
if (ret < 0) {
emitter.onError(new Exception("Provision trust anchor error"));
}
});
}

public Completable provisionPairwiseCredential(String clientId, String serverId) {
return Completable.create(emitter -> {
OCUuid cliendDi = OCUuidUtil.stringToUuid(clientId);
Expand Down Expand Up @@ -250,4 +270,31 @@ public Completable removeTrustAnchor(long credid) {
}
});
}

public Completable registerDeviceCloud(String deviceId, String deviceURL, String authProvider, String cloudUrl, String cloudUuid, String accessToken) {
return Completable.create(emitter -> {
OCCloudContext ctx = OCCloud.getContext(0);

OCUuid uuid = OCUuidUtil.stringToUuid(deviceId);

OCResponseHandler handler = (OCClientResponse response) -> {
if (response.getCode() == OCStatus.OC_STATUS_CHANGED) {
Timber.d("Register device on cloud success");
emitter.onComplete();
} else if (response.getCode() == OCStatus.OC_STATUS_CREATED) {
Timber.d("Register device on cloud success");
emitter.onComplete();
} else {
String error = "Register device on cloud error";
Timber.e(error + ": " + response.getCode());
emitter.onError(new Exception(error));
}
};

if (ctx != null) {
OCObt.UpdateCloudConfDevice(uuid, deviceURL, accessToken, authProvider, cloudUrl, cloudUuid, handler);
}
emitter.onComplete();
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,22 @@ public Observable<Device> scanOwnedByOtherDevices() {
.filter(device -> !device.getDeviceId().equals(getDeviceId().blockingGet()));
}

public Single<String> getEndpoint(Device device) {
return Single.create(emitter -> {
String endpoint = device.getIpv6Host() != null ? device.getIpv6Host() : device.getIpv6TcpHost();
if (endpoint == null) {
endpoint = device.getIpv4Host() != null ? device.getIpv4Host() : device.getIpv4TcpHost();
if (endpoint == null) {
endpoint = device.getIpv6SecureHost() != null ? device.getIpv6SecureHost() : device.getIpv6TcpSecureHost();
if (endpoint == null) {
endpoint = device.getIpv4SecureHost() != null ? device.getIpv4SecureHost() : device.getIpv4TcpSecureHost();
}
}
}
emitter.onSuccess(endpoint);
});
}

public Single<String> getNonSecureEndpoint(Device device) {
return Single.create(emitter -> {
String endpoint = device.getIpv6Host() != null ? device.getIpv6Host() : device.getIpv6TcpHost();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,13 @@ public void parseOCRepresentation(OCCred cred) {
this.setPublicData(publicData);
}
/* privatedata */
// Reading Private Data fails sometimes on Android. As it not used, it has been commented
/*
OcCredPrivateData privateData = new OcCredPrivateData();
privateData.parseOCRepresentation(cred.getPrivateData());
this.setPrivateData(privateData);
*/

/* roleid */
if (cred.getRole() != null) {
OcCredRole roleid = new OcCredRole();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,10 @@ public void parseOCRepresentation(OCRepresentation rep) {
this.setRowneruuid(rowneruuid);
/* rt */
String[] resourceTypes = OCRep.getStringArray(rep, OcfResourceAttributeKey.RESOURCE_TYPES_KEY);
this.setResourceTypes(Arrays.asList(resourceTypes));
this.setResourceTypes(resourceTypes != null ? Arrays.asList(resourceTypes) : null);
/* if */
String[] interfaces = OCRep.getStringArray(rep, OcfResourceAttributeKey.INTERFACES_KEY);
this.setResourceTypes(Arrays.asList(interfaces));
this.setInterfaces(interfaces != null ? Arrays.asList(interfaces) : null);
}

public CborEncoder parseToCbor() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public GetDeviceInfoUseCase(IotivityRepository iotivityRepository,
}

public Single<OcDeviceInfo> execute(Device device) {
return iotivityRepository.getNonSecureEndpoint(device)
return iotivityRepository.getEndpoint(device)
.flatMap(iotivityRepository::getDeviceInfo)
.delay(preferencesRepository.getRequestsDelay(), TimeUnit.SECONDS, schedulersFacade.ui());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public GetDeviceRoleUseCase(IotivityRepository iotivityRepository,
}

public Single<DeviceRole> execute(Device device) {
return iotivityRepository.getNonSecureEndpoint(device)
return iotivityRepository.getEndpoint(device)
.flatMap(endpoint ->
iotivityRepository.findResources(endpoint)
.timeout(iotivityRepository.getDiscoveryTimeout() + 5, TimeUnit.SECONDS)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public GetOTMethodsUseCase(IotivityRepository iotivityRepository,
}

public Single<List<OcfOxmType>> execute(Device device) {
return iotivityRepository.getNonSecureEndpoint(device)
return iotivityRepository.getEndpoint(device)
.flatMap(endpoint ->
doxsRepository.retrieveOTMethods(endpoint)
.map(doxm -> doxm.getOxms()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,37 +92,40 @@ private void factoryResetHandler(long device) throws Exception {
/* Current date */
Date date = new Date();

/* Kyrio end-entity cert */
InputStream inputStream = context.getAssets().open(OtgcConstant.KYRIO_EE_CERTIFICATE);
X509Certificate eeCert = ioRepository.getFileAsX509Certificate(inputStream).blockingGet();
if (date.after(eeCert.getNotBefore()) && date.before(eeCert.getNotAfter())) {
byte[] kyrioEeCertificate = ioRepository.getBytesFromFile(OtgcConstant.KYRIO_EE_CERTIFICATE).blockingGet();
/* private key of Kyrio end-entity cert */
byte[] kyrioEeKey = ioRepository.getBytesFromFile(OtgcConstant.KYRIO_EE_KEY).blockingGet();
int credid = OCPki.addMfgCert(device, kyrioEeCertificate, kyrioEeKey);
if (credid == -1) {
throw new Exception("Add identity certificate error");
}
// End-entity certs only loaded when using Client Mode
if (settingRepository.getMode().equals(OtgcMode.CLIENT)) {
/* Kyrio end-entity cert */
InputStream inputStream = context.getAssets().open(OtgcConstant.KYRIO_EE_CERTIFICATE);
X509Certificate eeCert = ioRepository.getFileAsX509Certificate(inputStream).blockingGet();
if (date.after(eeCert.getNotBefore()) && date.before(eeCert.getNotAfter())) {
byte[] kyrioEeCertificate = ioRepository.getBytesFromFile(OtgcConstant.KYRIO_EE_CERTIFICATE).blockingGet();
/* private key of Kyrio end-entity cert */
byte[] kyrioEeKey = ioRepository.getBytesFromFile(OtgcConstant.KYRIO_EE_KEY).blockingGet();
int credid = OCPki.addMfgCert(device, kyrioEeCertificate, kyrioEeKey);
if (credid == -1) {
throw new Exception("Add identity certificate error");
}

/* Kyrio intermediate cert */
inputStream = context.getAssets().open(OtgcConstant.KYRIO_SUBCA_CERTIFICATE);
X509Certificate subCaCert = ioRepository.getFileAsX509Certificate(inputStream).blockingGet();
if (date.after(subCaCert.getNotBefore()) && date.before(subCaCert.getNotAfter())) {
byte[] kyrioSubcaCertificate = ioRepository.getBytesFromFile(OtgcConstant.KYRIO_SUBCA_CERTIFICATE).blockingGet();
if (OCPki.addMfgIntermediateCert(device, credid, kyrioSubcaCertificate) == -1) {
throw new Exception("Add intermediate certificate error");
/* Kyrio intermediate cert */
inputStream = context.getAssets().open(OtgcConstant.KYRIO_SUBCA_CERTIFICATE);
X509Certificate subCaCert = ioRepository.getFileAsX509Certificate(inputStream).blockingGet();
if (date.after(subCaCert.getNotBefore()) && date.before(subCaCert.getNotAfter())) {
byte[] kyrioSubcaCertificate = ioRepository.getBytesFromFile(OtgcConstant.KYRIO_SUBCA_CERTIFICATE).blockingGet();
if (OCPki.addMfgIntermediateCert(device, credid, kyrioSubcaCertificate) == -1) {
throw new Exception("Add intermediate certificate error");
}
} else {
this.displayNotValidCertificateHandler.handler("Kyrio intermediate certificate is not valid");
}
} else {
this.displayNotValidCertificateHandler.handler("Kyrio intermediate certificate is not valid");
this.displayNotValidCertificateHandler.handler("Kyrio end entity certificate is not valid");
}
} else {
this.displayNotValidCertificateHandler.handler("Kyrio end entity certificate is not valid");
}

/* Kyrio root cert */
inputStream = context.getAssets().open(OtgcConstant.KYRIO_ROOT_CERTIFICATE);
X509Certificate caCert = ioRepository.getFileAsX509Certificate(inputStream).blockingGet();
if (date.after(caCert.getNotBefore()) && date.before(caCert.getNotAfter())) {
InputStream inputStream = context.getAssets().open(OtgcConstant.KYRIO_ROOT_CERTIFICATE);
X509Certificate caCert1 = ioRepository.getFileAsX509Certificate(inputStream).blockingGet();
if (date.after(caCert1.getNotBefore()) && date.before(caCert1.getNotAfter())) {
byte[] kyrioRootcaCertificate = ioRepository.getBytesFromFile(OtgcConstant.KYRIO_ROOT_CERTIFICATE).blockingGet();
if (OCPki.addMfgTrustAnchor(device, kyrioRootcaCertificate) == -1) {
throw new Exception("Add root certificate error");
Expand All @@ -133,8 +136,8 @@ private void factoryResetHandler(long device) throws Exception {

/* EonTi root cert */
inputStream = context.getAssets().open(OtgcConstant.EONTI_ROOT_CERTIFICATE);
caCert = ioRepository.getFileAsX509Certificate(inputStream).blockingGet();
if (date.after(caCert.getNotBefore()) && date.before(caCert.getNotAfter())) {
X509Certificate caCert2 = ioRepository.getFileAsX509Certificate(inputStream).blockingGet();
if (date.after(caCert2.getNotBefore()) && date.before(caCert2.getNotAfter())) {
byte[] eontiRootcaCertificate = ioRepository.getBytesFromFile(OtgcConstant.EONTI_ROOT_CERTIFICATE).blockingGet();
if (OCPki.addMfgTrustAnchor(device, eontiRootcaCertificate) == -1) {
throw new Exception("Add root certificate error");
Expand All @@ -143,6 +146,18 @@ private void factoryResetHandler(long device) throws Exception {
this.displayNotValidCertificateHandler.handler("EonTi root certificate is not valid");
}

/* CloudCA root cert */
inputStream = context.getAssets().open(OtgcConstant.CLOUD_ROOT_CERTIFICATE);
X509Certificate cloudCert = ioRepository.getFileAsX509Certificate(inputStream).blockingGet();
if (date.after(cloudCert.getNotBefore()) && date.before(cloudCert.getNotAfter())) {
byte[] cloudRootcaCertificate = ioRepository.getBytesFromFile(OtgcConstant.CLOUD_ROOT_CERTIFICATE).blockingGet();
if (OCPki.addMfgTrustAnchor(device, cloudRootcaCertificate) == -1) {
throw new Exception("Add root certificate error");
}
} else {
this.displayNotValidCertificateHandler.handler("Cloud CA root certificate is not valid");
}

OCObt.shutdown();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ public ResetClientModeUseCase(ProvisioningRepository provisioningRepository,
}

public Completable execute() {
return provisioningRepository.resetSvrDb()
.andThen(Completable.fromAction(() -> preferencesRepository.setMode(OtgcMode.CLIENT)));
//return provisioningRepository.resetSvrDb()
// .andThen(Completable.fromAction(() -> preferencesRepository.setMode(OtgcMode.CLIENT)));
return Completable.fromAction(() -> preferencesRepository.setMode(OtgcMode.CLIENT))
.andThen (provisioningRepository.resetSvrDb());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ public Completable execute() {
return iotivityRepository.scanOwnedDevices()
.flatMapCompletable(device -> doxsRepository.resetDevice(device.getDeviceId()))
.delay(preferencesRepository.getRequestsDelay(), TimeUnit.SECONDS)
.andThen(Completable.fromAction(() -> preferencesRepository.setMode(OtgcMode.OBT)))
.andThen(provisioningRepository.resetSvrDb())
.andThen(provisioningRepository.doSelfOwnership())
.andThen(Completable.fromAction(() -> preferencesRepository.setMode(OtgcMode.OBT)));
.andThen(provisioningRepository.doSelfOwnership());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public RetrieveVerticalResourcesUseCase(IotivityRepository iotivityRepository) {
}

public Single<List<String>> execute(Device device) {
return iotivityRepository.getNonSecureEndpoint(device)
return iotivityRepository.getEndpoint(device)
.flatMap(iotivityRepository::findResources)
.map(ocRes -> {
List<String> verticalResources = new ArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public GetPlatformInfoUseCase(IotivityRepository iotivityRepository) {
}

public Single<OcPlatformInfo> execute(Device device) {
return iotivityRepository.getNonSecureEndpoint(device)
return iotivityRepository.getEndpoint(device)
.flatMap(iotivityRepository::getPlatformInfo);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public IntrospectUseCase(IotivityRepository iotivityRepository) {
}

public Single<JSONObject> execute(Device device) {
return iotivityRepository.getNonSecureEndpoint(device)
return iotivityRepository.getEndpoint(device)
.flatMap(endpoint -> iotivityRepository.findResource(endpoint, OcfResourceType.INTROSPECTION))
.flatMap(res -> {
OcResource introspectionResource = res.getResourceList().get(0);
Expand Down
Loading

0 comments on commit 619f1a2

Please sign in to comment.