-
-
Notifications
You must be signed in to change notification settings - Fork 87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sending data over TCP/UDP in transparent mode #32
Comments
Hello. your welcome. I always add a function when I need it. if you add early than me, send to me please . |
Yes, I tried, but doesn't work properly. int8_t atc_data_send(atc_t *atc, uint8_t data, uint16_t len, uint32_t timeout_ms, char answer, uint16_t answer_size, Would you check this function? |
@LinBencheng in the transparent mode you are able to send only raw binary data. This data will be sent directly to the TCP server. SIM800 doesn't process your data in the transparent mode and doesn't send any response to the data you have sent, it will send you only raw data from TCP server if received. Pseudocode:
|
Thank you very much. |
It seems ok. but i can not test this function. i don't have a board and free time to test it. please debug it to find the problem. thanks
On Thursday, July 1, 2021, 07:24:23 PM GMT+4:30, LinBencheng ***@***.***> wrote:
Yes, I tried, but doesn't work properly.
To send the binary data, I needed to add new function that can send binary data.
In the atc_command function, you used strlen() function to get length of data.
But in binary data, can't use strlen() function. So I modified the atc_command() function like this.
But still don't work properly
int8_t atc_data_send(atc_t *atc, uint8_t data, uint16_t len, uint32_t timeout_ms, char answer, uint16_t answer_size,
int items, ...)
{
if (atc->inited == false)
return -1;
if (atc_lock(atc, timeout_ms) == false)
return -1;
if (answer != NULL)
memset(answer, 0, answer_size);
uint8_t foundIndex = 0;
va_list tag;
va_start(tag, items);
for (uint8_t i = 0; i < items; i++)
{
char str = va_arg(tag, char);
atc->searchCmd[i] = (char) atc_alloc(strlen(str) + 1);
if (atc->searchCmd[i] != NULL)
{
strcpy(atc->searchCmd[i], str);
atc->searchCmd[i][strlen(str)] = 0;
}
if (items >= _ATC_SEARCH_CMD_MAX)
break;
}
va_end(tag);
atc_transmit(atc, data, len);
uint32_t start = HAL_GetTick();
while (HAL_GetTick() - start < timeout_ms)
{
atc_delay(1);
if (atc_available(atc))
{
atc_printf("[%s] %s", atc->name, (char )atc->rxBuffer);
atc_search(atc);
char *found = atc_searchAnswer(atc, items, &foundIndex);
if (found != NULL && answer != NULL)
strncpy(answer, found, answer_size);
atc_empty(atc);
if (found != NULL)
break;
}
}
for (uint8_t i = 0; i < items; i++)
atc_free(atc->searchCmd[i]);
atc_unlock(atc);
return foundIndex;
}
Would you check this function?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
This library is very wonderful, thanks
I’m trying to send binary data over TCP to a server using SIM800. I need to send binary data, without coding, non-ASCII characters indeed. Some of the data bytes can be 0x1A which coincides with the send command, doing that all data were transmitted early. Using AT+CIPSEND=< length > solves the problem because data are transmitted when the content of the buffer reaches that quantity. But this latest version, TCP-related functions removed and never touched about this.
Could you add TCP functions?
The text was updated successfully, but these errors were encountered: