|
@@ -37,8 +37,6 @@
|
|
|
#include "sqlite3.h"
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
#if 0
|
|
|
#define DEBUG_INFO(format, args...) StoreLogMsg("[%s:%d][%s][Info] "format, __FILE__, __LINE__, __FUNCTION__, ##args)
|
|
|
#define DEBUG_WARN(format, args...) StoreLogMsg("[%s:%d][%s][Warn] "format, __FILE__, __LINE__, __FUNCTION__, ##args)
|
|
@@ -386,13 +384,38 @@ static int OCPP16Callback(struct lws *wsi, enum lws_callback_reasons reason, voi
|
|
|
#ifdef SystemLogMessage
|
|
|
DEBUG_INFO("LWS_CALLBACK_CLIENT_FILTER_PRE_ESTABLISH\n");
|
|
|
#endif
|
|
|
- DEBUG_OCPPMESSAGE_INFO("LWS_CALLBACK_CLIENT_FILTER_PRE_ESTABLISH Receive %s\n", (char *)in);
|
|
|
- break;
|
|
|
- case LWS_CALLBACK_CLOSED_CLIENT_HTTP:
|
|
|
- #ifdef SystemLogMessage
|
|
|
- DEBUG_INFO("LWS_CALLBACK_CLOSED_CLIENT_HTTP\n");
|
|
|
- #endif
|
|
|
+ char buf[64];
|
|
|
+
|
|
|
+ DEBUG_OCPPMESSAGE_INFO("------------------Handshake: Server response START----------------\n");
|
|
|
+
|
|
|
+ lws_hdr_copy(wsi, buf, sizeof(buf) - 1, WSI_TOKEN_HTTP);
|
|
|
+ DEBUG_OCPPMESSAGE_INFO("HTTP/1.1 %s\n", buf);
|
|
|
+
|
|
|
+ lws_hdr_copy(wsi, buf, sizeof(buf) - 1, WSI_TOKEN_UPGRADE);
|
|
|
+ DEBUG_OCPPMESSAGE_INFO("Upgrade: %s\n", buf);
|
|
|
+
|
|
|
+
|
|
|
+ lws_hdr_copy(wsi, buf, sizeof(buf) - 1, WSI_TOKEN_CONNECTION);
|
|
|
+ DEBUG_OCPPMESSAGE_INFO("Connection: %s\n", buf);
|
|
|
+
|
|
|
+ lws_hdr_copy(wsi, buf, sizeof(buf) - 1, WSI_TOKEN_ACCEPT);
|
|
|
+ DEBUG_OCPPMESSAGE_INFO("Sec-WebSocket-Accept: %s\n", buf);
|
|
|
+
|
|
|
+ lws_hdr_copy(wsi, buf, sizeof(buf) - 1, WSI_TOKEN_PROTOCOL);
|
|
|
+ DEBUG_OCPPMESSAGE_INFO("Sec-WebSocket-Protocol: %s\n", buf);
|
|
|
+
|
|
|
+ DEBUG_OCPPMESSAGE_INFO("------------------Handshake: Server response END----------------\n");
|
|
|
+
|
|
|
break;
|
|
|
+
|
|
|
+ case LWS_CALLBACK_FILTER_PROTOCOL_CONNECTION:
|
|
|
+ #ifdef SystemLogMessage
|
|
|
+ DEBUG_INFO("LWS_CALLBACK_CLIENT_APPEND_HANDSHAKE_HEADER\n");
|
|
|
+ #endif
|
|
|
+
|
|
|
+
|
|
|
+ break;
|
|
|
+
|
|
|
case LWS_CALLBACK_WSI_DESTROY:
|
|
|
#ifdef SystemLogMessage
|
|
|
DEBUG_INFO("LWS_CALLBACK_WSI_DESTROY\n");
|
|
@@ -422,12 +445,25 @@ static int OCPP16Callback(struct lws *wsi, enum lws_callback_reasons reason, voi
|
|
|
break;
|
|
|
case LWS_CALLBACK_GET_THREAD_ID:
|
|
|
break;
|
|
|
+
|
|
|
case LWS_CALLBACK_CLIENT_APPEND_HANDSHAKE_HEADER:
|
|
|
- #ifdef SystemLogMessage
|
|
|
- DEBUG_INFO("LWS_CALLBACK_CLIENT_APPEND_HANDSHAKE_HEADER\n");
|
|
|
- #endif
|
|
|
+ {
|
|
|
+ #ifdef SystemLogMessage
|
|
|
+ DEBUG_INFO("LWS_CALLBACK_CLIENT_APPEND_HANDSHAKE_HEADER\n");
|
|
|
+ #endif
|
|
|
+#if 0
|
|
|
+ unsigned char **p, *end;
|
|
|
+ struct lws *parent;
|
|
|
+ char buf[8192];
|
|
|
|
|
|
- DEBUG_OCPPMESSAGE_INFO("LWS_CALLBACK_CLIENT_APPEND_HANDSHAKE_HEADER Receive %s\n", (char *)in);
|
|
|
+ parent = lws_get_parent(wsi);
|
|
|
+ if (!parent)
|
|
|
+ break;
|
|
|
+
|
|
|
+ p = (unsigned char **)in;
|
|
|
+ end = (*p) + len;
|
|
|
+#endif
|
|
|
+ }
|
|
|
|
|
|
break;
|
|
|
case LWS_CALLBACK_CLIENT_ESTABLISHED://3
|
|
@@ -436,7 +472,6 @@ static int OCPP16Callback(struct lws *wsi, enum lws_callback_reasons reason, voi
|
|
|
#endif
|
|
|
//connected
|
|
|
ConnectionEstablished=1;
|
|
|
- DEBUG_OCPPMESSAGE_INFO("LWS_CALLBACK_CLIENT_ESTABLISHED Receive %s\n", (char *)in);
|
|
|
break;
|
|
|
case LWS_CALLBACK_CLIENT_CONNECTION_ERROR://1
|
|
|
#ifdef Debug
|