完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
电子发烧友论坛|
大家好,我用POST方法把我的数据从浏览器发送到PICMY问题是我有时看到它不发送一些我的变量。在TCPIP栈帮助中,我读到方法POST没有发送数据的限制,顺便说一下,我的数据不是那么多。我不知道为什么有时他们没有留言。但是如果我把2提交按钮,那么每件事都是OK。但我不想使用2发送钮。我也想找到问题。这是我在CuutHTHTPAP中的读取功能。
以上来自于百度翻译 以下为原文 Hello everyone i am using post method to send my data from browser to pic my problem is that i saw sometimes it does not send some of my variables.in the tcpip stack help i read that with method post there is no limitation of sending data, by the way my data are not so much. i do not know why sometimes some of them is not sent. but if i put 2 submit button then every thing is ok.but i do not want to use 2 send button.also i would like to find the problem. this is my read function in customHTTPapp static HTTP_IO_RESULT HTTPPostCustomFunction(void) { BYTE *ptr; if(curHTTP.byteCount > TCPIsGetReady(sktHTTP) + TCPGetRxFIFOFree(sktHTTP)) return HTTP_IO_NEED_DATA; while(curHTTP.byteCount) { // Read a form field name if(HTTPReadPostName(curHTTP.data, sizeof(curHTTP.data)-2) != HTTP_READ_OK) return HTTP_IO_NEED_DATA; // Read a form field value if(HTTPReadPostValue(curHTTP.data + 6, sizeof(curHTTP.data)-6-2) != HTTP_READ_OK) return HTTP_IO_NEED_DATA; // Parse the value that was read else if(!strcmppgm2ram((char*)curHTTP.data, (ROM char*)"phc")) {// Read new gateway address ptr = curHTTP.data+6; NModBus[41]=atoi((const char *) ptr); TipoFunzione=2; Enphotoch=NModBus[41]; } else if(!strcmppgm2ram((char*)curHTTP.data, (ROM char*)"phs")){ if(curHTTP.data[6]=='0'){ NModBus[41]=0; Enphotoch=NModBus[41]; TipoFunzione=3; } } else if(!strcmppgm2ram((char*)curHTTP.data, (ROM char*)"lin")) {// Read new gateway address ptr = curHTTP.data+6; // NModBus[13]=atoi((const char *) ptr); if(*ptr=='1') NModBus[13] = MOD_LINEARE;//1 } else if(!strcmppgm2ram((char*)curHTTP.data, (ROM char*)"zig")) {// Read new static subnet ptr = curHTTP.data+6; if(*ptr=='0') NModBus[13] = MOD_ZIGZAG;//0 } else if(!strcmppgm2ram((char*)curHTTP.data, (ROM char*)"cst")) {// Read new static subnet ptr = curHTTP.data+6; if(*ptr=='2') NModBus[13] = MOD_CUSTOM;//2 } else if(!strcmppgm2ram((char*)curHTTP.data, (ROM char*)"phw")) {// finestra ptr = curHTTP.data+6; NModBus[18]=atoi((const char *) ptr); } else if(!strcmppgm2ram((char*)curHTTP.data, (ROM char*)"err")) {//MaxErrPhotoch ptr = curHTTP.data+6; NModBus[11]=atoi((const char *) ptr); } else if(!strcmppgm2ram((char*)curHTTP.data, (ROM char*)"rowp"))//rowdist {// distanza_righe_100 ptr = curHTTP.data+6; ConvFloatrighe.ValReal=atol((const char *) ptr); // NModBus[30]=ConvFloatrighe.reals.lowInt; // NModBus[31]=ConvFloatrighe.reals.highInt; // rowdist = (longFloatModbus_100(30)); } else if(!strcmppgm2ram((char*)curHTTP.data, (ROM char*)"rown")) {// rownum ptr = curHTTP.data+6; NModBus[25]=atoi((const char *) ptr); } else if(!strcmppgm2ram((char*)curHTTP.data, (ROM char*)"off1")) {// Gap_iniziale_100 ptr = curHTTP.data+6; ConvFloatgap.ValReal=atol((const char *) ptr);// // NModBus[36]=ConvFloatgap.reals.lowInt; // NModBus[37]=ConvFloatgap.reals.highInt; } else if(!strcmppgm2ram((char*)curHTTP.data, (ROM char*)"offph")) {// offsetphot_100 ptr = curHTTP.data+6; ConvFloatoffset.ValReal=atol((const char *) ptr); // NModBus[32]=ConvFloatoffset.reals.lowInt; // NModBus[33]=ConvFloatoffset.reals.highInt; } else if(!strcmppgm2ram((char*)curHTTP.data, (ROM char*)"grpA")) {// offsetphot_100 ptr = curHTTP.data+6; groupA =atoi((const char *) ptr);//LONG // NModBus[111]=groupA; } else if(!strcmppgm2ram((char*)curHTTP.data, (ROM char*)"grpB")) {// offsetphot_100 ptr = curHTTP.data+6; groupB =atoi((const char *) ptr); // NModBus[112]=groupB; } else if(!strcmppgm2ram((char*)curHTTP.data, (ROM char*)"grpC")) {// offsetphot_100 ptr = curHTTP.data+6; groupC =atoi((const char *) ptr); // NModBus[113]=groupC; } else if(!strcmppgm2ram((char*)curHTTP.data, (ROM char*)"grpD")) {// offsetphot_100 ptr = curHTTP.data+6; groupD =atoi((const char *) ptr); // NModBus[114]=groupD; } else if(!strcmppgm2ram((char*)curHTTP.data, (ROM char*)"grpE")) {// offsetphot_100 ptr = curHTTP.data+6; groupE =atoi((const char *) ptr); // NModBus[115]=groupE; } else if(!strcmppgm2ram((char*)curHTTP.data, (ROM char*)"goff")) {// offsetphot_100 int fortestxx[6]; memcpy(fortestx,fortestxx,12); ptr = curHTTP.data+6; fortest=atoi((const char *) ptr); fortestx[fortest]=fortest; outout_con_offset[0]=setoffsets(fortest); // NModBus[151]=setoffsets(fortest); } else if(!strcmppgm2ram((char*)curHTTP.data, (ROM char*)"goff1")) {// offsetphot_100 int fortestxx[6]; memcpy(fortestx+6,fortestxx,10); ptr = curHTTP.data+6; fortest=atoi((const char *) ptr); fortestx[fortest]=fortest; outout_con_offset[1]=setoffsets(fortest); // NModBus[152]=setoffsets(fortest); } else if(!strcmppgm2ram((char*)curHTTP.data, (ROM char*)"goff2")) {// offsetphot_100 int fortestxx[6]; memcpy(fortestx+11,fortestxx,10); ptr = curHTTP.data+6; fortest=atoi((const char *) ptr); fortestx[fortest]=fortest; outout_con_offset[2]=setoffsets(fortest); // NModBus[153]=setoffsets(fortest); } else if(!strcmppgm2ram((char*)curHTTP.data, (ROM char*)"goff3")) {// offsetphot_100 int fortestxx[6]; memcpy(fortestx+16,fortestxx,10); ptr = curHTTP.data+6; fortest=atoi((const char *) ptr); fortestx[fortest]=fortest; outout_con_offset[3]=setoffsets(fortest); // NModBus[154]=setoffsets(fortest); } else if(!strcmppgm2ram((char*)curHTTP.data, (ROM char*)"goff4")) {// offsetphot_100 int fortestxx[6]; memcpy(fortestx+21,fortestxx,10); ptr = curHTTP.data+6; fortest=atoi((const char *) ptr); fortestx[fortest]=fortest; outout_con_offset[4]=setoffsets(fortest); // NModBus[155]=setoffsets(fortest); } else if(!strcmppgm2ram((char*)curHTTP.data, (ROM char*)"goff5")) {// offsetphot_100 int fortestxx[6]; memcpy(fortestx+26,fortestxx,10); ptr = curHTTP.data+6; fortest=atoi((const char *) ptr); fortestx[fortest]=fortest; outout_con_offset[5]=setoffsets(fortest); // NModBus[156]=setoffsets(fortest); } else if(!strcmppgm2ram((char*)curHTTP.data, (ROM char*)"goff6")) {// offsetphot_100 int fortestxx[6]; memcpy(fortestx+31,fortestxx,10); ptr = curHTTP.data+6; fortest=atoi((const char *) ptr); fortestx[fortest]=fortest; outout_con_offset[6]=setoffsets(fortest); // NModBus[157]=setoffsets(fortest); } else if(!strcmppgm2ram((char*)curHTTP.data, (ROM char*)"goff7")) {// offsetphot_100 int fortestxx[6]; memcpy(fortestx+36,fortestxx,10); ptr = curHTTP.data+6; fortest=atoi((const char *) ptr); fortestx[fortest]=fortest; outout_con_offset[7]=setoffsets(fortest); // NModBus[158]=setoffsets(fortest); } //******************************** else if(!strcmppgm2ram((char*)curHTTP.data, (ROM char*)"grp8")) {// offsetphot_100 int fortestxx[6]; memcpy(fortestx+41,fortestxx,10); ptr = curHTTP.data+6; fortest=atoi((const char *) ptr); fortestx[fortest]=fortest; outout_con_offset[8]=setoffsets(fortest); // NModBus[159]=setoffsets(fortest); } else if(!strcmppgm2ram((char*)curHTTP.data, (ROM char*)"grp9")) {// offsetphot_100 int fortestxx[6]; memcpy(fortestx+46,fortestxx,10); ptr = curHTTP.data+6; fortest=atoi((const char *) ptr); fortestx[fortest]=fortest; outout_con_offset[9]=setoffsets(fortest); // NModBus[160]=setoffsets(fortest); } else if(!strcmppgm2ram((char*)curHTTP.data, (ROM char*)"grp10")) {// offsetphot_100 int fortestxx[6]; memcpy(fortestx+51,fortestxx,10); ptr = curHTTP.data+6; fortest=atoi((const char *) ptr); fortestx[fortest]=fortest; outout_con_offset[10]=setoffsets(fortest); // NModBus[161]=setoffsets(fortest); } else if(!strcmppgm2ram((char*)curHTTP.data, (ROM char*)"grp11")) {// offsetphot_100 int fortestxx[6]; memcpy(fortestx+56,fortestxx,10); ptr = curHTTP.data+6; fortest=atoi((const char *) ptr); fortestx[fortest]=fortest; outout_con_offset[11]=setoffsets(fortest); // NModBus[162]=setoffsets(fortest); } else if(!strcmppgm2ram((char*)curHTTP.data, (ROM char*)"grp12")) {// offsetphot_100 int fortestxx[6]; memcpy(fortestx+61,fortestxx,10); ptr = curHTTP.data+6; fortest=atoi((const char *) ptr); fortestx[fortest]=fortest; outout_con_offset[12]=setoffsets(fortest); // NModBus[163]=setoffsets(fortest); } else if(!strcmppgm2ram((char*)curHTTP.data, (ROM char*)"grp13")) {// offsetphot_100 int fortestxx[6]; memcpy(fortestx+66,fortestxx,10); ptr = curHTTP.data+6; fortest=atoi((const char *) ptr); fortestx[fortest]=fortest; outout_con_offset[13]=setoffsets(fortest); // NModBus[164]=setoffsets(fortest); } else if(!strcmppgm2ram((char*)curHTTP.data, (ROM char*)"grp14")) {// offsetphot_100 int fortestxx[6]; memcpy(fortestx+71,fortestxx,10); ptr = curHTTP.data+6; fortest=atoi((const char *) ptr); fortestx[fortest]=fortest; outout_con_offset[14]=setoffsets(fortest); // NModBus[165]=setoffsets(fortest); } else if(!strcmppgm2ram((char*)curHTTP.data, (ROM char*)"grp15")) {// offsetphot_100 int fortestxx[6]; memcpy(fortestx+76,fortestxx,10); ptr = curHTTP.data+6; fortest=atoi((const char *) ptr); fortestx[fortest]=fortest; outout_con_offset[15]=setoffsets(fortest); // NModBus[166]=setoffsets(fortest); } //******************************************** else if(!strcmppgm2ram((char*)curHTTP.data, (ROM char*)"pass")) {// module lenght ptr = curHTTP.data+6; ConvFloatPasso.ValReal=atol((const char *) ptr); // NModBus[34]=ConvFloatPasso.reals.lowInt; // NModBus[35]=ConvFloatPasso.reals.highInt; } else if(!strcmppgm2ram((char*)curHTTP.data, (ROM char*)"dst1")) {// Read new gateway address ptr = curHTTP.data+6; SetDistOutTmp[0]=atoi((const char *) ptr); } else if(!strcmppgm2ram((char*)curHTTP.data, (ROM char*)"dst2")) {// Read new static subnet ptr = curHTTP.data+6; SetDistOutTmp[1]=atoi((const char *) ptr); } else if(!strcmppgm2ram((char*)curHTTP.data, (ROM char*)"dst3")) {// Read new primary DNS server ptr = curHTTP.data+6; SetDistOutTmp[2]=atoi((const char *) ptr); } else if(!strcmppgm2ram((char*)curHTTP.data, (ROM char*)"dst4")) {// Read new secondary DNS server ptr = curHTTP.data+6; SetDistOutTmp[3]=atoi((const char *) ptr); } else if(!strcmppgm2ram((char*)curHTTP.data, (ROM char*)"dst5")) {// Read new secondary DNS server ptr = curHTTP.data+6; SetDistOutTmp[4]=atoi((const char *) ptr); } else if(!strcmppgm2ram((char*)curHTTP.data, (ROM char*)"dst6")) {// Read new secondary DNS server ptr = curHTTP.data+6; SetDistOutTmp[5]=atoi((const char *) ptr); // NModBus[506]=SetDistOut[5]; } else if(!strcmppgm2ram((char*)curHTTP.data, (ROM char*)"dst7")) {// Read new secondary DNS server ptr = curHTTP.data+6; SetDistOutTmp[6]=atoi((const char *) ptr); } else if(!strcmppgm2ram((char*)curHTTP.data, (ROM char*)"dst8")) {// Read new secondary DNS server ptr = curHTTP.data+6; SetDistOutTmp[7]=atoi((const char *) ptr); } else if(!strcmppgm2ram((char*)curHTTP.data, (ROM char*)"dst9")) {// Read new secondary DNS server ptr = curHTTP.data+6; SetDistOutTmp[8]=atoi((const char *) ptr); } else if(!strcmppgm2ram((char*)curHTTP.data, (ROM char*)"dst10")) {// Read new secondary DNS server ptr = curHTTP.data+6; SetDistOutTmp[9]=atoi((const char *) ptr); } else if(!strcmppgm2ram((char*)curHTTP.data, (ROM char*)"dst11")) {// Read new secondary DNS server ptr = curHTTP.data+6; SetDistOutTmp[10]=atoi((const char *) ptr); } else if(!strcmppgm2ram((char*)curHTTP.data, (ROM char*)"dst12")) {// Read new secondary DNS server ptr = curHTTP.data+6; SetDistOutTmp[11]=atoi((const char *) ptr); } else if(!strcmppgm2ram((char*)curHTTP.data, (ROM char*)"dst13")) {// Read new secondary DNS server ptr = curHTTP.data+6; SetDistOutTmp[12]=atoi((const char *) ptr); } else if(!strcmppgm2ram((char*)curHTTP.data, (ROM char*)"dst14")) {// Read new secondary DNS server ptr = curHTTP.data+6; SetDistOutTmp[13]=atoi((const char *) ptr); } else if(!strcmppgm2ram((char*)curHTTP.data, (ROM char*)"dst15")) {// Read new secondary DNS server ptr = curHTTP.data+6; SetDistOutTmp[14]=atoi((const char *) ptr); } else if(!strcmppgm2ram((char*)curHTTP.data, (ROM char*)"dst16")) {// Read new secondary DNS server ptr = curHTTP.data+6; SetDistOutTmp[15]=atoi((const char *) ptr); } } writeEEpCstomMode(); // here i will save my data to external memory strcpypgm2ram((char*)curHTTP.data, "/custom.htm"); curHTTP.httpStatus = HTTP_REDIRECT; return HTTP_IO_WAITING; } |
|
相关推荐
3个回答
|
|
|
这个问题有可能与“返回HTTPIIOIOWITION”有关吗?我应该改为“返回HTTPIOIORY”吗?
以上来自于百度翻译 以下为原文 is it possible that the problem relates to "return HTTP_IO_WAITTING " ? should i put "return HTTP_IO_Done " instead? |
|
|
|
|
|
|
|
|
|
|
|
我不知道你正在使用的旧书架。但是HTTP模块的和谐性有很多相似之处。从那一个我知道以下:调用回调,你只有那么多的数据可用,这是已经接收到的。如果需要更多的数据,你可以返回HTTpIOIORIONDIAL数据。然后,一旦新的数据部分到达,您的回调将再次被调用。如果您完全接收到数据,则返回HTTpIOION-DIN,独立于您是否已接收到所有数据,或者只返回其中的一部分。如果需要等待其他内容,则返回HTTpIOIOL等待。例如一些硬件响应或其他)。然后,调用堆栈将再次调用,下一次堆栈正在运行。如果您的请求没有任何进展,堆栈可能只是扼杀它。然后是当前连接的字节计数,它告诉您需要读取多少东西。如果是0,你应该发送HtppIIO-Endobe,因为你已经阅读了所有的内容。通过减少它,你告诉你已经读到了那个位置的消息。我认为它允许栈释放读取部分。这使您可以选择如何实现解析。一种方法是在接收到完整消息之前什么也不做。你总是检查有多少数据是可用的,如果不是整个消息,那么你可以简单地通过发送HtpPiIOIONIORDATA数据请求其余的数据。当一切都在那里,然后在一个过程中处理一切。优点是:这简化了对消息的大量阅读。缺点:你的消息永远不会比你的缓冲区大,否则你将无法接收它们。另一种方法是,尝试只读取下一个名称或值或名称和值对。有帮助功能。如果你得到了你想要的,那么你必须立即处理它,或者用更紧凑(二进制)的形式将它存储在某处(例如,连接用户数据缓冲区),直到收到整个消息。如果使用尊敬函数来获取名称和/或值,则这已经修改了字节计数。因此,在这些下一次回调期间,您所读取的这些功能将消失。在一个回调调用中尽可能多地阅读。然后,你总是用HTTpIOIORIGO数据进行回答,直到收到所有内容(字节计数=0),这是用HtppIOIONDON进行回答时的优势。优点:你能够处理消息,这是难以置信的大。缺点:在消息中阅读更复杂。如果不能在阅读时直接应用它,则必须将所有内容存储在连接用户数据缓冲区中,直到收到所有内容为止。例如,您可以将连接数据缓冲指针转换为结构类型,它适合所有参数的需要。但是,即使你需要这样做,你仍然可以接收更大的消息,因为二进制形式比文本更紧凑。我相信你的实现是在尝试第一种方法。因此,是的,在最后返回HtppIIO-WaITIN是错误的,因为它应该是HTTPIOI完成的。但是您可能也有这样一种情况,即您的缓冲区太小,不能接收整个消息。我不知道在你的情况下这是否可能是真的。但是如果这是真的,那么在不增加缓冲区的情况下,您的方法将无法工作。如果你不能做到这一点,你必须使用另一种方法。我不知道旧堆栈的文档,但是如果它不是那么好,那么也许阅读和声帮助可能仍然有用。关于表单处理的介绍,以及TCPIPPHTTPYPOSTExcel有一定的信息。
以上来自于百度翻译 以下为原文 I don't know the old stack, which you are using. But the http modules in Harmony have a lot of similarities. From that one I know the following: Your callback is called and you only have that much data available, which was already received. You return HTTP_IO_NEED_DATA, if you need more data available. Then your callback will be called again as soon as new part of data has arrived. You return HTTP_IO_DONE, if you are completely finished with receiving the data, independent of whether you have received it all, or only a part of it. You return HTTP_IO_WAITING, if you need to wait for something else (e.g. some hardware response or whatever). Then your callback will be called again, the next time when the stack is operating. If your request doesn't make any progress, the stack might simply kill it. Then there is the byte count for the current connection, which tells you how much more stuff you will need to read. If it is 0 you should send HTTP_IO_DONE, because you have read everything. By reducing it, you are telling that you have read the message until that position. I think it allows the stack to free the read part. This leaves you with options how to implement the parsing. One way is to do nothing until the complete message is received. You always check how much data is available, and if it is not the whole message, then you simple ask for the rest by sending HTTP_IO_NEED_DATA. When everything is there, then process everything in one pass. And then answer with HTTP_IO_DONE. Advantages: This simplifies reading the message a lot. Disadvantages: Your messages shall never be bigger than your buffers, or you will be unable to receive them. The other way is, try reading only the next name or value or pair of name and value. There are help functions for that. If you get what you have asked for, then you either have to immediately process it or you store it somewhere (e.g. the Connection User Data Buffer) in more compact (binary) form, until the whole message was received. If you use the respecting functions for getting name and/or value, this already modifies your byte count. Therefore, what you did read successfully whit these functions, will be gone during the next callback. Read as much as possible within one callback call. Then you always answer with HTTP_IO_NEED_DATA until you have received everything (by byte count==0), and this is when you answer with HTTP_IO_DONE. Advantages: You are able to process messages, which are incredibly large. Disadvantages: Reading in messages is more complicated. If you can't directly apply it while reading, you have to store everything in a connection user data buffer until you have received everything. For example you can cast the connection data buffer pointer into a struct type, which fits your needs for all parameters. But even when you need to do that you are still able to receive bigger messages, because the binary form is more compact than the text. I believe your implementation is trying to do the first approach. Therefore, yes returning HTTP_IO_WAITING at the end is wrong, as it should be HTTP_IO_DONE. But you might also have a situation where your buffer is too small to receive the message as a whole. I don't know if this could be true in your case. But if this is true, then your approach will not work without increasing buffers. If you can't do that, you have to use the other approach. I don't know the documentation of the old stack, but if it is not that good, then maybe reading the Harmony Help might still help. The introduction about Form Processing, and TCPIP_HTTP_PostExecute has some information. |
|
|
|
|
只有小组成员才能发言,加入小组>>
MPLAB X IDE V6.25版本怎么对bootloader和应用程序进行烧录
475 浏览 0 评论
5795 浏览 9 评论
2334 浏览 8 评论
2224 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3530 浏览 3 评论
1126浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
1098浏览 1评论
我是Microchip 的代理商,有PIC16F1829T-I/SS 技术问题可以咨询我,微信:A-chip-Ti
873浏览 1评论
MPLAB X IDE V6.25版本怎么对bootloader和应用程序进行烧录
475浏览 0评论
/9
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2025-12-3 12:59 , Processed in 0.645161 second(s), Total 76, Slave 59 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191

淘帖
2025