+ipd

fritch
Posts: 14
Joined: Tue Dec 05, 2017 2:02 pm

+ipd

Postby fritch » Tue Dec 05, 2017 2:05 pm

hello , i like to know in which file of source-files are called the +ipd for incoming received packet ?
i do i search but cant find it.

User avatar
rudi ;-)
Posts: 1727
Joined: Fri Nov 13, 2015 3:25 pm

Re: +ipd

Postby rudi ;-) » Thu Dec 07, 2017 1:15 pm

fritch wrote:hello , i like to know in which file of source-files are called the +ipd for incoming received packet ?
i do i search but cant find it.
hi,
short, you run with this in 2 problems:
a) comes from a lib
b) can not expand

longer:
+ipd is from AT LIB
and no, we have -incomprehensibly- no * CB for this. :(

edit:
if this helps: like #xcguang said, you could parse "+IPD" in at_port_write_data

best wishes
rudi ;-)

( * i am sure, you do not want hear this )
-------------------------------------
love it, change it or leave it.
-------------------------------------
問候飛出去的朋友遍全球魯迪

fritch
Posts: 14
Joined: Tue Dec 05, 2017 2:02 pm

Re: +ipd

Postby fritch » Thu Dec 07, 2017 2:49 pm

any way to print the just the ipd at uart0 instead 1 ?

User avatar
rudi ;-)
Posts: 1727
Joined: Fri Nov 13, 2015 3:25 pm

Re: +ipd

Postby rudi ;-) » Sat Dec 09, 2017 5:53 pm

fritch wrote:any way to print the just the ipd at uart0 instead 1 ?
you have more possibles on this
a) set the Uart in menuconfig
b) change in code the uart for this if "IPD+" parsed ( or any thing like you want )
c) init a second UART for this and write your own "print" function if "IPD+" parsed

.. and so on
Component config - AT -.jpg
uart set by menuconfig
Component config - AT -.jpg (116.18 KiB) Viewed 9750 times
hope this helps

best wishes
rudi ;-)
-------------------------------------
love it, change it or leave it.
-------------------------------------
問候飛出去的朋友遍全球魯迪

fritch
Posts: 14
Joined: Tue Dec 05, 2017 2:02 pm

Re: +ipd

Postby fritch » Sun Dec 10, 2017 11:19 am

Hi, setting the uart in menuconfig will put whole at cmds too is same uart, i just need receive the ipd packet in a diferente uart form other at cmd.
In code i dont find any reference for ipd, must be in the libat_core.a but dont know how edit this file.

User avatar
rudi ;-)
Posts: 1727
Joined: Fri Nov 13, 2015 3:25 pm

Re: +ipd

Postby rudi ;-) » Sun Dec 10, 2017 1:25 pm

fritch wrote:Hi, setting the uart in menuconfig will put whole at cmds too is same uart, i just need receive the ipd packet in a diferente uart form other at cmd.
ok. so you need a second uart for your "IPD+" right?
do you only send or do you need a receive ISR on this uart too?
receive ISR is, if there comes a response on this "IPD+" message
and you want read it in the second UART, then you need a own ISR for this uart.
( i think you want only send this "IPD+" messages over a second UART , but if you want this too, look up in the simple event examle here )


you need general a second uart for "IPD+" messages, right?
so you need to do initialize a second UART simply

if you did this
you parse in the AT Firmware function each message that would send the standard UART for "IPD+"
if you have your data packet picked ( "strcmp" or like you want to this ) , then you know how long it is

then simple send it by the second uart

here is an example of a simple UART

fritch wrote: In code i dont find any reference for ipd, must be in the libat_core.a but dont know how edit this file.
yes - like it was sayed from begin, it's in the AT Core lib and the "IPD+" comes over

Code: Select all

static int32_t at_port_write_data(uint8_t*data,int32_t len)
{
    uint32_t length = 0;

    length = uart_write_bytes(CONFIG_AT_UART_PORT,(char*)data,len);
    return length;

}
you must parse this code for "IPD+" and do what you want do with the "incomming" data for "going out"
the "IPD+" is then in the "*data" and is "len" long

you have then uart0 and uart1
you want use uart1 for "IPD+" outgoings so send it then by uart1 and not by uart0

Code: Select all

uart_write_bytes(UART_NUM_1, (const char *) data, len);

best wishes
rudi ;-)
-------------------------------------
love it, change it or leave it.
-------------------------------------
問候飛出去的朋友遍全球魯迪

fritch
Posts: 14
Joined: Tue Dec 05, 2017 2:02 pm

Re: +ipd

Postby fritch » Sun Dec 10, 2017 4:53 pm

I just need to print the +ipd packect in the uart0 (uart0 already actived for log, rest of at cmds still print in uart1)

no need interrupt isr.

this code will print all at cmd at same uart.

Code: Select all

static int32_t at_port_write_data(uint8_t*data,int32_t len)
{
    uint32_t length = 0;

    length = uart_write_bytes(CONFIG_AT_UART_PORT,(char*)data,len);
    return length;

}
which editor you use for edit the file libat_core.a ?

User avatar
rudi ;-)
Posts: 1727
Joined: Fri Nov 13, 2015 3:25 pm

Re: +ipd

Postby rudi ;-) » Sun Dec 10, 2017 11:24 pm

fritch wrote: which editor you use for edit the file libat_core.a ?
libat_core.a

