-The base64_encode wants to see the number of bytes the data has
-I guess that is the number of bytes of the photo taken by the camera
-The number of bytes converted to char
-Returns the length of the string
-The length of the char variable
-I still do not know
To be easier to understand my problem, here is the rest of my code!
Now I'm having some problems on "printf (*encoded);"
#include "app_camera.h"
#include "app_wifi.h"
//#include "app_httpd.h"
#include "app_httpd.h"
#include "esp_timer.h"
#include "img_converters.h"
#include "fb_gfx.h"
#include "sdkconfig.h"
#include "esp_log.h"
#include "wpa/includes.h"
#include "os.h"
#include "wpa2/utils/base64.h"
#include <stdio.h>
#include <string.h>
#include <unistd.h>
static const char *TAG = "Teste";
static void periodic_timer_callback(void *arg);
void app_main()
{
//app_wifi_main();
app_camera_main();
//app_httpd_main();
usleep(10000000);
const esp_timer_create_args_t periodic_timer_args = {
.callback = &periodic_timer_callback,
.name = "periodic"};
esp_timer_handle_t periodic_timer;
ESP_ERROR_CHECK(esp_timer_create(&periodic_timer_args, &periodic_timer));
/* The timer has been created but is not running yet */
/* Start the timers */
ESP_ERROR_CHECK(esp_timer_start_periodic(periodic_timer, 10000000)); //Time of the pic
ESP_LOGI(TAG, "Started timer");
}
static void periodic_timer_callback(void *arg) //Pic
{
camera_fb_t * pic = NULL;
pic = esp_camera_fb_get();
size_t pic_len;
pic_len = pic->len;
esp_camera_fb_return(pic);
size_t output_length; // note *NOT* a pointer
unsigned char * encoded = base64_encode((const unsigned char *)pic->buf, pic_len, &output_length);
printf (*encoded);
ESP_LOGI(TAG, "10 seconds");
}