32 #include "uasession.h" 42 extern "C" __declspec(dllexport)
void UaTrace_tError(
const char * fmt,
const char * text)
44 UaTrace::tError(fmt, text);
48 #ifndef UA_BUILD_DATE_ZONE 49 #define UA_BUILD_DATE_ZONE 1 // Must match UTC offset and daylight saving time at build date 68 : UaServerApplication(argc, argv, bRunAsService, sApplicationName)
78 if ( isStarted() != OpcUa_False )
80 UaLocalizedText reason(
"en",
"Application shut down");
91 ret = UaServerApplication::afterStartUp();
94 cout <<
"Create certificate only!" << endl;
96 cout <<
"Create certificate error " << ret.toString(ret.statusCode()).toUtf8() << endl;
103 UA_ASSERT(ret.isGood());
105 cout <<
"Initialize Interfaces" << endl;
111 cout <<
"Could not create Address Space" << endl;
114 UaString sRejectedCertificateDirectory;
115 OpcUa_UInt32 nRejectedCertificatesCount;
116 UaEndpointArray uaEndpointArray;
117 getServerConfig()->getEndpointConfiguration(
118 sRejectedCertificateDirectory,
119 nRejectedCertificatesCount,
121 if ( uaEndpointArray.length() > 0 )
123 printf(
"***************************************************\n");
124 printf(
" Server opened endpoints for following URLs:\n");
127 for ( idx=0; idx<uaEndpointArray.length(); idx++ )
129 if ( uaEndpointArray[idx]->isOpened() )
131 printf(
" %s\n", uaEndpointArray[idx]->sEndpointUrl().toUtf8());
141 printf(
"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
142 printf(
"!!!! The following endpoints URLs failed:\n");
143 for ( idx=0; idx<uaEndpointArray.length(); idx++ )
145 if ( uaEndpointArray[idx]->isOpened() == false )
147 printf(
"!!!! %s\n", uaEndpointArray[idx]->sEndpointUrl().toUtf8());
150 printf(
"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
153 printf(
"***************************************************\n");
158 cout <<
"Could not StartUp Server " << std::hex << ret.code() <<
" "<< ret.toString().toUtf8() << endl;
181 static OpcUa_DateTime
date;
182 static const char szDate[] = __DATE__;
183 static char szISO[] =
"YYYY-MM-DDT" __TIME__
"Z";
184 static const char* Months[] = {
"Jan",
"Feb",
"Mar",
"Apr",
"May",
"Jun",
"Jul",
"Aug",
"Sep",
"Oct",
"Nov",
"Dec" };
188 szISO[0] = szDate[7];
189 szISO[1] = szDate[8];
190 szISO[2] = szDate[9];
191 szISO[3] = szDate[10];
194 while ( (strncmp(Months[(
int)mon], szDate, 3) != 0) && (mon < 11) )
199 szISO[5] =
'0' + mon / 10;
200 szISO[6] =
'0' + mon % 10;
203 szISO[8] = szDate[4];
204 szISO[9] = szDate[5];
207 OpcUa_DateTime_GetDateTimeFromString(szISO, &
date);
210 UaDateTime buildDate(
date);