#ifndef __IOT_ENROLLEE_H__
#define __IOT_ENROLLEE_H__
+#include <iostream>
#include <memory>
#include <string>
IOT_Enrollee& operator=(const IOT_Enrollee& _obj);
+ std::string host() const { return m_host; }
+ std::string auth_provider() const { return m_auth_provider; }
+ std::string auth_code() const { return m_auth_code; }
+
+ std::string uid() const { return m_uid; }
+ std::string access_token() const { return m_access_token; }
+
+ friend std::ostream& operator<<(std::ostream& _os, const IOT_Enrollee& _obj);
+
private:
std::string m_host;
std::string m_auth_provider;
}
return *this;
}
+
+/*******************************************************/
+/*******************************************************/
+/*friend*/ std::ostream& operator<<(std::ostream& _os, const IOT_Enrollee& _obj)
+{
+ _os << "host : " << _obj.m_host << " auth_provider : " << _obj.m_auth_provider << " auth_code : " << _obj.m_auth_code << " uid : " << _obj.m_uid << " access_token : " << _obj.m_access_token;
+ return _os;
+}
#include "OCPlatform.h"
#include "OCApi.h"
+
#include "IOT_DeviceFinder.h"
+#include "IOT_EasySetup.h"
+#include "IOT_Enrollee.h"
using namespace std;
ASSERT_TRUE(res);
}
+#if 0
+TEST(test_IoT, IOT_EasySetup)
+{
+ IOT_EasySetup_Info info;
+ bool res;
+ if((res = IOT_EasySetup(&info)))
+ {
+ std::cout << "host : " << info.cloud_info.host << std::endl;
+ std::cout << "auth_provider : " << info.cloud_info.auth_provider << std::endl;
+ std::cout << "auth_code : " << info.cloud_info.auth_code << std::endl;
+ }
+ ASSERT_TRUE(res);
+}
+#endif
+
+FILE* server_fopen(const char *path, const char *mode)
+{
+ (void) path;
+ return fopen("oic_svr_db_server.dat", mode);
+}
+TEST(test_IoT, IOT_Enrollee)
+{
+ try
+ {
+ OCPersistentStorage ps{ server_fopen, fread, fwrite, fclose, unlink };
+ OC::PlatformConfig cfg = {OC::ServiceType::InProc, OC::ModeType::Both, "0.0.0.0", 0, OC::QualityOfService::LowQos, &ps};
+ IOT_Enrollee enrollee = IOT_Enrollee::Create(cfg, CT_ADAPTER_TCP);
+ std::cout << enrollee << std::endl;
+ ASSERT_TRUE(true);
+ }
+ catch(const std::exception& _e)
+ {
+ std::cout << "err : " << _e.what() << std::endl;
+ ASSERT_TRUE(false);
+ }
+}
+
TEST(test_IoT, configureTest)
{
OC::PlatformConfig config { OC::ServiceType::InProc, OC::ModeType::Both, "0.0.0.0", 0, OC::QualityOfService::HighQos };