cancel
Showing results for 
Search instead for 
Did you mean: 

Wi-Fi Combo

HIUR_3769846
New Contributor II

Hi,

I would like to call our method to send printf data via wifi when the printf such as WPRINT_APP_INFO/ERROR/DEBUG is executed. Firstly, I tried to used wiced_log_init in reference to Logs ,a simple introduce in Wiced release . However, I cannot get have good result. This method is seemed not to support to switch WPRINT_APP_INFO to log output. Is there other solution?

BR, Hiroyuki

0 Likes
1 Solution
HIUR_3769846
New Contributor II

Hi, I resolve this issue. Thanks everyone for giving advice.

I show the fixed points.

・wwd_debug.h

From #define WPRINT_APP_INFO(args)   WPRINT_MACRO(args)

TO      #define WPRINT_APP_INFO(args) do {application_printf args;} while(0==1)

・my_app.c

int application_printf(const char *pcFormat, ...){

     //Some Task

}

BR,
Hiroyuki

View solution in original post

0 Likes
4 Replies
SiSa_3185206
New Contributor II

You have to enable WPRINT_ENABLE_APP_INFO in your WICED build to be able to see WICED APP INFO prints.

WPRINT_APP_INFO translates to printf() only.

to enable that macro you can use the following line in your WICED app's makefile:

GLOBAL_DEFINES += WPRINT_ENABLE_APP_INFO

Then you can use the WPRINT_APP_INFO ( args ); on your code.

0 Likes
PriyaM_16
Moderator
Moderator

I believe you want to change the default printf statement from WICED and use your own function for printing instead of  WPRINT_APP_INFO()

WPRINT_APP_INFO is defined in wwd_debug.h file:

#define WPRINT_APP_INFO(args)      WPRINT_MACRO(args)

WPRINT_MACRO is in the same file 43xxx_Wi-Fi\WICED\WWD\include\wwd_debug.h -->

#define WPRINT_MACRO(args) do {if (WPRINT_PLATFORM_PERMISSION_FUNC()) printf args;} while(0==1)

and WPRINT_PLATFORM_PERMISSION_FUNC() is equal to 1.

It is using 'printf' to print the logs on UART.

Can you please explain the result you are looking for?

HIUR_3769846
New Contributor II

Thanks for your responses.

Yes, I can found the above define position. And I changed following,

From #define WPRINT_APP_INFO(args)   WPRINT_MACRO(args)

TO    #define WPRINT_APP_INFO(args)   application_printf(args)

application_printf(char args){

     //non

}

However, I have many errors such as
"error: passing argument 1 of 'application_printf' makes integer from pointer without a cast [-Werror]

     #define WPRINT_APP_INFO(args)  application_printf(args)" and

"error: left-hand operand of comma expression has no effect [-Werror=unused-value]

             WPRINT_APP_INFO( ("CONSOLE: %s\n", buffer) );".

Now I'm trying fix.

By the way, my first hope is to transmit log of all "printf" to connected devices via wifi.

0 Likes
HIUR_3769846
New Contributor II

Hi, I resolve this issue. Thanks everyone for giving advice.

I show the fixed points.

・wwd_debug.h

From #define WPRINT_APP_INFO(args)   WPRINT_MACRO(args)

TO      #define WPRINT_APP_INFO(args) do {application_printf args;} while(0==1)

・my_app.c

int application_printf(const char *pcFormat, ...){

     //Some Task

}

BR,
Hiroyuki

View solution in original post

0 Likes