This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[参考译文] CCS/F28M35H52C:将阵列从网站发送到 Web 服务器

Guru**** 2586125 points


请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/674394/ccs-f28m35h52c-send-array-from-web-site-to-web-server

器件型号:F28M35H52C

工具/软件:Code Composer Studio

您好!

我正在开发 一个与 Concerto 板合作的网页、其中我需要对两个数据进行交换。 我可以一次将一个参数从网站发送到 Cortex M3 (服务器)、而不会出现任何问题、但我需要一次发送大量参数。

我的问题是: 您知道如何将参数数组传递给服务器吗?

下面显示了用于发送我已实现的参数的代码。

CCS 代码。

//
struct fs_file *
fs_open (char * pcName)

const struct fsdata_file * ptTree;
struct fs_file * ptFile = NULL;
//sprintf (name);
//
//为文件系统结构分配内存。
//
ptFile = mem_malloc (sizeof (struct fs_file));
if (NULL == ptFile)

返回(空);

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////// Valores 的 Obtencion //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


if (strncmp (pcName、"/cgi-bin/sendSnom、17)=0){

Set_Snom (((char*) pcName + 17);
//返回(NULL);
UARTprintf (pcName);

///---------------- Envio de Datos //

if (strncmp(pcName,"/cgi-bin/getData?id,7)=0){

静态 char pcBuf[6];

get_snom (pcBuf);

ptFile->data = pcBuf;
ptFile->len = strlen (pcBuf);
ptFile->index = ptFile->len;
ptFile->pextension = NULL;
return (ptFile);


//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

------------------------------------------------------------------

JavaScript 代码   

//函数仅发送一个参数

函数 enviar_Datos(){

var req = false;
VAR 标称= document.getElementById ("Snom");

if (window.XMLHttpRequest)

REQ =新的 XMLHttpRequest();

否则 if (window.ActiveXObject)

REQ =新的 ActiveXObject ("Microsoft.XMLHTTP");

if (req)

REQ.open ("get"、"/cgi-bin/sendSnom +标称值+"id"+ MATH_random()、true);
req.send(null);
get_datos();

函数 get_datos(){

VAR Snom1 = false;

函数就绪()

if (Snom1.readyState == 4)

if (Snom1.status = 200)

document.getElementById ("valor_U").innerHTML ="

"+"U ="+ Snom1.responseText +"
";


if (window.XMLHttpRequest)

Snom1 =新的 XMLHttpRequest();

否则 if (window.ActiveXObject)

Snom1 = new ActiveXObject ("Microsoft.XMLHTTP");

if (Snom1)

Snom1.open ("get"、"/cgi-bin/getData?id=+ Math.random ()、true);
Snom1.onreadystatechange =就绪;
Snom1.send(null);


此致

Marcelo

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    尊敬的 Marcelo:

    我不是此 Web Technologies 的专家、但我想知道如何定义一种组合多个参数并一次性发送的自定义类型、并相应地在 C 代码中对其进行反汇编。 您是否尝试过类似的操作?

    此致、
    Sudharsanan
  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    尊敬的 Marcelo:

    您能否继续进行此操作或卡在其他位置? 您仍在寻找一些帮助吗?

    此致、
    Sudharsanan
  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好 Sudharsanan、

    我可以解决这个问题。

    非常感谢您的帮助。

    Kínd 此致