void UnselectNetwork() { char buf[MAX_BUF_LEN] = {0}; Serial.println("============"); Serial.println("Unselect network"); Serial.println("IPv4: 0"); Serial.println("LE: 1"); Serial.println("EDR: 2\n"); size_t len = 0; GetData(buf, sizeof(buf), &len); int number = buf[0] - '0'; Serial.println(number); if (0 >= len || number < 0 || number > 3) { Serial.println("Wrong i/p. WIFI selected"); number = 1; } if (number == 3) { g_isLeSelected = false; } CAUnSelectNetwork((CATransportAdapter_t)(1 << number)); Serial.println("Terminate"); CATerminate(); Serial.println("============"); }
//CATerminate TC TEST_F(CATests, TerminateTest) { CATerminate(); char* check = (char *) "terminate success"; EXPECT_STREQ(check, "terminate success"); CAInitialize(); }
int main() { int ret = system("clear"); // shell invoke error: 127, others: -1 if (SYSTEM_INVOKE_ERROR == ret || SYSTEM_ERROR == ret) { printf("Terminal Clear Error: %d\n", ret); return -1; } printf("=============================================\n"); printf("\t\tsample main\n"); printf("=============================================\n"); CAResult_t res = CAInitialize(); if (CA_STATUS_OK != res) { printf("CAInitialize fail\n"); return -1; } /* * Read DTLS PSK credentials from persistent storage and * set in the OC stack. */ #ifdef __WITH_DTLS__ res = SetCredentials(); if (CA_STATUS_OK != res) { printf("SetCredentials failed\n"); return -1; } res = CARegisterDTLSCredentialsHandler(CAGetDtlsPskCredentials); if (CA_STATUS_OK != res) { printf("Set credential handler fail\n"); return -1; } #endif // set handler. CARegisterHandler(request_handler, response_handler, error_handler); process(); CADestroyToken(g_last_request_token); g_last_request_token = NULL; CATerminate(); #ifdef __WITH_DTLS__ clearDtlsCredentialInfo(); #endif return 0; }
JNIEXPORT void JNICALL Java_org_iotivity_ca_service_RMInterface_RMTerminate(JNIEnv *env, jobject obj) { LOGI("RMTerminate"); if (!env || !obj) { LOGI("Invalid input parameter"); return; } CADestroyToken(g_lastRequestToken); CATerminate(); delete_global_references(env, obj); }
int main() { int ret = system("clear"); // shell invoke error: 127, others: -1 if (SYSTEM_INVOKE_ERROR == ret || SYSTEM_ERROR == ret) { printf("Terminal Clear Error: %d\n", ret); return -1; } printf("=============================================\n"); printf("\t\tsample main\n"); printf("=============================================\n"); CAResult_t res = CAInitialize(); if (CA_STATUS_OK != res) { printf("CAInitialize fail\n"); return -1; } // Set the PSK Credentials callback handler. #ifdef __WITH_DTLS__ res = CARegisterDTLSCredentialsHandler(CAGetDtlsPskCredentials); if (CA_STATUS_OK != res) { printf("Register credential handler fail\n"); return -1; } #endif // set handler. CARegisterHandler(request_handler, response_handler, error_handler); process(); CADestroyToken(g_last_request_token); g_last_request_token = NULL; CATerminate(); return 0; }
virtual void TearDown() { CATerminate(); }
// CAInitialize TC // check return value TEST(InitializeTest, TC_01_Positive_01) { EXPECT_EQ(CA_STATUS_OK, CAInitialize()); CATerminate(); }
// CAInitialize TC TEST(InitializeTest, CAInitializeTest) { EXPECT_EQ(CA_STATUS_OK, CAInitialize()); CATerminate(); }