+ std::cout << "<===Invalid ObserveType selected."
+ <<" Setting ObserveType to Observe===>\n\n";
+ }
+}
+
+void checkTransportValue(int value)
+{
+ if (1 == value)
+ {
+ TRANSPORT_TYPE_TO_USE = OCConnectivityType::CT_ADAPTER_IP;
+ std::cout << "<===Setting TransportType to IP===>\n\n";
+ }
+ else if (2 == value)
+ {
+ TRANSPORT_TYPE_TO_USE = OCConnectivityType::CT_ADAPTER_TCP;
+ std::cout << "<===Setting TransportType to TCP===>\n\n";
+ }
+ else
+ {
+ std::cout << "<===Invalid TransportType selected."
+ <<" Setting TransportType to IP===>\n\n";
+ }
+}
+
+static FILE* client_open(const char* /*path*/, const char *mode)
+{
+ return fopen(SVR_DB_FILE_NAME, mode);
+}
+
+int main(int argc, char* argv[]) {
+
+ std::ostringstream requestURI;
+ OCPersistentStorage ps {client_open, fread, fwrite, fclose, unlink, NULL, NULL};
+ try
+ {
+ printUsage();
+ if (argc == 1)
+ {
+ std::cout << "<===Setting ObserveType to Observe and ConnectivityType to IP===>\n\n";
+ }
+ else if (argc == 2)
+ {
+ checkObserverValue(std::stoi(argv[1]));
+ }
+ else if (argc == 3)
+ {
+ checkObserverValue(std::stoi(argv[1]));
+ checkTransportValue(std::stoi(argv[2]));
+ }
+ else
+ {
+ std::cout << "<===Invalid number of command line arguments===>\n\n";
+ return -1;
+ }
+ }
+ catch(std::exception& )
+ {
+ std::cout << "<===Invalid input arguments===>\n\n";