39 #define __FILE_ID__ "yapi" 65 static int global_req_count = 0;
67 static int write_onfile(
int fileno,
char *mode,
const char *firstline,
int firstline_len,
const char * buffer,
int bufferlen)
72 YSPRINTF(filename, 128,
"req_trace\\req_%03d.bin", fileno);
75 if (
YFOPEN(&f, filename, mode) != 0) {
82 fwrite(firstline, 1, firstline_len, f);
84 fwrite(buffer, 1, bufferlen, f);
91 #define FILE_NO_BIT_MASK 0XFFF 93 static int YREQ_LOG_START(
const char *msg,
const char *device,
const char * request,
int requestsize)
95 char buffer[2048], buffer2[64];
98 int threadIdx, count, first_len;
101 count = global_req_count++;
102 int fileno = count & FILE_NO_BIT_MASK;
105 localtime_s(&timeinfo, &rawtime);
106 strftime(buffer2,
sizeof(buffer2),
"%Y-%m-%d %H:%M:%S", &timeinfo);
109 first_len =
YSPRINTF(buffer, 2048,
"[%s/%"FMTu64
"](%d):no=%d = %s on %s\n",buffer2,
yapiGetTickCount(), threadIdx, count, msg, device);
110 write_onfile(fileno,
"wb", buffer, first_len, request, requestsize);
114 static int YREQ_LOG_APPEND(
int count,
const char *msg,
const char * response,
int responsesize, u64 start_tm)
116 char buffer[2048], buffer2[64];
119 int threadIdx, first_len;
122 int fileno = count & FILE_NO_BIT_MASK;
125 localtime_s(&timeinfo, &rawtime);
126 strftime(buffer2,
sizeof(buffer2),
"%Y-%m-%d %H:%M:%S", &timeinfo);
129 first_len =
YSPRINTF(buffer, 2048,
"[%s/%"FMTu64
"](%d):no=%d : %s responsesize=%d\n",buffer2,
yapiGetTickCount() - start_tm, threadIdx, count, msg, responsesize);
131 write_onfile(fileno,
"ab", buffer, first_len, response, responsesize);
135 static int YREQ_LOG_APPEND_ERR(
int count,
const char *msg,
const char *errmsg,
int error, u64 start_tm)
137 char buffer[2048], buffer2[64];
140 int threadIdx, first_len;
143 int fileno = count & FILE_NO_BIT_MASK;
146 localtime_s(&timeinfo, &rawtime);
147 strftime(buffer2,
sizeof(buffer2),
"%Y-%m-%d %H:%M:%S", &timeinfo);
150 first_len =
YSPRINTF(buffer, 2048,
"[%s/%"FMTu64
"](%d):no=%d : %s errmsg(%d)=%s\n", buffer2,
yapiGetTickCount()- start_tm, threadIdx, count, msg, error, errmsg);
152 write_onfile(fileno,
"ab", buffer, first_len, NULL, 0);
160 #ifdef DEBUG_CALLBACK 164 static int global_callback_count = 0;
166 static write_cb_onfile(
YAPI_FUNCTION fundescr,
const char *value)
171 int fileno = global_callback_count >> 16;
173 char buffer[2048], buffer2[64];
176 int threadIdx, bufferlen;
179 if ((global_callback_count & 0xffff) == 0) {
183 YSPRINTF(filename, 128,
"callback_trace\\callback_%d.txt", fileno);
186 localtime_s(&timeinfo, &rawtime);
187 strftime(buffer2,
sizeof(buffer2),
"%Y-%m-%d %H:%M:%S", &timeinfo);
194 bufferlen =
YSPRINTF(buffer, 2048,
"[%s/%"FMTu64
"](%d):no=%d : invalid function ID (%X)\n",buffer2,
yapiGetTickCount(), threadIdx, global_callback_count, fundescr);
196 bufferlen =
YSPRINTF(buffer, 2048,
"[%s/%"FMTu64
"](%d):no=%d : %s.%s (%X)=%s\n",buffer2,
yapiGetTickCount(), threadIdx, global_callback_count, serial,funcId, fundescr, value);
198 global_callback_count++;
203 if (
YFOPEN(&f, filename, mode) != 0) {
205 _mkdir(
"callback_trace");
210 fwrite(buffer, 1, bufferlen, f);
215 static write_timedcb_onfile(
YAPI_FUNCTION fundescr,
double deviceTime,
const u8 *report, u32 len)
218 YSPRINTF(buffer, 2048,
"Timed %f %p:%u",deviceTime, report, len);
219 return write_cb_onfile(fundescr, buffer);
229 #ifdef DEBUG_CALLBACK 230 write_cb_onfile(fundescr, value);
241 #ifdef DEBUG_CALLBACK 242 write_timedcb_onfile(fundescr, deviceTime, report, len);
286 #ifdef DEBUG_NET_ENUM 287 const char * ENU_PARSE_STATE_STR[]=
295 "ENU_WP_LOGICALNAME",
296 "ENU_WP_PRODUCTNAME",
307 "ENU_YP_LOGICALNAME",
308 "ENU_YP_PRODUCTNAME",
309 "ENU_YP_ADVERTISEDVALUE",
350 dbglog(
"no USB device can unregister previous devices ( 0x%X) \n",devUrl);
354 registeredType =
yHashGetUrlPort(registeredUrl, NULL, NULL, NULL, NULL, NULL);
357 dbglog(
"unregister same device connected by USB ( 0x%X vs 0x%X) \n",devUrl,hub->
url);
361 if (registeredUrl != devUrl){
362 if( devUrl == hub->
url){
364 dbglog(
"unregister same device connected by a VirtualHub (0x%X vs 0x%X) \n",devUrl,hub->
url);
396 static void logResult(
void *context,
const u8 *result, u32 resultlen,
int retcode,
const char *errmsg)
401 const char * p = (
char*) result;
402 const char *
start = (
char*) result;
411 if (result==NULL || start[0] !=
'O' || start[1] !=
'K'){
415 while (resultlen >= 4) {
416 if (p[0] ==
'\r' && p[1] ==
'\n' && p[2] ==
'\r' && p[3] ==
'\n'){
426 p = start + resultlen - 1;
428 while (p > start && *p !=
'@'){
429 if (*p <'0' || *p >
'9'){
442 memcpy(buffer, p+1, poslen);
443 buffer[poslen] =
'\0';
454 int linelen = (int)(p - start);
455 memcpy(buffer, start, linelen);
456 buffer[linelen] =
'\0';
469 static int yapiRequestOpenWS(
YIOHDL_internal *iohdl,
HubSt *hub,
YAPI_DEVICE dev,
int tcpchan,
const char *request,
int reqlen, u64 mstimeout,
yapiRequestAsyncCallback callback,
void *context,
RequestProgress progress_cb,
void *progress_ctx,
char *errmsg);
523 reqlen =
YSPRINTF(p, 512 - used,
"logs.txt?pos=%d\r\n\r\n", logPos);
544 res =
yapiRequestOpenWS(&iohdl, hub, dev, 0, request, reqlen,
YIO_10_MINUTES_TCP_TIMEOUT,
logResult, (
void*)gen, NULL, NULL, errmsg);
611 dbglog(
"SAFE WP: register %s(0x%X) from %s:%u\n",
yHashGetStrPtr(serialref),serialref,host,port);
612 dbglog(
"url : hub = %d dev =%d\n",hub->
url,devUrl);
618 dbglog(
"device : %x (%d)\n",deviceid,beacon);
624 wpRegister(-1, serialref, lnameref, productref, deviceid,devUrl,beacon);
672 dbglog(
"url : hub = %d dev =%d\n",hub->
url,devUrl);
676 dbglog(
"product : INVALID_HASH_IDX\n");
677 dbglog(
"device : %x (%d)\n",0,beacon);
726 dbglog(
"parseNetWpEntry %X was present\n",enus->
serial);
766 #ifdef DEBUG_NET_ENUM 970 point = strchr(j->
token,
'.');
1009 const char *request =
"GET /api.json \r\n\r\n";
1013 #ifdef DEBUG_YAPI_REQ 1014 int req_count = YREQ_LOG_START(
"yNetHubEnumEx", hub->
name, request,
YSTRLEN(request));
1018 if (
YISERR((res =
yReqOpen(req, 2 *
YIO_DEFAULT_TCP_TIMEOUT, 0, request,
YSTRLEN(request),
YIO_DEFAULT_TCP_TIMEOUT, NULL, NULL, NULL, NULL, errmsg)))) {
1023 memset(&j,0,
sizeof(j));
1032 res =
yReqRead(req, buffer,
sizeof(buffer));
1034 #ifdef DEBUG_YAPI_REQ 1035 YREQ_LOG_APPEND(req_count,
"yNetHubEnumEx", buffer, res, start_tm);
1037 j.
src = (
char*)buffer;
1038 j.
end = (
char*)buffer + res;
1048 res =
yReqRead(req, buffer,
sizeof(buffer));
1100 memset(&enus,0,
sizeof(enus));
1133 dbglog(
"error with hub %s : %s",hub->
name,errmsg);
1161 huburl =
yHashUrl(url,
"", 0, errmsg);
1167 memset(hub,0,
sizeof(
HubSt));
1173 name = (
char*)
yMalloc(len+1);
1174 memcpy(name,url,len+1);
1191 #ifdef TRACE_NET_HUB 1192 dbglog(
"HUB%p: %x->%s allocated \n",hub, hub->
url, hub->
name);
1200 #ifdef TRACE_NET_HUB 1216 memset(hub, 0,
sizeof(
HubSt));
1236 #ifdef TRACE_NET_HUB 1237 dbglog(
"HUB: unregister %x->%s \n",huburl,hub->
name);
1255 for(i = 0 ; i < nbKnownDevices; i++) {
1265 static void ssdpEntryUpdate(
const char *serial,
const char *urlToRegister,
const char *urlToUnregister)
1280 if (urlToRegister) {
1281 if (urlToUnregister) {
1318 #pragma pack(push,1) 1335 #ifdef PERF_API_FUNCTIONS 1336 memset(&yApiPerf,0,
sizeof(yApiPerf));
1353 test.
raw = 0xdeadbeef;
1358 #ifdef CPU_BIG_ENDIAN 1364 #ifndef CPU_BIG_ENDIAN 1374 if(atof(
"1") != 1.0){
1375 #if defined(BUILD_ARMHF) 1377 #elif defined(BUILD_ARMEL) 1386 #ifdef DEBUG_CRITICAL_SECTION 1431 #ifndef YAPI_IN_YDEVICE 1449 #ifdef PERF_API_FUNCTIONS 1460 #ifndef YAPI_IN_YDEVICE 1489 #ifdef DEBUG_CRITICAL_SECTION 1532 dbglog(
"activate log %s %d\n", serial, start);
1552 if(arrivalCallback != NULL){
1623 #ifdef DEBUG_NET_NOTIFICATION 1624 static void dumpNotif(
const char *buffer)
1627 printf(
"%s",buffer);
1629 fwrite(buffer,1,
YSTRLEN(buffer),f);
1637 #define LOCALURL_LEN 64 1654 if (hub->
serial != serialref) {
1683 u8 pkttype = 0,devydx,funydx,funclass;
1684 char *serial = NULL,*name,*funcid,*children;
1688 char escapechar = 27;
1689 #ifdef DEBUG_NET_NOTIFICATION 1713 dbglog(
"Too many invalid notifications, clearing buffer\n");
1728 if (end + 1 > (u16)
sizeof(buffer)){
1729 dbglog(
"Drop invalid short notification (too long :%d)\n", end + 1);
1736 devydx = (*p++) -
'A';
1737 funydx = (*p++) -
'0';
1746 value[pos++] = *p++;
1749 #ifdef DEBUG_NET_NOTIFICATION 1750 YSPRINTF(Dbuffer,512,
"FuncVYDX >devYdx=%d funYdx=%d val=%s (%d)\n",
1751 devydx,funydx,value,abspos);
1758 funInfo.
raw = funydx;
1769 #ifdef DEBUG_NET_NOTIFICATION 1770 dbglog(
"notify device log for devydx %d\n", devydx);
1785 while (isxdigit((u8)p[0]) && isxdigit((u8)p[1]) && pos <
sizeof(report)) {
1786 int hi_nib = (p[0] <=
'9' ? p[0]-
'0' : 10+(p[0]&0x4f)-
'A');
1787 int lo_nib = (p[1] <=
'9' ? p[1]-
'0' : 10+(p[1]&0x4f)-
'A');
1788 report[pos++] = hi_nib * 16 + lo_nib;
1791 #ifdef DEBUG_NET_NOTIFICATION 1792 YSPRINTF(Dbuffer,512,
"%s >devYdx=%d funYdx=%d (%d)\n",
1794 devydx,funydx,abspos);
1798 u32 t = report[1] + 0x100u * report[2] + 0x10000u * report[3] + 0x1000000u * report[4];
1809 funInfo.
raw = funydx;
1816 value[pos++] = *p++;
1825 funInfo.
raw = funydx;
1827 #ifdef DEBUG_NET_NOTIFICATION 1829 YSPRINTF(Dbuffer,512,
"FuncV2YDX >devYdx=%d funYdx=%d val=%s (%d)\n",devydx,funydx,value8bit,abspos);
1831 YSPRINTF(Dbuffer,512,
"FuncV2YDX >devYdx=%d funYdx=%d val=%d:%02x.%02x.%02x.%02x.%02x.%02x (%d)\n",
1833 value8bit[0],value8bit[1],value8bit[2],value8bit[3],value8bit[4],value8bit[5],abspos);
1854 #ifdef DEBUG_NET_NOTIFICATION 1855 memset(throwbuf, 0,
sizeof(throwbuf));
1856 tmp = (end > 50 ? 50 : end);
1860 YSPRINTF(Dbuffer,512,
"throw %d / %d [%s]\n",
1880 #ifdef DEBUG_NET_NOTIFICATION 1881 YSPRINTF(Dbuffer,512,
"Sync from %d to %s\n",
1890 #ifdef DEBUG_NET_NOTIFICATION 1891 YSPRINTF(Dbuffer,1024,
"HUB: %X->%s will send ping notification\n",hub->
url,hub->
name);
1903 #ifdef DEBUG_NET_NOTIFICATION 1904 YSPRINTF(Dbuffer,512,
"no serialFOR %s\n",buffer);
1918 #ifdef DEBUG_NET_NOTIFICATION 1919 dbglog(
"drop: invalid new name (%X)\n",pkttype);
1924 #ifdef DEBUG_NET_NOTIFICATION 1925 dbglog(
"NOTIFY_PKT_NAME %s : new name is \"%s\" beacon %x\n",serial,name ,*p);
1926 YSPRINTF(Dbuffer,512,
"NAME >%s name=%s beacon=%c (%d)\n",serial,name,*p,abspos);
1935 #ifdef DEBUG_NET_NOTIFICATION 1936 dbglog(
"drop: invalid funcid (%X:%s)\n",pkttype,serial);
1942 #ifdef DEBUG_NET_NOTIFICATION 1943 dbglog(
"NOTIFY_PKT_FUNCNAME %s : funcid is \"%s\" name \"%s\"\n",serial,funcid,name);
1944 YSPRINTF(Dbuffer,512,
"FuncNAME >%s funcid=%s funcname=%s (%d)\n",
1945 serial,funcid,name,abspos);
1954 #ifdef DEBUG_NET_NOTIFICATION 1955 dbglog(
"drop: invalid funcid (%X)\n",pkttype);
1962 #ifdef DEBUG_NET_NOTIFICATION 1964 YSPRINTF(Dbuffer,512,
"FuncVAL >%s funcid=%s val=%s (%d)\n",
1965 serial,funcid,value,abspos);
1974 #ifdef DEBUG_NET_NOTIFICATION 1975 dbglog(
"drop: invalid funcid (%X:%s)\n",pkttype,serial);
1983 #ifdef DEBUG_NET_NOTIFICATION 1984 dbglog(
"drop: invalid funcname (%X:%s)\n",pkttype,serial);
1991 if(p==NULL || p[1] <
'0'){
1994 funclass = p[1]-
'0';
1996 #ifdef DEBUG_NET_NOTIFICATION 1997 YSPRINTF(Dbuffer,512,
"FuncNYDX >%s funcid=%s funcname=%s funYdx=%d (%d)\n",
1998 serial,funcid,name,funydx,abspos);
2001 ypUpdateUSB(serial,funcid,name,funclass,funydx,NULL);
2007 #ifdef DEBUG_NET_NOTIFICATION 2008 dbglog(
"drop: invalid children notification (%X)\n",pkttype);
2013 #ifdef DEBUG_NET_NOTIFICATION 2014 dbglog(
"NOTIFY_PKT_CHILDREN %s : new children is \"%s\" plug %x\n",serial,children ,*p);
2015 YSPRINTF(Dbuffer,512,
"CHILD >%s childserial=%s on-off=%c (%d)\n",
2016 serial, children,*p,abspos);
2024 #ifdef DEBUG_NET_NOTIFICATION 2025 dbglog(
"NOTIFY_NETPKT_LOG %s\n", serial);
2034 #ifdef DEBUG_NET_NOTIFICATION 2035 dbglog(
"notify device log for %s (%d)\n", serial,devydx);
2043 #ifdef DEBUG_NET_NOTIFICATION 2044 dbglog(
"drop: invalid pkttype (%X)\n",pkttype);
2045 dumpNotif(
"drop: invalid pkttype\n");
2079 int first_notification_connection=1;
2080 #ifdef DEBUG_NET_NOTIFICATION
2091 if (devydx != 0xff){
2111 #ifdef TRACE_NET_HUB 2116 if (first_notification_connection) {
2117 YSPRINTF(request, 256,
"GET /not.byn HTTP/1.1\r\n\r\n");
2121 res =
yReqOpen(hub->
http.
notReq, 2 *
YIO_DEFAULT_TCP_TIMEOUT, 0, request,
YSTRLEN(request), 0, NULL, NULL, NULL, NULL, errmsg);
2132 #ifdef TRACE_NET_HUB 2133 dbglog(
"TRACE(%X->%s): unable to open notification socket(%s)\n",hub->
url,hub->
name,errmsg);
2137 #ifdef TRACE_NET_HUB 2138 dbglog(
"TRACE(%X->%s): notification socket open\n",hub->
url,hub->
name);
2140 #ifdef DEBUG_NET_NOTIFICATION 2150 first_notification_connection = 0;
2158 if(req == NULL || req->
hub != hub){
2162 selectlist[towatch++] = req;
2167 dbglog(
"yTcpMultiSelectReq failed (%s)\n",errmsg);
2170 for (i = 0; i < towatch; i++) {
2171 req = selectlist[i];
2175 if(toread >=
sizeof(buffer)) toread =
sizeof(buffer)-1;
2176 res =
yReqRead(req, buffer, toread);
2179 #if 0 //def DEBUG_NET_NOTIFICATION 2180 YSPRINTF(Dbuffer,1024,
"HUB: %X->%s push %d [\n%s\n]\n",hub->
url,hub->
name,res,buffer);
2190 if(!memcmp((u8 *)buffer, (u8 *)
"HTTP/1.1 200", 12)) {
2199 dbglog(
"Network hub %s cannot provide notifications", hubname);
2209 #ifdef TRACE_NET_HUB 2211 dbglog(
"network hub %s(%x) didn't respond for too long (%d)\n", hub->
name, hub->
url, res);
2229 dbglog(
"Disconnected from network hub %s (%s)\n", hub->
name, errmsg);
2241 #ifdef DEBUG_NET_NOTIFICATION 2242 YSPRINTF(Dbuffer, 1024,
"Network hub %X->%s has closed the connection for notification\n", hub->
url, hub->
name);
2328 }
else if (
YSTRICMP(url,
"net") == 0) {
2341 HubSt *hubst = NULL;
2343 void* (*thead_handler)(
void *);
2346 if (hubst == NULL) {
2350 hubst->mandatory = 1;
2364 if (i >= NBMAX_NET_HUB && firstfree < NBMAX_NET_HUB) {
2367 #ifdef TRACE_NET_HUB 2368 dbglog(
"HUB: register %x->%s \n", hubst->url, hubst->name);
2388 if (i == NBMAX_NET_HUB) {
2416 if (hubst->writeProtected && hubst->http.s_user && strcmp(hubst->http.s_user,
"admin") == 0) {
2418 const char* request =
"GET /api/module/serial?serial=&. ";
2451 if (
YISERR((res =
yReqOpen(req, 2 *
YIO_DEFAULT_TCP_TIMEOUT, 0, request,
YSTRLEN(request), mstimeout, NULL, NULL, NULL, NULL, errmsg)))) {
2456 memset(&j, 0,
sizeof(j));
2463 res =
yReqRead(req, buffer,
sizeof(buffer));
2465 j.
src = (
char*) buffer;
2466 j.
end = (
char*) buffer + res;
2472 res =
yReqRead(req, buffer,
sizeof(buffer));
2520 }
else if(
YSTRICMP(url,
"net") == 0) {
2525 #ifdef TRACE_NET_HUB 2563 res =
pingURLOnhub(hubst,
"GET /api/module/firmwareRelease.json \r\n\r\n", mstimeout, errmsg);
2696 if (now < timeout) {
2708 static int tickUseHiRes = -1;
2709 static u64 tickOffset = 0;
2710 static LARGE_INTEGER tickFrequency;
2711 static LARGE_INTEGER tickStart;
2718 LARGE_INTEGER performanceCounter;
2720 if(tickUseHiRes < 0){
2721 if (QueryPerformanceFrequency(&tickFrequency)){
2723 tickOffset = (u64)time(NULL) * 1000u;
2724 QueryPerformanceCounter(&tickStart);
2727 tickOffset = (u64)time(NULL) * 1000u - GetTickCount();
2730 if((s64)tickOffset <= 0) tickOffset = 1;
2732 if(tickUseHiRes>0) {
2733 QueryPerformanceCounter(&performanceCounter);
2734 performanceCounter.QuadPart -= tickStart.QuadPart;
2736 res = performanceCounter.QuadPart * 1000 / tickFrequency.QuadPart + tickOffset;
2738 res = GetTickCount() + tickOffset;
2743 gettimeofday(&tim, NULL);
2744 res = (u64)tim.tv_sec * 1000 + (tim.tv_usec / 1000);
2756 LARGE_INTEGER performanceCounter;
2758 if(tickUseHiRes>0) {
2759 QueryPerformanceCounter(&performanceCounter);
2761 performanceCounter.QuadPart = GetTickCount();
2764 MD5AddData(&ctx, (u8 *)&performanceCounter,
sizeof(performanceCounter));
2769 gettimeofday(&tim, NULL);
2784 if(!*name)
return 1;
2785 if(strlen(name) > 19)
return 0;
2786 while((c = *name++) != 0) {
2787 if(c <
'-')
return 0;
2788 if(c >
'-' && c <
'0')
return 0;
2789 if(c >
'9' && c <
'A')
return 0;
2790 if(c >
'Z' && c <
'_')
return 0;
2791 if(c >
'_' && c <
'a')
return 0;
2792 if(c >
'z')
return 0;
2828 if(!strncmp(device_str,
"http://", 7)) {
2830 c = device_str[7+i];
2831 if(!c || c ==
'/')
break;
2848 int maxdev,nbreturned;
2855 if(buffer==NULL && neededsize==NULL){
2867 if(devdescr < 0)
continue;
2871 *buffer++ = devdescr;
2875 if(neededsize) *neededsize =
sizeof(
YAPI_DEVICE) * maxdev;
2891 if(devdesc < 0 || infos == NULL){
2905 memcpy((u8 *)infos->
manufacturer, (u8 *)
"Yoctopuce", 10);
2921 if(rootdevice==NULL && request==NULL && neededsize==NULL) {
2925 if(neededsize) *neededsize += 4;
2944 if (rootdevice==NULL && request==NULL && neededsize==NULL) {
2957 if (request && requestsize > 4) {
2958 YSTRCPY(request, requestsize,
"usb");
2968 int len =
YSPRINTF(request, requestsize,
"%s://%s:%d%s", proto ==
PROTO_WEBSOCKET ?
"ws" :
"http", host, port, buffer);
2969 *neededsize = len + 1;
2971 if (rootdevice &&
YSTRCMP(rootdevice, serial) == 0) {
2986 res =
ypSearch(class_str, function_str);
2997 YAPI_FUNCTION *buffer,
int maxsize,
int *neededsize,
char *errmsg)
3002 if(buffer==NULL && neededsize==NULL){
3006 res =
ypGetFunctions(class_str, -1, prevfundesc, buffer, maxsize, neededsize);
3015 YAPI_FUNCTION *buffer,
int maxsize,
int *neededsize,
char *errmsg)
3020 if(buffer==NULL && neededsize==NULL){
3023 res =
ypGetFunctions(NULL, devdesc, prevfundesc, buffer, maxsize, neededsize);
3036 if(
ypGetFunctionInfo(fundesc, serial, funcId, baseType, funcName, funcVal) < 0) {
3040 *devdesc = fundesc & 0xffff;
3070 if (reqlen >= 10 && reqlen <= (
int)
sizeof(buffer) && !memcmp(request + reqlen - 7,
"&. \r\n\r\n", 7)) {
3071 memcpy(buffer, request, reqlen - 7);
3072 memcpy(buffer + reqlen - 7,
" \r\n\r\n", 5);
3104 if (tcpreq == NULL) {
3124 res = (
YRETCODE)
yReqOpen(tcpreq, wait_for_start, 0, request, reqlen, mstimeout, callback, context, NULL, NULL, errmsg);
3140 static int yapiRequestOpenWS(
YIOHDL_internal *iohdl,
HubSt *hub,
YAPI_DEVICE dev,
int tcpchan,
const char *request,
int reqlen, u64 mstimeout,
yapiRequestAsyncCallback callback,
void *context,
RequestProgress progress_cb,
void *progress_ctx,
char *errmsg)
3178 res = (
YRETCODE)
yReqOpen(req, 2 *
YIO_DEFAULT_TCP_TIMEOUT, tcpchan, request, reqlen, mstimeout, callback, context, progress_cb, progress_ctx, errmsg);
3212 if (memcmp(request,
"GET ", 4) == 0) {
3213 if (
ymemfind((u8*)request + 4, len, (u8*)
"/testcb.txt", 11) >= 0) {
3215 }
else if (
ymemfind((u8*)request + 4, len, (u8*)
"/rxmsg.json", 11) >= 0) {
3217 }
else if (
ymemfind((u8*)request + 4, len, (u8*)
"/files.json", 11) >= 0) {
3219 }
else if (
ymemfind((u8*)request + 4, len, (u8*)
"/flash.json", 11) >= 0) {
3223 if (
ymemfind((u8*)request + 4, len, (u8*)
"/upload.html", 12) >= 0) {
3233 return yapiRequestOpenUSB(iohdl, NULL, dev, request, reqlen, mstimeout, callback, context, errmsg);
3245 return yapiRequestOpenWS(iohdl, hub, dev, tcpchan, request, reqlen, mstimeout, callback, context, progress_cb, progress_ctx, errmsg);
3278 memcpy(newbuff, p->
replybuf, buffpos);
3286 }
else if (res > 0) {
3292 *replysize = buffpos;
3315 *replysize =
yReqGet(tcpreq, (u8**)reply);
3340 *replysize =
yReqGet(tcpreq, (u8**)reply);
3352 #ifdef DEBUG_YAPI_REQ 3353 int req_count = YREQ_LOG_START(
"SyncStartEx", device, request, requestsize);
3365 if (
YISERR(res =
yapiRequestOpen(internalio, tcpchan, device, request, requestsize, NULL, NULL, progress_cb, progress_ctx, errmsg))) {
3381 *iohdl = internalio;
3386 #ifdef DEBUG_YAPI_REQ 3388 YREQ_LOG_APPEND_ERR(req_count,
"SyncStartEx", errmsg, res, start_tm);
3390 YREQ_LOG_APPEND(req_count,
"SyncStartEx", *reply, *replysize, start_tm);
3411 while(r && r != arg) {
3415 if (r ==NULL || r != arg) {
3446 static void asyncDrop(
void *context,
const u8 *result, u32 resultlen,
int retcode,
const char *errmsg)
3448 #ifdef DEBUG_YAPI_REQ 3449 int req_count = (int)(((u8*)context) - ((u8*)NULL));
3450 YREQ_LOG_APPEND(req_count,
"ASync", result, resultlen, 0);
3460 #ifdef DEBUG_YAPI_REQ 3461 int yreq_count = YREQ_LOG_START(
"ASync", device, request, len);
3468 if (callback == NULL) {
3470 #ifdef DEBUG_YAPI_REQ 3471 context = ((u8*)NULL) + yreq_count;
3474 res =
yapiRequestOpen(&iohdl, tcpchan, device, request, len, callback, context, NULL,NULL,errmsg);
3482 dbglog(
"ASync request for %s failed. Retrying after yapiUpdateDeviceList\n",device);
3484 dbglog(
"yapiUpdateDeviceList failled too with %s\n",errmsg);
3502 if(!buffer || buffsize < 4){
3508 *fullsize = replysize;
3510 if(replysize > buffsize-1) {
3511 replysize = buffsize-1;
3513 memcpy(buffer, reply, replysize);
3514 buffer[replysize] = 0;
3547 u32 totalBoot,copyedBoot;
3562 totalBoot=copyedBoot=0;
3564 for(i=0, iface=runifaces ; i < nbifaces ; i++, iface++){
3567 if(serials && copyedBoot < maxNbSerial){
3579 *totalBootladers=totalBoot;
3591 int size, total, len;
3596 if(buffer==NULL || buffersize<1)
3612 for (i = 0, iface = runifaces; i < nbifaces; i++, iface++){
3616 if (buffer && size < buffersize && buffer != p) {
3623 if (buffer && size + len < buffersize){
3648 for (j = 0, serial = bootloaders; j < res; j++, serial +=
YOCTO_SERIAL_LEN){
3649 if (buffer && size < buffersize && buffer != p) {
3656 if (buffer && size + len < buffersize){
3657 YSTRCPY(p, buffersize - size, serial);
3674 #ifndef YAPI_IN_YDEVICE 3685 if(buffer==NULL || buffersize<1)
3697 if (
YSTRCMP(serial, hubserial) == 0) {
3699 int j, nbKnownDevices;
3702 if (buffersize > total) {
3704 for (j = 0; j < nbKnownDevices; j++) {
3719 size = (int) (p - buffer);
3734 #ifdef DEBUG_JSON_PARSE 3739 #ifdef DEBUG_JSON_PARSE 3749 #ifdef DEBUG_JSON_PARSE 3754 #ifdef DEBUG_JSON_PARSE 3766 const char *p = path;
3768 while (*p && *p !=
'|'){
3777 #ifdef DEBUG_JSON_PARSE 3790 const char *start_of_json;
3791 #ifdef DEBUG_JSON_PARSE 3802 *result = (u32)(j->
state_end - start_of_json);
3803 return start_of_json;
3806 *result = (u32)(j->
state_end - start_of_json);
3807 return start_of_json;
3810 *result = (u32)(j->
state_end - start_of_json);
3811 return start_of_json;
3818 #ifdef DEBUG_JSON_PARSE 3824 #ifdef DEBUG_JSON_PARSE 3839 const char *p = path;
3841 int index, count = 0;
3844 while (*p && *p !=
'|'){
3849 memcpy(buffer, path, len);
3851 index = atoi(buffer);
3860 #ifdef DEBUG_JSON_PARSE 3867 if (index == count) {
3870 #ifdef DEBUG_JSON_PARSE 3875 #ifdef DEBUG_JSON_PARSE 3893 int maxsize =
YSTRLEN(json_string);
3895 j.
src = json_string;
3906 return (u32)(p - output);
3912 int yapiJsonGetPath_internal(
const char *path,
const char *json_data,
int json_size,
int withHTTPheader,
const char **output,
char *errmsg)
3918 j.
end = j.
src + json_size;
3919 if (withHTTPheader) {
3954 int nbAttr=0,allocAttr=0;
3984 if (nbAttr == allocAttr) {
3998 YSTRCPY(attrBuff[nbAttr].func, 32, func);
3999 YSTRCPY(attrBuff[nbAttr].attr, 32, attr);
4023 if (nbAttr < 0 && attrBuff) {
4038 const char *sep =
"";
4045 if (buffersize < 16) {
4052 for (j = 0; j < attrs_count; j++) {
4055 len =
YSPRINTF(tmpbuf, 1024,
"%s\"%s/%s=", sep, attrs[j].func, attrs[j].attr);
4062 while (*p && len < 1020) {
4063 if (*p ==
'"' || *p ==
'\\') {
4076 if (buffersize > totalsize+len) {
4077 memcpy(buffer + totalsize, tmpbuf, len);
4082 if (buffersize > totalsize ) {
4083 buffer[totalsize] =
']';
4086 *fullsize = totalsize;
4126 #ifdef YDLL_TRACE_FILE 4132 trcRegisterLogFunction,
4133 trcRegisterDeviceLogCallback,
4134 trcStartStopDeviceLogCallback,
4135 trcRegisterDeviceArrivalCallback,
4136 trcRegisterDeviceRemovalCallback,
4137 trcRegisterDeviceChangeCallback,
4138 trcRegisterFunctionUpdateCallback,
4139 trcRegisterTimedReportCallback,
4140 trcLockFunctionCallBack,
4141 trcUnlockFunctionCallBack,
4142 trcLockDeviceCallBack,
4143 trcUnlockDeviceCallBack,
4148 trcUpdateDeviceList,
4151 trcCheckLogicalName,
4160 trcGetFunctionsByClass,
4161 trcGetFunctionsByDevice,
4163 trcGetFunctionInfoEx,
4164 trcHTTPRequestSyncStartEx,
4165 trcHTTPRequestSyncStart,
4166 trcHTTPRequestSyncStartOutOfBand,
4167 trcHTTPRequestSyncDone,
4168 trcHTTPRequestAsyncEx,
4169 trcHTTPRequestAsync,
4170 trcHTTPRequestAsyncOutOfBand,
4172 trcRegisterHubDiscoveryCallback,
4173 trcTriggerHubDiscovery,
4175 trcJsonDecodeString,
4180 trcUpdateFirmwareEx,
4187 static const char * trc_funname[] =
4197 "RegUpdateCallback",
4202 "UnLockDeviceCback",
4246 static const char *dlltracefile = YDLL_TRACE_FILE;
4248 static void write_line(
const char *ptr,
int len)
4251 if (
YFOPEN(&f,dlltracefile,
"a+") != 0) {
4254 fwrite(ptr,1,len,f);
4259 static u64 trc_basetime = 0;
4261 static void trace_dll(u64 t,
char prefix, TRC_FUN trcfun,
const char *action)
4264 if (trc_basetime == 0) {
4267 int len =
YSPRINTF(buffer, 512,
"%"FMTu64
"%c%s%s\n", (t-trc_basetime), prefix, trc_funname[trcfun], action);
4268 write_line(buffer, len);
4271 #define YDLL_CALL_ENTER(funname) TRC_FUN trcfun = funname;\ 4272 u64 dll_start, dll_stop;\ 4274 dll_start = yapiGetTickCount();\ 4275 trace_dll(dll_start, '>' ,trcfun, ""); 4277 #define YDLL_CALL_LEAVEVOID() dll_stop = yapiGetTickCount();\ 4278 YSPRINTF(dbg_msg, 128, ":%"FMTs64, (dll_stop - dll_start)); \ 4279 trace_dll(dll_start, '<' ,trcfun, dbg_msg); 4281 #define YDLL_CALL_LEAVE(value) dll_stop = yapiGetTickCount();\ 4282 YSPRINTF(dbg_msg, 128, ":%d=%"FMTx64, (dll_stop - dll_start), (int)(value), (u64)(value)); \ 4283 trace_dll(dll_start, '<' ,trcfun, dbg_msg); 4284 #define YDLL_CALL_LEAVEPTR(value) dll_stop = yapiGetTickCount();\ 4285 YSPRINTF(dbg_msg, 128, ":%p", (dll_stop - dll_start), (value)); \ 4286 trace_dll(dll_start, '<' ,trcfun, dbg_msg); 4288 #define YDLL_CALL_ENTER(funname) 4289 #define YDLL_CALL_LEAVEVOID() 4290 #define YDLL_CALL_LEAVE(value) 4291 #define YDLL_CALL_LEAVEPTR(value) 4543 YAPI_FUNCTION *buffer,
int maxsize,
int *neededsize,
char *errmsg)
4553 YAPI_FUNCTION *buffer,
int maxsize,
int *neededsize,
char *errmsg)
4681 #ifndef YAPI_IN_YDEVICE 4700 memcpy(tmp, *result, res);
4772 #if defined(WINDOWS_API) && defined(__32BITS__) && defined(_MSC_VER) 4778 typedef void YAPI_FUNCTION_EXPORT (_stdcall *vb6_yapiHubDiscoveryCallback)(BSTR serial, BSTR url);
4780 typedef void YAPI_FUNCTION_EXPORT (_stdcall *vb6_yapiRequestAsyncCallback)(
void *context,
int retcode, BSTR result, u32 resultlen);
4784 typedef struct vb6_callback {
4785 vb6_yapiRequestAsyncCallback callback;
4787 } vb_callback_cache_entry;
4789 static vb_callback_cache_entry vb_callback_cache[
NB_MAX_DEVICES];
4796 void YAPI_FUNCTION_EXPORT __stdcall vb6_yapiRegisterDeviceLogCallback(vb6_yapiDeviceLogCallback logCallback);
4797 void YAPI_FUNCTION_EXPORT __stdcall vb6_yapiRegisterDeviceArrivalCallback(vb6_yapiDeviceUpdateCallback arrivalCallback);
4798 void YAPI_FUNCTION_EXPORT __stdcall vb6_yapiRegisterDeviceRemovalCallback(vb6_yapiDeviceUpdateCallback removalCallback);
4799 void YAPI_FUNCTION_EXPORT __stdcall vb6_yapiRegisterDeviceChangeCallback(vb6_yapiDeviceUpdateCallback changeCallback);
4800 void YAPI_FUNCTION_EXPORT __stdcall vb6_yapiRegisterFunctionUpdateCallback(vb6_yapiFunctionUpdateCallback updateCallback);
4801 void YAPI_FUNCTION_EXPORT __stdcall vb6_yapiRegisterTimedReportCallback(vb6_yapiTimedReportCallback timedReportCallback);
4825 YRETCODE YAPI_FUNCTION_EXPORT __stdcall vb6_yapiHTTPRequestSyncStartEx(
YIOHDL *iohdl,
const char *device,
const char *request,
int requestsize,
char **reply,
int *replysize,
char *errmsg);
4826 YRETCODE YAPI_FUNCTION_EXPORT __stdcall vb6_yapiHTTPRequestSyncStart(
YIOHDL *iohdl,
const char *device,
const char *request,
char **reply,
int *replysize,
char *errmsg);
4828 YRETCODE YAPI_FUNCTION_EXPORT __stdcall vb6_yapiHTTPRequestAsync(
const char *device,
const char *request, vb6_yapiRequestAsyncCallback callback,
void *context,
char *errmsg);
4829 YRETCODE YAPI_FUNCTION_EXPORT __stdcall vb6_yapiHTTPRequestAsyncEx(
const char *device,
const char *request,
int requestsize, vb6_yapiRequestAsyncCallback callback,
void *context,
char *errmsg);
4830 int YAPI_FUNCTION_EXPORT __stdcall vb6_yapiHTTPRequest(
const char *device,
const char *request,
char* buffer,
int buffsize,
int *fullsize,
char *errmsg);
4831 void YAPI_FUNCTION_EXPORT __stdcall vb6_yapiRegisterHubDiscoveryCallback(vb6_yapiHubDiscoveryCallback hubDiscoveryCallback);
4834 static BSTR vb6_version = NULL;
4835 static BSTR vb6_apidate = NULL;
4838 void YAPI_FUNCTION_EXPORT __stdcall vb6_yapiStartStopDeviceLogCallback(
const char *serial,
int start)
4852 SysFreeString(vb6_version);
4856 SysFreeString(vb6_apidate);
4863 static BSTR newBSTR(
const char * str)
4866 int newlen = MultiByteToWideChar(CP_ACP, 0, str, len, NULL, 0);
4867 BSTR newstring = SysAllocStringLen(0, newlen);
4868 MultiByteToWideChar(CP_ACP, 0, str, len, newstring, newlen);
4873 static vb6_yapiLogFunction vb6_yapiLogFunctionFWD = NULL;
4874 void yapiLogFunctionCdeclToStd(
const char *log, u32 loglen)
4877 if (vb6_yapiLogFunctionFWD) {
4878 BSTR bstrstr = newBSTR(log);
4879 vb6_yapiLogFunctionFWD(bstrstr, loglen);
4880 SysFreeString(bstrstr);
4885 vb6_yapiLogFunctionFWD = logfun;
4894 static vb6_yapiDeviceLogCallback vb6_yapiRegisterDeviceLogCallbackFWD = NULL;
4895 void yapiRegisterDeviceLogCallbackFWD(
YAPI_DEVICE devdescr,
const char *line)
4897 if (vb6_yapiRegisterDeviceLogCallbackFWD) {
4898 BSTR bstrstr = newBSTR(line);
4899 vb6_yapiRegisterDeviceLogCallbackFWD(devdescr, bstrstr);
4900 SysFreeString(bstrstr);
4903 void YAPI_FUNCTION_EXPORT __stdcall vb6_yapiRegisterDeviceLogCallback(vb6_yapiDeviceLogCallback logCallback)
4905 vb6_yapiRegisterDeviceLogCallbackFWD = logCallback;
4913 static vb6_yapiDeviceUpdateCallback vb6_yapiRegisterDeviceArrivalCallbackFWD = NULL;
4914 void yapiRegisterDeviceArrivalCallbackFWD(
YAPI_DEVICE devdescr)
4916 if (vb6_yapiRegisterDeviceArrivalCallbackFWD)
4917 vb6_yapiRegisterDeviceArrivalCallbackFWD(devdescr);
4919 void YAPI_FUNCTION_EXPORT __stdcall vb6_yapiRegisterDeviceArrivalCallback(vb6_yapiDeviceUpdateCallback arrivalCallback)
4921 vb6_yapiRegisterDeviceArrivalCallbackFWD = arrivalCallback;
4922 if (arrivalCallback) {
4929 static vb6_yapiDeviceUpdateCallback vb6_yapiRegisterDeviceRemovalCallbackFWD = NULL;
4930 void yapiRegisterDeviceRemovalCallbackFWD(
YAPI_DEVICE devdescr)
4932 if (vb6_yapiRegisterDeviceRemovalCallbackFWD)
4933 vb6_yapiRegisterDeviceRemovalCallbackFWD(devdescr);
4936 void YAPI_FUNCTION_EXPORT __stdcall vb6_yapiRegisterDeviceRemovalCallback(vb6_yapiDeviceUpdateCallback removalCallback)
4938 vb6_yapiRegisterDeviceRemovalCallbackFWD = removalCallback;
4939 if (removalCallback) {
4946 static vb6_yapiDeviceUpdateCallback vb6_yapiRegisterDeviceChangeCallbackFWD = NULL;
4947 void yapiRegisterDeviceChangeCallbackFWD(
YAPI_DEVICE devdescr)
4949 if (vb6_yapiRegisterDeviceChangeCallbackFWD)
4950 vb6_yapiRegisterDeviceChangeCallbackFWD(devdescr);
4952 void YAPI_FUNCTION_EXPORT __stdcall vb6_yapiRegisterDeviceChangeCallback(vb6_yapiDeviceUpdateCallback changeCallback)
4954 vb6_yapiRegisterDeviceChangeCallbackFWD = changeCallback;
4955 if (changeCallback) {
4962 static vb6_yapiFunctionUpdateCallback vb6_yapiRegisterFunctionUpdateCallbackFWD = NULL;
4963 void yapiRegisterFunctionUpdateCallbackFWD(
YAPI_FUNCTION fundescr,
const char *value)
4965 if (vb6_yapiRegisterFunctionUpdateCallbackFWD && value) {
4966 BSTR bstrstr = newBSTR(value);
4967 vb6_yapiRegisterFunctionUpdateCallbackFWD(fundescr, bstrstr);
4968 SysFreeString(bstrstr);
4971 void YAPI_FUNCTION_EXPORT __stdcall vb6_yapiRegisterFunctionUpdateCallback(vb6_yapiFunctionUpdateCallback updateCallback)
4973 vb6_yapiRegisterFunctionUpdateCallbackFWD = updateCallback;
4974 if (updateCallback) {
4981 static vb6_yapiTimedReportCallback vb6_yapiRegisterTimedReportCallbackFWD = NULL;
4982 void yapiRegisterTimedReportCallbackFWD(
YAPI_FUNCTION fundesc,
double timestamp,
const u8 *bytes, u32 len)
4984 if (vb6_yapiRegisterTimedReportCallbackFWD)
4985 vb6_yapiRegisterTimedReportCallbackFWD(fundesc, timestamp, bytes, len);
4988 void YAPI_FUNCTION_EXPORT __stdcall vb6_yapiRegisterTimedReportCallback(vb6_yapiTimedReportCallback timedReportCallback)
4990 vb6_yapiRegisterTimedReportCallbackFWD = timedReportCallback;
4991 if (timedReportCallback) {
5060 const char * versionA, *apidateA;
5062 *version = newBSTR(versionA);
5063 *apidate = newBSTR(apidateA);
5069 const char * versionA, *apidateA;
5099 return yapiGetDevicePath(devdesc, rootdevice, path, pathsize, neededsize, errmsg);
5122 YRETCODE YAPI_FUNCTION_EXPORT __stdcall vb6_yapiHTTPRequestSyncStartEx(
YIOHDL *iohdl,
const char *device,
const char *request,
int requestsize,
char **reply,
int *replysize,
char *errmsg)
5127 YRETCODE YAPI_FUNCTION_EXPORT __stdcall vb6_yapiHTTPRequestSyncStart(
YIOHDL *iohdl,
const char *device,
const char *request,
char **reply,
int *replysize,
char *errmsg)
5137 YRETCODE YAPI_FUNCTION_EXPORT __stdcall vb6_yapiHTTPRequestAsync(
const char *device,
const char *request, vb6_yapiRequestAsyncCallback callback,
void *context,
char *errmsg)
5139 return vb6_yapiHTTPRequestAsyncEx(device, request,
YSTRLEN(request), callback, context, errmsg);
5142 static void vb6_callback_fwd(
void *context,
const u8 *result, u32 resultlen,
int retcode,
const char *errmsg)
5145 void *vb6_context = vb_callback_cache[devydx].context;
5146 BSTR bstrstr = newBSTR((
char*) result);
5147 vb_callback_cache[devydx].callback(vb6_context, retcode, bstrstr, resultlen);
5148 SysFreeString(bstrstr);
5152 YRETCODE YAPI_FUNCTION_EXPORT __stdcall vb6_yapiHTTPRequestAsyncEx(
const char *device,
const char *request,
int requestsize, vb6_yapiRequestAsyncCallback callback,
void *context,
char *errmsg)
5155 vb_callback_cache[devydx].callback = callback;
5156 vb_callback_cache[devydx].context = context;
5160 int YAPI_FUNCTION_EXPORT __stdcall vb6_yapiHTTPRequest(
const char *device,
const char *request,
char* buffer,
int buffsize,
int *fullsize,
char *errmsg)
5162 return yapiHTTPRequest(device, request, buffer, buffsize, fullsize, errmsg);
5165 static vb6_yapiHubDiscoveryCallback vb6_yapiHubDiscoveryCallbackFWD = NULL;
5166 void yapiHubDiscoverCdeclToStdllbackFWD(
const char *serial,
const char *url)
5168 if (vb6_yapiHubDiscoveryCallbackFWD) {
5169 BSTR bstrserial = newBSTR(serial);
5170 BSTR bstrurl = newBSTR(url);
5171 vb6_yapiHubDiscoveryCallbackFWD(bstrserial, bstrurl);
5172 SysFreeString(bstrurl);
5173 SysFreeString(bstrserial);
5176 void YAPI_FUNCTION_EXPORT __stdcall vb6_yapiRegisterHubDiscoveryCallback(vb6_yapiHubDiscoveryCallback hubDiscoveryCallback)
5178 vb6_yapiHubDiscoveryCallbackFWD = hubDiscoveryCallback;
5179 if (hubDiscoveryCallback){
_FAR const char * state_start
static YRETCODE yapiGetDeviceInfo_internal(YAPI_DEVICE devdesc, yDeviceSt *infos, char *errmsg)
#define yMemset(dst, val, size)
static int yNetHubEnum(HubSt *hub, int forceupdate, char *errmsg)
int yUsbReadBlock(YIOHDL_internal *ioghdl, char *buffer, int len, u64 blockUntil, char *errmsg)
int yUsbOpen(YIOHDL_internal *ioghdl, const char *device, char *errmsg)
yStrRef wpGetAttribute(yBlkHdl hdl, yWPAttribute attridx)
static fullAttrInfo * parseSettings(const char *settings, int *count)
YAPI_FUNCTION YAPI_FUNCTION_EXPORT yapiGetFunction(const char *class_str, const char *function_str, char *errmsg)
static YAPI_DEVICE yapiGetDevice_internal(const char *device_str, char *errmsg)
void yThreadKill(yThread *yth)
#define YDLL_CALL_LEAVEVOID()
int handleNetNotification(HubSt *hub)
HubSt * nethub[NBMAX_NET_HUB]
#define YOCTO_API_VERSION_BCD
static YAPI_FUNCTION yapiGetFunction_internal(const char *class_str, const char *function_str, char *errmsg)
#define NOTIFY_NETPKT_START_LEN
YRETCODE YAPI_FUNCTION_EXPORT yapiGetFunctionInfo(YAPI_FUNCTION fundesc, YAPI_DEVICE *devdesc, char *serial, char *funcId, char *funcName, char *funcVal, char *errmsg)
int decodeNetFuncValV2(const u8 *p, Notification_funydx *funInfo, char *funcVal)
YRETCODE YAPI_FUNCTION_EXPORT yapiTestHub(const char *url, int mstimeout, char *errmsg)
int yUsbEOF(YIOHDL_internal *ioghdl, char *errmsg)
static void yapiRegisterDeviceLogCallback_internal(yapiDeviceLogCallback logCallback)
#define ySafeMemoryStop()
int yWaitForEvent(yEvent *ev, int time)
#define YERRMSG(code, message)
#define YSTRREF_EMPTY_STRING
#define YDLL_CALL_LEAVEPTR(value)
void YAPI_FUNCTION_EXPORT(* yapiDeviceUpdateCallback)(YAPI_DEVICE devdescr)
int ypGetFunctions(const char *class_str, YAPI_DEVICE devdesc, YAPI_FUNCTION prevfundesc, YAPI_FUNCTION *buffer, int maxsize, int *neededsize)
int yHashSameHub(yUrlRef url_a, yUrlRef url_b)
static YRETCODE yapiGetFunctionInfoEx_internal(YAPI_FUNCTION fundesc, YAPI_DEVICE *devdesc, char *serial, char *funcId, char *baseType, char *funcName, char *funcVal, char *errmsg)
void * ws_thread(void *ctx)
static const char * yapiJsonValueParseStruct(yJsonStateMachine *j, const char *path, int *result, char *errmsg)
YIOHDL_internal * yiohdl_first
#define NOTIFY_NETPKT_DEVLOGYDX
void ypUpdateUSB(const char *serial, const char *funcid, const char *funcname, int funclass, int funydx, const char *funcval)
void yReqFree(struct _RequestSt *req)
void yCreateEvent(yEvent *ev)
static int yNetHubEnumEx(HubSt *hub, ENU_CONTEXT *enus, char *errmsg)
static int yapiCheckLogicalName_internal(const char *name)
#define NOTIFY_NETPKT_TIMEAVGYDX
#define NOTIFY_NETPKT_FUNCVAL
static void ypUpdateNet(ENU_CONTEXT *enus)
void yInitializeCriticalSection(yCRITICAL_SECTION *cs)
#define YERRMSGSILENT(code, message)
void yFifoCleanup(yFifoBuf *buf)
int yReqIsAsync(struct _RequestSt *req)
int yReqSelect(struct _RequestSt *tcpreq, u64 ms, char *errmsg)
YRETCODE YAPI_FUNCTION_EXPORT yapiGetBootloaders(char *buffer, int buffersize, int *fullsize, char *errmsg)
static void yapiRegisterDeviceChangeCallback_internal(yapiDeviceUpdateCallback changeCallback)
int ySSDPDiscover(SSDPInfos *SSDP, char *errmsg)
void YAPI_FUNCTION_EXPORT yapiRegisterDeviceLogCallback(yapiDeviceLogCallback logCallback)
#define YOCTO_DEVID_BOOTLOADER
static void yapiRegisterTimedReportCallback_internal(yapiTimedReportCallback timedReportCallback)
static const char * yapiJsonValueParseArray(yJsonStateMachine *j, const char *path, int *result, char *errmsg)
void yUSBReleaseAllDevices(void)
static int wpSafeCheckOverwrite(yUrlRef registeredUrl, HubSt *hub, yUrlRef devUrl)
void yFunctionTimedUpdate(YAPI_FUNCTION fundescr, double deviceTime, const u8 *report, u32 len)
YRETCODE YAPI_FUNCTION_EXPORT yapiGetDevicePath(YAPI_DEVICE devdesc, char *rootdevice, char *request, int requestsize, int *neededsize, char *errmsg)
int yReqGet(struct _RequestSt *req, u8 **buffer)
yCRITICAL_SECTION handleEv_cs
int yStartWakeUpSocket(WakeUpSocket *wuce, char *errmsg)
u16 yPushFifo(yFifoBuf *buf, const u8 *data, u16 datalen)
static int yapiRequestWaitEndWS(YIOHDL_internal *iohdl, char **reply, int *replysize, char *errmsg)
static YRETCODE yapiHandleEvents_internal(char *errmsg)
int yReqRead(struct _RequestSt *req, u8 *buffer, int len)
char advertisedValue[YOCTO_PUBVAL_LEN]
void yHashGetStr(yHash yhash, char *destbuf, u16 bufsize)
u16 yPeekFifo(yFifoBuf *buf, u8 *data, u16 datalen, u16 startofs)
void YAPI_FUNCTION_EXPORT yapiRegisterTimedReportCallback(yapiTimedReportCallback timedReportCallback)
yapiDeviceUpdateCallback arrivalCallback
void yapiRegisterRawReportV2Cb(yRawReportV2Cb callback)
int yUsbClose(YIOHDL_internal *ioghdl, char *errmsg)
#define YAPI_BLOCKING_USBOPEN_REQUEST_TIMEOUT
int ypRegisterByYdx(u8 devYdx, Notification_funydx funInfo, const char *funcVal, YAPI_FUNCTION *fundesc)
#define wpAllowUnregister()
static void unregisterNetDevice(yStrRef serialref)
#define YIO_1_MINUTE_TCP_TIMEOUT
static u16 yapiGetAPIVersion_internal(const char **version, const char **apidate)
#define YSTRCAT(dst, dstsize, src)
int yUsbFree(yContextSt *ctx, char *errmsg)
#define yFifoInit(fifo, buffer, len)
char manufacturer[YOCTO_MANUFACTURER_LEN]
static void yapiRegisterDeviceArrivalCallback_internal(yapiDeviceUpdateCallback arrivalCallback)
static void yapiUnregisterHub_internal(const char *url)
static void yapiRegisterDeviceRemovalCallback_internal(yapiDeviceUpdateCallback removalCallback)
static HubSt * yapiAllocHub(const char *url, char *errmsg)
void(* RequestProgress)(void *context, u32 acked, u32 totalbytes)
void(* yapiRequestProgressCallback)(void *context, u32 acked, u32 totalbytes)
#define YSTRREF_mODULE_STRING
int yThreadCreate(yThread *yth, void *(*fun)(void *), void *arg)
#define NOTIFY_NETPKT_SEP
int YAPI_FUNCTION_EXPORT yapiJsonDecodeString(const char *json_string, char *output)
int yNetHubGetBootloaders(const char *hubserial, char *buffer, char *errmsg)
static YRETCODE yapiHTTPRequestAsyncEx_internal(int tcpchan, const char *device, const char *request, int len, yapiRequestAsyncCallback callback, void *context, char *errmsg)
int yReqMultiSelect(struct _RequestSt **tcpreq, int size, u64 ms, WakeUpSocket *wuce, char *errmsg)
#define YOCTO_FIRMWARE_LEN
yapiFunctionUpdateCallback functionCallback
#define DEVGEN_LOG_ACTIVATED
void devHdlInfo(YUSBDEV hdl, yDeviceSt *infos)
yPrivDeviceSt * findDevFromIOHdl(YIOHDL_internal *hdl)
#define NOTIFY_NETPKT_START
struct _fullAttrInfo fullAttrInfo
u16 yFifoGetUsed(yFifoBuf *buf)
static YRETCODE yapiTriggerHubDiscovery_internal(char *errmsg)
#define NOTIFY_NETPKT_TIMEVALYDX
static void * yhelper_thread(void *ctx)
u32 yapiGetCNonce(u32 nc)
yRawReportV2Cb rawReportV2Cb
int ySetErr(int code, char *outmsg, const char *erreur, const char *file, u32 line)
yJsonRetCode yJsonParse(yJsonStateMachine *j)
int yyyUSBGetInterfaces(yInterfaceSt **ifaces, int *nbifaceDetect, char *errmsg)
yAsbUrlType yHashGetUrlPort(yUrlRef urlref, char *url, u16 *port, yAsbUrlProto *proto, yStrRef *user, yStrRef *password)
static int yEnuJson(ENU_CONTEXT *enus, yJsonStateMachine *j)
int wpGetDevYdx(yStrRef serial)
void yLeaveCriticalSection(yCRITICAL_SECTION *cs)
void YAPI_FUNCTION_EXPORT yapiFreeAPI(void)
yCRITICAL_SECTION functionCallbackCS
YRETCODE YAPI_FUNCTION_EXPORT yapiLockFunctionCallBack(char *errmsg)
YRETCODE yapiRequestOpen(YIOHDL_internal *iohdl, int tcpchan, const char *device, const char *request, int reqlen, yapiRequestAsyncCallback callback, void *context, yapiRequestProgressCallback progress_cb, void *progress_ctx, char *errmsg)
#define NOTIFY_NETPKT_STOP
void wpSafeUnregister(yStrRef serialref)
#define NOTIFY_NETPKT_FLUSHV2YDX
char * yHashGetStrPtr(yHash yhash)
static void yapiRegisterFunctionUpdateCallback_internal(yapiFunctionUpdateCallback updateCallback)
int YAPI_FUNCTION_EXPORT yapiGetAllDevices(YAPI_DEVICE *buffer, int maxsize, int *neededsize, char *errmsg)
int yDringWakeUpSocket(WakeUpSocket *wuce, u8 signal, char *errmsg)
YRETCODE yapiPullDeviceLog(const char *serial)
void yJsonSkip(yJsonStateMachine *j, int nitems)
#define YDLL_CALL_ENTER(funname)
YRETCODE YAPI_FUNCTION_EXPORT yapiHTTPRequestSyncStartEx(YIOHDL *iohdl, const char *device, const char *request, int requestsize, char **reply, int *replysize, char *errmsg)
#define NOTIFY_NETPKT_FUNCNAME
#define YAPI_BLOCKING_USBREAD_REQUEST_TIMEOUT
#define NOTIFY_NETPKT_NOT_SYNC
#define NET_HUB_NOT_CONNECTION_TIMEOUT
yCRITICAL_SECTION deviceCallbackCS
int yReqOpen(struct _RequestSt *req, int wait_for_start, int tcpchan, const char *request, int reqlen, u64 mstimeout, yapiRequestAsyncCallback callback, void *context, RequestProgress progress_cb, void *progress_ctx, char *errmsg)
YRETCODE yapiGetBootloadersDevs(char *serials, unsigned int maxNbSerial, unsigned int *totalBootladers, char *errmsg)
void ySSDPStop(SSDPInfos *SSDP)
int yUsbSetIOAsync(YIOHDL_internal *ioghdl, yapiRequestAsyncCallback callback, void *context, char *errmsg)
void yFreeWakeUpSocket(WakeUpSocket *wuce)
YAPI_DEVICE YAPI_FUNCTION_EXPORT yapiGetDevice(const char *device_str, char *errmsg)
void MD5Calculate(HASH_SUM *ctx, u8 digest[16])
int YAPI_FUNCTION_EXPORT yapiCheckLogicalName(const char *name)
static int yapiGetAllDevices_internal(YAPI_DEVICE *buffer, int maxsize, int *neededsize, char *errmsg)
static void unregisterNetHub(yUrlRef huburl)
int wpGetDeviceUrl(YAPI_DEVICE devdesc, char *roothubserial, char *request, int requestsize, int *neededsize)
static YRETCODE yapiLockDeviceCallBack_internal(char *errmsg)
#define YIO_10_MINUTES_TCP_TIMEOUT
yapiTimedReportCallback timedReportCallback
void YAPI_FUNCTION_EXPORT yapiRegisterLogFunction(yapiLogFunction logfun)
void yThreadRequestEnd(yThread *yth)
#define yApproximateSleep(ms)
int wpGetAllDevUsingHubUrl(yUrlRef hubUrl, yStrRef *buffer, int sizeInStrRef)
YRETCODE YAPI_FUNCTION_EXPORT yapiUpdateFirmware(const char *serial, const char *firmwarePath, const char *settings, int startUpdate, char *msg)
static YRETCODE yapiUnlockFunctionCallBack_internal(char *errmsg)
void freeDevYdxInfos(int devYdx)
struct Notification_funydx::@10 v2
static YRETCODE yapiInitAPI_internal(int detect_type, char *errmsg)
static void ssdpEntryUpdate(const char *serial, const char *urlToRegister, const char *urlToUnregister)
static int yapiRequestWaitEndUSB(YIOHDL_internal *iohdl, char **reply, int *replysize, char *errmsg)
#define YSTRCPY(dst, dstsize, src)
void YAPI_FUNCTION_EXPORT(* yapiTimedReportCallback)(YAPI_FUNCTION fundesc, double timestamp, const u8 *bytes, u32 len)
static YRETCODE yapiGetDevicePathEx_internal(const char *serial, char *rootdevice, char *request, int requestsize, int *neededsize, char *errmsg)
#define NOTIFY_NETPKT_CHILD
#define YOCTO_PUBVAL_SIZE
static void yapiRegisterHubDiscoveryCallback_internal(yapiHubDiscoveryCallback hubDiscoveryCallback)
int YAPI_FUNCTION_EXPORT yapiGetFunctionsByClass(const char *class_str, YAPI_FUNCTION prevfundesc, YAPI_FUNCTION *buffer, int maxsize, int *neededsize, char *errmsg)
static int yapiRequestOpenUSB(YIOHDL_internal *iohdl, HubSt *hub, YAPI_DEVICE dev, const char *request, int reqlen, u64 unused_timeout, yapiRequestAsyncCallback callback, void *context, char *errmsg)
int ySSDPStart(SSDPInfos *SSDP, ssdpHubDiscoveryCallback callback, char *errmsg)
yCRITICAL_SECTION updateDev_cs
void YAPI_FUNCTION_EXPORT yapiRegisterHubDiscoveryCallback(yapiHubDiscoveryCallback hubDiscoveryCallback)
static void initializeAllCS(yContextSt *ctx)
static void yapiSetTraceFile_internal(const char *file)
char logicalname[YOCTO_LOGICAL_LEN]
int YAPI_FUNCTION_EXPORT yapiGetFunctionsByDevice(YAPI_DEVICE devdesc, YAPI_FUNCTION prevfundesc, YAPI_FUNCTION *buffer, int maxsize, int *neededsize, char *errmsg)
YAPI_FUNCTION_EXPORT void yapiFreeMem(void *ptr)
yRawNotificationCb rawNotificationCb
#define ySafeMemoryInit(nbentry)
#define YOCTO_FUNCTION_LEN
void yInitWakeUpSocket(WakeUpSocket *wuce)
static void yapiRegisterLogFunction_internal(yapiLogFunction logfun)
static void logResult(void *context, const u8 *result, u32 resultlen, int retcode, const char *errmsg)
static YRETCODE yapiPreregisterHub_internal(const char *url, char *errmsg)
void YAPI_FUNCTION_EXPORT(* yapiFunctionUpdateCallback)(YAPI_FUNCTION fundescr, const char *value)
#define NOTIFY_NETPKT_FUNCV2YDX
int YAPI_FUNCTION_EXPORT yapiJsonGetPath(const char *path, const char *json_data, int json_size, const char **result, char *errmsg)
static int yapiGetFunctionsByDevice_internal(YAPI_DEVICE devdesc, YAPI_FUNCTION prevfundesc, YAPI_FUNCTION *buffer, int maxsize, int *neededsize, char *errmsg)
YAPI_DEVICE wpSearchByUrl(const char *host, const char *rootUrl)
int yReqHasPending(struct _HubSt *hub)
char firmware[YOCTO_FIRMWARE_LEN]
u8 devYdxMap[ALLOC_YDX_PER_HUB]
YRETCODE YAPI_FUNCTION_EXPORT yapiHTTPRequestAsyncEx(const char *device, const char *request, int len, yapiRequestAsyncCallback callback, void *context, char *errmsg)
YRETCODE YAPI_FUNCTION_EXPORT yapiHTTPRequestSyncDone(YIOHDL *iohdl, char *errmsg)
YRETCODE YAPI_FUNCTION_EXPORT yapiHTTPRequestSyncStartOutOfBand(YIOHDL *iohdl, int channel, const char *device, const char *request, int requestsize, char **reply, int *replysize, yapiRequestProgressCallback progress_cb, void *progress_ctx, char *errmsg)
int yapiJsonGetPath_internal(const char *path, const char *json_data, int json_size, int withHTTPheader, const char **output, char *errmsg)
yHash yHashPutStr(const char *str)
void wpSafeRegister(HubSt *hub, u8 devYdx, yStrRef serialref, yStrRef lnameref, yStrRef productref, u16 deviceid, yUrlRef devUrl, s8 beacon)
void initDevYdxInfos(int devYdx, yStrRef serial)
#define ySafeMemoryDump(discard)
YRETCODE YAPI_FUNCTION_EXPORT yapiGetAllJsonKeys(const char *json_buffer, char *buffer, int buffersize, int *fullsize, char *errmsg)
#define YDLL_CALL_LEAVE(value)
yapiDeviceLogCallback logDeviceCallback
u16 YAPI_FUNCTION_EXPORT yapiGetAPIVersion(const char **version, const char **apidate)
int ypGetFunctionInfo(YAPI_FUNCTION fundesc, char *serial, char *funcId, char *baseType, char *funcName, char *funcVal)
void(* yRawNotificationCb)(USB_Notify_Pkt *)
YAPI_FUNCTION ypSearch(const char *class_str, const char *func_or_name)
static YRETCODE yapiTestHub_internal(const char *url, int mstimeout, char *errmsg)
static void yapiStartStopDeviceLogCallback_internal(const char *serial, int start)
void yFifoEmpty(yFifoBuf *buf)
#define NOTIFY_NETPKT_LOG
YRETCODE YAPI_FUNCTION_EXPORT yapiInitAPI(int detect_type, char *errmsg)
YRETCODE YAPI_FUNCTION_EXPORT yapiGetFunctionInfoEx(YAPI_FUNCTION fundesc, YAPI_DEVICE *devdesc, char *serial, char *funcId, char *baseType, char *funcName, char *funcVal, char *errmsg)
void YAPI_FUNCTION_EXPORT yapiRegisterDeviceChangeCallback(yapiDeviceUpdateCallback changeCallback)
u16 yFifoGetFree(yFifoBuf *buf)
void(* yRawReportV2Cb)(YAPI_DEVICE serialref, USB_Report_Pkt_V2 *report, int pktsize)
int wpMarkForUnregister(yStrRef serial)
void yEnterCriticalSection(yCRITICAL_SECTION *cs)
int yUsbTrafficPending(void)
struct _YIOHDL_internal * next
static YRETCODE yapiLockFunctionCallBack_internal(char *errmsg)
static void skipJsonArray(yJsonStateMachine *j)
char serial[YOCTO_SERIAL_LEN *2]
#define YSTRREF_MODULE_STRING
int yUsbInit(yContextSt *ctx, char *errmsg)
YRETCODE yapiPullDeviceLogEx(int devydx)
static int pingURLOnhub(HubSt *hubst, const char *request, int mstimeout, char *errmsg)
yapiDeviceUpdateCallback changeCallback
#define YAPI_FUNCTION_EXPORT
static void yapiFreeAPI_internal(void)
void(* yapiRequestAsyncCallback)(void *context, const u8 *result, u32 resultlen, int retcode, const char *errmsg)
yBlkHdl yBlkListSeek(yBlkHdl hdl, u16 pos)
void YAPI_FUNCTION_EXPORT yapiStartStopDeviceLogCallback(const char *serial, int start)
YRETCODE YAPI_FUNCTION_EXPORT yapiHTTPRequestAsync(const char *device, const char *request, yapiRequestAsyncCallback callback, void *context, char *errmsg)
void YAPI_FUNCTION_EXPORT yapiSetTraceFile(const char *file)
char errmsg[YOCTO_ERRMSG_LEN]
#define TRACEFILE_NAMELEN
static void skipJsonStruct(yJsonStateMachine *j)
yGenericDeviceSt generic_infos[ALLOC_YDX_PER_HUB]
#define NOTIFY_NETPKT_MAX_LEN
void(* yRawReportCb)(YAPI_DEVICE serialref, USB_Report_Pkt_V1 *report, int pktsize)
void yDeleteCriticalSection(yCRITICAL_SECTION *cs)
void MD5Initialize(HASH_SUM *ctx)
int yTryEnterCriticalSection(yCRITICAL_SECTION *cs)
int yUsbWrite(YIOHDL_internal *ioghdl, const char *buffer, int writelen, char *errmsg)
struct test_compile::@6 bytes
#define NETENUMLOG(fmt, args...)
static YRETCODE yapiUnlockDeviceCallBack_internal(char *errmsg)
YRETCODE yapiCheckFirmware_internal(const char *serial, const char *rev, u32 flags, const char *path, char *buffer, int buffersize, int *fullsize, char *errmsg)
#define NOTIFY_NETPKT_TIMEV2YDX
#define DEVGEN_LOG_PULLING
struct _RequestSt * notReq
static void yapiFreeHub(HubSt *hub)
static YRETCODE yapiGetDevicePath_internal(YAPI_DEVICE devdesc, char *rootdevice, char *request, int requestsize, int *neededsize, char *errmsg)
yCRITICAL_SECTION generic_cs
YAPI_DEVICE wpSearchEx(yStrRef strref)
void yFunctionUpdate(YAPI_FUNCTION fundescr, const char *value)
void YAPI_FUNCTION_EXPORT(* yapiDeviceLogCallback)(YAPI_FUNCTION fundescr, const char *line)
void yReqClose(struct _RequestSt *req)
void wpSafeUpdate(HubSt *hub, u8 devYdx, yStrRef serialref, yStrRef lnameref, yUrlRef devUrl, s8 beacon)
static int yapiJsonDecodeString_internal(const char *json_string, char *output)
YRETCODE YAPI_FUNCTION_EXPORT yapiTriggerHubDiscovery(char *errmsg)
static YRETCODE yapiUpdateDeviceList_internal(u32 forceupdate, char *errmsg)
static int yapiGetSubdevices_internal(const char *serial, char *buffer, int buffersize, int *fullsize, char *errmsg)
void YAPI_FUNCTION_EXPORT(* yapiLogFunction)(const char *log, u32 loglen)
struct _RequestSt * yReqAlloc(struct _HubSt *hub)
RequestSt * tcpreq[ALLOC_YDX_PER_HUB]
u64 YAPI_FUNCTION_EXPORT yapiGetTickCount(void)
YRETCODE YAPI_FUNCTION_EXPORT yapiSleep(int ms_duration, char *errmsg)
YRETCODE YAPI_FUNCTION_EXPORT yapiHTTPRequestSyncStart(YIOHDL *iohdl, const char *device, const char *request, char **reply, int *replysize, char *errmsg)
static int yapiGetFunctionsByClass_internal(const char *class_str, YAPI_FUNCTION prevfundesc, YAPI_FUNCTION *buffer, int maxsize, int *neededsize, char *errmsg)
static YRETCODE yapiGetBootloaders_internal(char *buffer, int buffersize, int *fullsize, char *errmsg)
#define YOCTO_API_BUILD_DATE
void YAPI_FUNCTION_EXPORT yapiRegisterFunctionUpdateCallback(yapiFunctionUpdateCallback updateCallback)
int wpGetDeviceInfo(YAPI_DEVICE devdesc, u16 *deviceid, char *productname, char *serial, char *logicalname, u8 *beacon)
static int yapiRequestOpenHTTP(YIOHDL_internal *iohdl, HubSt *hub, YAPI_DEVICE dev, const char *request, int reqlen, int wait_for_start, u64 mstimeout, yapiRequestAsyncCallback callback, void *context, char *errmsg)
#define NOTIFY_NETPKT_NAME
yCRITICAL_SECTION enum_cs
static int yapiHTTPRequest_internal(const char *device, const char *request, char *buffer, int buffsize, int *fullsize, char *errmsg)
#define YOCTO_HOSTNAME_NAME
#define DEVGEN_LOG_PENDING
void yThreadSignalEnd(yThread *yth)
char serial[YOCTO_SERIAL_LEN]
YRETCODE YAPI_FUNCTION_EXPORT yapiPreregisterHub(const char *url, char *errmsg)
static void deleteAllCS(yContextSt *ctx)
#define wpPreventUnregister()
int ymemfind(const u8 *haystack, u32 haystack_len, const u8 *needle, u32 needle_len)
static void parseNetWpEntry(ENU_CONTEXT *enus)
void yapiRegisterRawReportCb(yRawReportCb callback)
yUrlRef yHashUrlFromRef(yUrlRef urlref, const char *rootUrl)
YRETCODE YAPI_FUNCTION_EXPORT yapiUnlockDeviceCallBack(char *errmsg)
int yTcpInit(char *errmsg)
void YAPI_FUNCTION_EXPORT yapiRegisterDeviceRemovalCallback(yapiDeviceUpdateCallback removalCallback)
yUrlRef yHashUrl(const char *url, const char *rootUrl, u8 testonly, char *errmsg)
YRETCODE yapiHTTPRequestSyncStartEx_internal(YIOHDL *iohdl, int tcpchan, const char *device, const char *request, int requestsize, char **reply, int *replysize, yapiRequestProgressCallback progress_cb, void *progress_ctx, char *errmsg)
void yCloseEvent(yEvent *ev)
YRETCODE YAPI_FUNCTION_EXPORT yapiLockDeviceCallBack(char *errmsg)
void YAPI_FUNCTION_EXPORT yapiUnregisterHub(const char *url)
int ypRegister(yStrRef categ, yStrRef serial, yStrRef funcId, yStrRef funcName, int funClass, int funYdx, const char *funcVal)
#define yMemcpy(dst, src, size)
YAPI_DEVICE wpSearch(const char *device_str)
int yThreadMustEnd(yThread *yth)
#define NOTIFY_NETPKT_FUNCNAMEYDX
void yapiRegisterRawNotificationCb(yRawNotificationCb callback)
YRETCODE YAPI_FUNCTION_EXPORT yapiUnlockFunctionCallBack(char *errmsg)
YRETCODE YAPI_FUNCTION_EXPORT yapiGetSubdevices(const char *serial, char *buffer, int buffersize, int *fullsize, char *errmsg)
static int yTcpTrafficPending(void)
char productname[YOCTO_PRODUCTNAME_LEN]
static YRETCODE yapiRegisterHub_internal(const char *url, char *errmsg)
void YAPI_FUNCTION_EXPORT(* yapiHubDiscoveryCallback)(const char *serial, const char *url)
YRETCODE yUSBUpdateDeviceList(char *errmsg)
static void wpUpdateTCP(HubSt *hub, const char *serial, const char *name, u8 beacon)
#define YSTRNCMP(A, B, len)
int yThreadIsRunning(yThread *yth)
#define ALLOC_YDX_PER_HUB
YRETCODE yapiHTTPRequestSyncDone_internal(YIOHDL *iohdl, char *errmsg)
static int yapiRequestOpenWS(YIOHDL_internal *iohdl, HubSt *hub, YAPI_DEVICE dev, int tcpchan, const char *request, int reqlen, u64 mstimeout, yapiRequestAsyncCallback callback, void *context, RequestProgress progress_cb, void *progress_ctx, char *errmsg)
_FAR const char * state_end
void yThreadSignalStart(yThread *yth)
static YRETCODE yapiGetAllJsonKeys_internal(const char *json_buffer, char *buffer, int buffersize, int *fullsize, char *errmsg)
YRETCODE yapiUpdateFirmware_internal(const char *serial, const char *firmwarePath, const char *settings, int force, int startUpdate, char *msg)
yapiDeviceUpdateCallback removalCallback
#define YOCTO_API_VERSION_STR
yapiHubDiscoveryCallback hubDiscoveryCallback
YRETCODE YAPI_FUNCTION_EXPORT yapiHTTPRequestAsyncOutOfBand(int channel, const char *device, const char *request, int requestsize, yapiRequestAsyncCallback callback, void *context, char *errmsg)
void ypUpdateYdx(int devydx, Notification_funydx funInfo, const char *funcval)
#define YOCTO_AKA_YFUNCTION
void YAPI_FUNCTION_EXPORT yapiRegisterDeviceArrivalCallback(yapiDeviceUpdateCallback arrivalCallback)
#define YSTRNCPY(dst, dstsize, src, len)
u16 ySeekFifo(yFifoBuf *buf, const u8 *pattern, u16 patlen, u16 startofs, u16 searchlen, u8 bTextCompare)
struct _yPrivDeviceSt * next
YRETCODE YAPI_FUNCTION_EXPORT yapiGetDeviceInfo(YAPI_DEVICE devdesc, yDeviceSt *infos, char *errmsg)
u16 yPopFifo(yFifoBuf *buf, u8 *data, u16 datalen)
#define YIO_DEFAULT_TCP_TIMEOUT
int yReqIsEof(struct _RequestSt *req, char *errmsg)
YRETCODE YAPI_FUNCTION_EXPORT yapiUpdateDeviceList(u32 forceupdate, char *errmsg)
static void asyncDrop(void *context, const u8 *result, u32 resultlen, int retcode, const char *errmsg)
int YFOPEN(FILE **f, const char *filename, const char *mode)
YAPI_FUNCTION_EXPORT void * yapiGetMem(int size)
#define NOTIFY_NETPKT_FUNCVALYDX
YRETCODE YAPI_FUNCTION_EXPORT yapiCheckFirmware(const char *serial, const char *rev, const char *path, char *buffer, int buffersize, int *fullsize, char *errmsg)
YUSBDEV findDevHdlFromStr(const char *str)
static YRETCODE yapiSleep_internal(int ms_duration, char *errmsg)
void MD5AddData(HASH_SUM *ctx, const u8 *buf, u32 len)
int wpRegister(int devYdx, yStrRef serial, yStrRef logicalName, yStrRef productName, u16 productId, yUrlRef devUrl, s8 beacon)
static YRETCODE yapiRegisterHubEx(const char *url, int checkacces, char *errmsg)
#define YOCTO_API_BUILD_NO
static int yapiRequestWaitEndHTTP(YIOHDL_internal *iohdl, char **reply, int *replysize, char *errmsg)
int YAPI_FUNCTION_EXPORT yapiHTTPRequest(const char *device, const char *request, char *buffer, int buffsize, int *fullsize, char *errmsg)
yUrlRef wpGetDeviceUrlRef(YAPI_DEVICE devdesc)
YRETCODE YAPI_FUNCTION_EXPORT yapiRegisterHub(const char *url, char *errmsg)
YRETCODE YAPI_FUNCTION_EXPORT yapiHandleEvents(char *errmsg)
YRETCODE YAPI_FUNCTION_EXPORT yapiUpdateFirmwareEx(const char *serial, const char *firmwarePath, const char *settings, int force, int startUpdate, char *msg)
YRETCODE YAPI_FUNCTION_EXPORT yapiGetDevicePathEx(const char *serial, char *rootdevice, char *request, int requestsize, int *neededsize, char *errmsg)