#include #include #include #include "log.h" #include "config.h" #include "restful.h" #include "json_interface.h" #include "err_code.h" #define ZTP_ESN ("ace08484843") void __onPost(void* pData, unsigned int size, const char* pReqUrl, const char* pDlPath, const char* pTaskUuid, int iFinished, void* pUserData) { LOG_EX(LOG_Info, "Post Result: %s\n", (char*)pData); } int main(int argc, char** argv) { int ret = ERR_OK; const char* pJson; AUTH_ZTH_REQ ztpReq; IHW_InitLOG("ZTP", NULL, TRUE); LOG_EX(LOG_Debug, "Hello ZTP V2\n"); init_configure(DEVICE_ZTP_PATH); memset(&ztpReq, 0, sizeof(AUTH_ZTH_REQ)); ztpReq.pESN = ZTP_ESN; pJson = Struct2Json(&ztpReq, JE_AUTH_ZTP, FALSE, &ret); if(pJson && ret == ERR_OK) { http_post_request("https://xajhuang.com:3006/post", pJson, __onPost); } else { LOG_EX(LOG_Error, "Create JSON error: %d\n", ret); } if(pJson) { free((void*)pJson); } while(TRUE){ usleep(1000); } IHW_WaitFinishLogout(); return 0; }