- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Is it possible to receive HTTP / POST communication in AP mode as in the sample program below?
please tell me.
◆example
static wiced_result_t WiFi_ap_http_receive_callback ( wiced_http_response_stream_t* stream, uint8_t** data, uint16_t* data_length )
{
・・・
}
void test()
{
wiced_result = wiced_network_up(WICED_AP_INTERFACE, WICED_USE_INTERNAL_DHCP_SERVER, &s_ap_ip_settings);
if (WICED_SUCCESS != wiced_result) {
・・・
}
wiced_result = wiced_http_server_start(&s_ap_http_server, 80, max_sockets, ap_web_pages, WICED_AP_INTERFACE, DEFAULT_URL_PROCESSOR_STACK_SIZE);
if (WICED_SUCCESS != wiced_result) {
・・・
}
wiced_result = wiced_http_server_register_callbacks(&s_ap_http_server, WiFi_ap_http_receive_callback, NULL);
if(WICED_SUCCESS != wiced_result) {
・・・
}
・・・
}
<Japanese>
HTTP APモードにおける、POST通信の受信について
以下のサンプルプログラムのように、APモードで、HTTP・POST通信の受信は可能でしょうか。
教えてください。
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Usually, POST method is used to send data to the server. HTTP server for AP mode is not that difficult. Attached is a modified version of snip.http_server_sent_events but the example does not have POST method because it's usually the other way around.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have not tested this. But if the http client is connected to the same AP, I don't see the reason you won't receive the http events.
Maybe you can refer to CypressAcademy_WW101_Files/05_httpbin_post.c at master · cypresssemiconductorco/CypressAcademy_WW101... (a STA implementation) and http_server_snip_events inside snip folder to create your own application in AP mode. I am assuming all these are in the context of a local network.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It looks like the sample POST communication of HTTP client.
Thank you for the information, though it is not a sample HTTP server for AP mode.
POST communication of HTTP server in AP mode seems difficult.
<Japanese>
HTTP クライアントのPOST通信サンプルのようです。
APモードにHTTPサーバのサンプルではないですが、情報ありがとうございました。
APモードのHTTPサーバのPOST通信は、難しいようです。
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you very much.
I would like to know how to receive the HTTP data POSTed from the client with the callback function (WiFi_ap_http_receive_callback). Please let me know if you understand.
<Japanese>
ありがとうございます。
クライアントからPOSTされたHTTPデータを、コールバック関数(WiFi_ap_http_receive_callback)で受信する方法を知りたいのですが、わかりましたら教えてください。
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If you don't have it, please answer without it.
<Japanese>
無ければ、無いで回答をお願いします。
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am not sure if I understand your requirement correctly. Kindly correct me if I am wrong.
- WICED device is configured as a softAP and http_server is hosted over softAP interface
- A http client like google chrome sends a PUT request
- WICED device, working as a http server receives the request and parses the request and dumps the payload on serial terminal or send some other event as a response to client.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you very much.
I think that data is set in the message body for both POST and PUT, but I can receive the data.
Can the received data be received with "uint8_t ** data"?
◆ Example
static wiced_result_t WiFi_ap_http_rcv_callback (wiced_http_response_stream_t * stream, uint8_t ** data, uint16_t * data_length)
<Japanese>
ありがとうございます。
POSTもPUTも、メッセージボディにデータが設定されると思いますが、データは受信できるのですね。
受信データは、「uint8_t** data」で受信できますか。
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am not sure if we understand each other correctly. It would be helpful if you can clearly define the requirement in steps as I have mentioned before.
WiFi_ap_http_rcv_callback is something that you might have written or used from somewhere. I have no insight in what it does. I can only speak about the WICED Studio http_server_sent_events example which uses the SSE and wiced_http_response_stream_t in that example. You can notice the implementation of send_event if that helps. Essentially wiced_http_response_stream_t encompasses wiced_tcp_stream_t data structure where the payload can be found in tx_packet_data ptr and if I am to guess by the way your api is constructed it might be fetching tx_packet_data and put into data (data type matching is the basis of my assumption)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
From the sample (http_server_sent_events.c.zip), it seems possible to receive by "wiced_http_response_stream_t".
I wasn't looking at the samples properly.
Thank you very much.
<Japanese>
サンプル(http_server_sent_events.c.zip)から、「wiced_http_response_stream_t」による受信でできそうです。
サンプルをきちんと見ていませんでした。
ありがとうございました。