this file is an archive file with more files.
you can expand it example by 7z or with your favority zipper.
in this archive file there are
archive_listing.png
archive_listing.png (9.44 KiB) Viewed 9685 times
the +IPD is example in at_ipCMD.o
you can view the file example with an HEX editor
view_at_ipCmd.o.png
view_at_ipCmd.o.png (46.64 KiB) Viewed 9685 times
.o files are precompiled files and no source files
and this files goes usually in an archive and you can then use it as library, like the at lib.a
you can patch but you can't edit like a source file
fritch wrote:
I just need to print the +ipd packect in the uart0 (uart0 already actived for log, rest of at cmds still print in uart1)

no need interrupt isr.

this code will print all at cmd at same uart.

Code: Select all

static int32_t at_port_write_data(uint8_t*data,int32_t len)
{
    uint32_t length = 0;

    length = uart_write_bytes(CONFIG_AT_UART_PORT,(char*)data,len);
    return length;

}
yep, and this code you must change like this

Code: Select all

static int32_t at_port_write_data(uint8_t*data,int32_t len)
{
    uint32_t length = 0;

 // if no string found in *data packet like "+IPD" then 
 // standard outgoing

    length = uart_write_bytes(CONFIG_AT_UART_PORT,(char*)data,len);
    return length;
    
 // if string found in *data packet like "+IPD" then
 // my own routine for this
 // here comes your own UART routine 
 // you must first init a second UART like the example i give you
 // then you send what you want send to your second uart
    
 //   length = uart_write_bytes(CONFIG_AT_MY_OWN_UART_PORT,(char*)data,len);
 //   return length;
}

hope this helps now.
i think it is now deeply explained.
You have to write your code yourself, nobody will take care of your homework ;-)
So let's code yourself - just trust you, it's all here now.

edit: not sure you know, the red words in text are linked - click on it and you surf to the right things

best wishes
rudi ;-)
-------------------------------------
love it, change it or leave it.
-------------------------------------
問候飛出去的朋友遍全球魯迪

User avatar
rudi ;-)
Posts: 1727
Joined: Fri Nov 13, 2015 3:25 pm

Re: +ipd

Postby rudi ;-) » Mon Dec 11, 2017 3:37 am

fritch wrote: I just need to print the +ipd packect in the uart0 (uart0 already actived for log, rest of at cmds still print in uart1)
Ok, one try for you:
you say, uart0 already activated for log?
and cmd still print in uart1?
and this is run for you? and you want only the +IPD packet in the uart0?
so you can try to print the +IPD simple over the LOG to uart0 like this:

first be sure, you have include esp_log in the at_task.c file
and add a TAG for your's as Info

Code: Select all

#include <stdlib.h>
#include <stdio.h>
#include <string.h>

#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "string.h"
#include "esp_at.h"
#include "nvs.h"
#include "nvs_flash.h"

#include "esp_system.h"
#include "at_upgrade.h"

// fritch
#include "esp_log.h"
static const char *TAG = "MyOwnIPDLOG";
then parse the * data for "+IPD"
like this:

Code: Select all

uint8_t searchStr[] = "+IPD";

if( strstr((char *) data, (char *) searchStr) != NULL)

if there was +IPD found you can expand the code with a ESP_LOGI example

Code: Select all

ESP_LOGI(TAG,"+IPD was: %s\n", (char*) data);
but please be warned, it is not defined how long the +IPD Data is,
so you will get all data what are in the data buf is,
this is your homework to change the code like you need,
an exmaple ( commented ) with your own UART Port is with data len,
so you get only the data, what was send.

example change code :

Code: Select all

static int32_t at_port_write_data(uint8_t*data,int32_t len)
{
    uint32_t length = 0;
    uint8_t msg[] = "+IPD was here yeah\n";
    int32_t msg_len = 0;
    uint8_t searchStr[] = "+IPD";

    msg_len=strlen( (char*) msg);

     if( strstr((char *) data, (char *) searchStr) != NULL){
      // uart_write_bytes(CONFIG_MY_UART_PORT,(char*)msg, msg_len);
    	 ESP_LOGI(TAG,(char *) msg);
    	 // not defined how long the data so you will get after data other garbage too.
    	  ESP_LOGI(TAG,"+IPD was: %s\n", (char*) data);
     }

    length = uart_write_bytes(CONFIG_AT_UART_PORT,(char*)data,len);
    return length;
}
if you not want the +IPD data on uart1 then insert a if else

Code: Select all

static int32_t at_port_write_data(uint8_t*data,int32_t len)
{
    uint32_t length = 0;
    uint8_t msg[] = "+IPD was here yeah\n";
    int32_t msg_len = 0;
    uint8_t searchStr[] = "+IPD";

    msg_len=strlen( (char*) msg);

     if( strstr((char *) data, (char *) searchStr) != NULL){
      // uart_write_bytes(CONFIG_MY_UART_PORT,(char*)msg, msg_len);
    	 ESP_LOGI(TAG,(char *) msg);
    	 // not defined how long the data so you will get after data other garbage too.
    	  ESP_LOGI(TAG,"+IPD was: %s\n", (char*) data);
     } else {
    length = uart_write_bytes(CONFIG_AT_UART_PORT,(char*)data,len);
    return length;
    }
}
untested

best wishes
rudi ;-)
-------------------------------------
love it, change it or leave it.
-------------------------------------
問候飛出去的朋友遍全球魯迪

Who is online

Users browsing this forum: No registered users and 67 guests