error: const char* to 'VMSTR {aka signed char*}'

I’m trying to modify the following code, but keep getting “invalid conversion from ‘const char*’ to ‘VMSTR {aka signed char*}’ [-fpermissive]” error. I’ve tried constructing HTTP_HEADER and HTTP_BODY with Strings and various char arrays. And calculating the length using various methods strlen, ints and sizeof, but the error messages only change slightly.
Sorry for the big code dump.
Please help. Thanks

I want to replace lines 64 through 67(about 1/3 of the way down) below.

NULL, // These lines compile. The request header 0, // These lines compile. The request header length NULL, // These lines compile. The request body 0); // These lines compile. The request body length

With lines 70 through 73

HTTP_HEADER, //The request header strlen(HTTP_HEADER), // The request header length HTTP_BODY, //!!!!!!!!CHANGED this for body. The request body strlen(HTTP_BODY)); // The request body length

or any method that will work.

Here is the Arduino code I am working with.

#include "Arduino.h"
#include "vmlog.h" 
#include "vmhttps.h"
#include "vmgsm_gprs.h"
#include "stdio.h"
#include "string.h"
#include "_https.h"      //comment in for original example GET


//My cellular carrier doesn't require APNs or Proxy so I use these settings
#define CUST_APN    	""         	// The APN of your test SIM
#define USING_PROXY 	VM_FALSE         	// Whether your SIM uses proxy
#define PROXY_ADDRESS   ""    	// The proxy address
#define PROXY_PORT  	80              	// The proxy port

//If your carrier does use APNs comment out the code block above and comment in the code below with your carriers settings.
/*
#define CUST_APN    	"cmwap"         	// The APN of your test SIM
#define USING_PROXY 	VM_TRUE         	// Whether your SIM uses proxy
#define PROXY_ADDRESS   "10.0.0.172"    	// The proxy address
#define PROXY_PORT  	80              	// The proxy port
*/

//char HTTP_HEADER[] = "Content-Type: application/json\r\n";
//char HTTP_BODY[] = "{\"value\": 50}";
//int length1 = sizeof(HTTP_HEADER) / sizeof(HTTP_HEADER);
//int length2 = sizeof(HTTP_BODY) / sizeof(HTTP_BODY);
//String HTTP_HEADER = "Content-Type: application/json\r\n";
//String HTTP_BODY = "{\"value\": 50}";

#define HTTP_HEADER "Content-Type: application/json\r\n"
#define HTTP_BODY   "{\"value\": 50}"


#define MAX_READ_LENGHT	256
#define MAX_LENGHT		(MAX_READ_LENGHT + 16) 


char url[MAX_LENGHT] = {0,};
char content[MAX_LENGHT] = {0, };

VMUINT8 g_channel_id;
VMUINT16 g_request_id;
VMINT g_read_seg_num;
VMINT g_read_ok;


void (*g_http_new_event_cb)(char *, unsigned long) = NULL;

static void https_send_request_set_channel_rsp_cb(VMUINT32 req_id, VMUINT8 channel_id, VM_HTTPS_RESULT result)
{
    VMINT ret = -1;

    ret = vm_https_send_request(
        0,                  				/* Request ID */
        VM_HTTPS_METHOD_POST,                /*!!!!!!!CHANGED this from GET to POST for HTTP Method Constant */
        VM_HTTPS_OPTION_NO_CACHE,           /* HTTP request options */
        VM_HTTPS_DATA_TYPE_BUFFER,          /* Reply type (wps_data_type_enum) */
        MAX_READ_LENGHT,                    /* bytes of data to be sent in reply at a time. If data is more that this, multiple response would be there */
        (VMSTR)url,        					/* The request URL */
        strlen(url),           				// The request URL length 
        /*
64        NULL,                               // These lines compile. The request header 
65        0,                                  // These lines compile. The request header length 
66        NULL,                               // These lines compile. The request body
67        0);                                 // These lines compile. The request body length
        */
        //*
70        HTTP_HEADER,                       //!!!!!!!!CHANGED this for header. The request header 
71        strlen(HTTP_HEADER),               // The request header length
72        HTTP_BODY,                         //!!!!!!!!CHANGED this for body. The request body 
73        strlen(HTTP_BODY));                // The request body length
        /*/
        /*
        HTTP_HEADER,                       //!!!!!!!!CHANGED this for header. The request header 
        (length1),
        HTTP_BODY,                         //!!!!!!!!CHANGED this for body. The request body 
        (length2));
        */
        
    if(ret != 0)
	{
        vm_https_unset_channel(channel_id);
    }
}

static void https_unset_channel_rsp_cb(VMUINT8 channel_id, VM_HTTPS_RESULT result)
{
	Serial.print("\r\nhttps_unset_channel_rsp_cb()\r\n");
	
}

static void https_send_release_all_req_rsp_cb(VM_HTTPS_RESULT result)
{
	Serial.print("\r\nhttps_send_release_all_req_rsp_cb()\r\n");
}

static void https_send_termination_ind_cb(void)
{
	Serial.print("\r\nhttps_send_termination_ind_cb()\r\n");
}

static void https_send_read_request_rsp_cb(VMUINT16 request_id, VM_HTTPS_RESULT result, 
                                           VMUINT16 status, VMINT32 cause, VM_HTTPS_PROTOCOL protocol, 
                                           VMUINT32 content_length,VMBOOL more,
                                           VMSTR content_type, VMUINT8 content_type_len,  
                                           VMSTR new_url, VMUINT32 new_url_len,
                                           VMSTR reply_header, VMUINT32 reply_header_len,  
                                           VMSTR reply_segment, VMUINT32 reply_segment_len)
{
    VMINT ret = -1;
	
	Serial.print("\r\nhttps_send_request_rsp_cb()\r\n");
	
	g_request_id = request_id;
	
    if(result != 0)
	{
        vm_https_cancel(request_id);
        vm_https_unset_channel(g_channel_id);
		
		g_read_ok = false;
    }
    else
	{
		//Serial.print((char *)reply_segment);
		//memset(content, MAX_LENGHT, 0);
		//memcpy(content, reply_segment, reply_segment_len);
		g_http_new_event_cb((char *)reply_segment, reply_segment_len);
		
        ret = vm_https_read_content(request_id, ++g_read_seg_num, MAX_READ_LENGHT);
        if(ret != 0)
		{
            vm_https_cancel(request_id);
            vm_https_unset_channel(g_channel_id);
			
			g_read_ok = false;
        }
		else g_read_ok = true;
    }
}
static void https_send_read_read_content_rsp_cb(VMUINT16 request_id, VMUINT8 seq_num, 
                                                VM_HTTPS_RESULT result, VMBOOL more, 
                                                VMWSTR reply_segment, VMUINT32 reply_segment_len)
{
    VMINT ret = -1;
	
	g_request_id = request_id;		
	
	//Serial.print((char *)reply_segment);
	//memset(content, MAX_LENGHT, 0);
	//memcpy(content, reply_segment, reply_segment_len);
	g_http_new_event_cb((char *)reply_segment, reply_segment_len);
		
    if(more > 0)
	{
        ret = vm_https_read_content(
            request_id,                       /* Request ID */
            ++g_read_seg_num,                 /* Sequence number (for debug purpose) */
            MAX_READ_LENGHT);                 /* The suggested segment data length of replied data in the peer buffer of 
                                                 response. 0 means use reply_segment_len in MSG_ID_WPS_HTTP_REQ or 
                                                 read_segment_length in previous request. */
        if(ret != 0)
		{
            vm_https_cancel(request_id);
            vm_https_unset_channel(g_channel_id);
			
			g_read_ok = false;
        }
		else g_read_ok = true;
    }
    else
	{
        /* don't want to send more requests, so unset channel */
        vm_https_cancel(request_id);
        vm_https_unset_channel(g_channel_id);
        g_channel_id = 0;
        g_read_seg_num = 0;
		
		g_read_ok = false;
    }
}

static void https_send_cancel_rsp_cb(VMUINT16 request_id, VM_HTTPS_RESULT result)
{
	Serial.print("\r\nhttps_send_cancel_rsp_cb()");
}

static void https_send_status_query_rsp_cb(VMUINT8 status)
{
	Serial.print("\r\nhttps_send_status_query_rsp_cb()");
}

static void set_custom_apn(void)
{
    vm_gsm_gprs_apn_info_t apn_info;
    
    memset(&apn_info, 0, sizeof(apn_info));
    strcpy((char *)apn_info.apn, CUST_APN);
    strcpy((char *)apn_info.proxy_address, PROXY_ADDRESS);
    apn_info.proxy_port = PROXY_PORT;
    apn_info.using_proxy = USING_PROXY;
    vm_gsm_gprs_set_customized_apn_info(&apn_info);
}

static void https_send_request(void)
{
	VMINT ret = -1;
	VM_BEARER_DATA_ACCOUNT_TYPE apn = VM_BEARER_DATA_ACCOUNT_TYPE_GPRS_CUSTOMIZED_APN;
	
	vm_https_callbacks_t callbacks = {
		https_send_request_set_channel_rsp_cb,
		https_unset_channel_rsp_cb,
		https_send_release_all_req_rsp_cb,
		https_send_termination_ind_cb,
		https_send_read_request_rsp_cb,
		https_send_read_read_content_rsp_cb,
		https_send_cancel_rsp_cb,
		https_send_status_query_rsp_cb
	};

	set_custom_apn();
	ret = vm_https_register_context_and_callback(apn, &callbacks);

	if(ret != 0)
	{
		return;
	}

	/* set network profile information */
	ret = vm_https_set_channel(
	0, 0,
	0, 0, 0, 0,
	0, 0, 0, 0,
	0, 0,
	0, 0
	);
}

boolean https_set_new_event_callback(void(*cb)(char *, unsigned long))
{
    g_http_new_event_cb = cb;
	return true;
}

boolean https_connect(void* user_data)
{
	char *buf = (char *)user_data;
	
	if(strlen(buf) > MAX_LENGHT)return true;
	
	memset(url, 0, strlen(url));
	memcpy(url, buf, strlen(buf));
	Serial.println(url);
	
	https_send_request();
	
	return true;
}

boolean https_stop(void* user_data)
{
	vm_https_cancel(g_request_id);
	vm_https_unset_channel(g_channel_id);
	g_channel_id = 0;
	g_read_seg_num = 0;
	g_read_ok = false;
	
	return true;
}[/code]

Here is the error message
[quote]
Arduino: 1.6.0 (Windows 7), Board: "RePhone"

_https.cpp: In function 'void https_send_request_set_channel_rsp_cb(VMUINT32, VMUINT8, VM_HTTPS_RESULT)':

_https.cpp:73:26: error: invalid conversion from 'const char*' to 'VMSTR {aka signed char*}' [-fpermissive]

         strlen(HTTP_BODY));                // The request body length

                          ^

In file included from _https.cpp:4:0:

C:\Rephone_Arduino\Arduino_IDE_for_RePhone-master\hardware\arduino\mtk\system/libmtk/include/vmhttps.h:539:11: error:   initializing argument 8 of 'VMINT vm_https_send_request(VMUINT16, VM_HTTPS_METHOD, VM_HTTPS_OPTION, VM_HTTPS_DATA_TYPE, VMUINT32, VMSTR, VMUINT32, VMSTR, VMUINT32, VMSTR, VMUINT32)' [-fpermissive]

 VM_RESULT vm_https_send_request(VMUINT16 request_id,

           ^

_https.cpp:73:26: error: invalid conversion from 'const char*' to 'VMSTR {aka signed char*}' [-fpermissive]

         strlen(HTTP_BODY));                // The request body length

                          ^

In file included from _https.cpp:4:0:

C:\Rephone_Arduino\Arduino_IDE_for_RePhone-master\hardware\arduino\mtk\system/libmtk/include/vmhttps.h:539:11: error:   initializing argument 10 of 'VMINT vm_https_send_request(VMUINT16, VM_HTTPS_METHOD, VM_HTTPS_OPTION, VM_HTTPS_DATA_TYPE, VMUINT32, VMSTR, VMUINT32, VMSTR, VMUINT32, VMSTR, VMUINT32)' [-fpermissive]

 VM_RESULT vm_https_send_request(VMUINT16 request_id,

           ^

Error compiling.

  This report would have more information with
  "Show verbose output during compilation"
  enabled in File > Preferences.
[/quote]
Here is some Eclipse C++ code that works fine as is with the changes I want to make in the Arduino code. I tried pasting this code into Arduino IDE and it just produces a whole bunch of compile errors.

[code]#include <string.h>
#include "vmtype.h" 
#include "vmboard.h"
#include "vmsystem.h"
#include "vmlog.h" 
#include "vmcmd.h" 
#include "vmdcl.h"
#include "vmdcl_gpio.h"
#include "vmthread.h"
#include "ResID.h"
#include "HTTPS.h"
#include "vmhttps.h"
#include "vmtimer.h"
#include "vmgsm_gprs.h"


#define VMHTTPS_TEST_URL "https://things.ubidots.com/api/v1.6/variables/56ab9d2d7625425e6575f9/values?page_size=1&token=h5g5rSjUeYksa3GFQxiEbI8mrmu3"


#define MAX_READ_LENGHT	256
#define MAX_LENGHT		(MAX_READ_LENGHT + 16)


char url[MAX_LENGHT] = {0,};
char content[MAX_LENGHT] = {0, };

#define HTTP_HEADER "Content-Type: application/json\r\n"

#define HTTP_BODY   "{\"value\": 100}"



VMUINT8 g_channel_id;
VMINT g_read_seg_num;
static void https_send_request_set_channel_rsp_cb(VMUINT32 req_id, VMUINT8 channel_id, VMUINT8 result)
{
    VMINT ret = -1;

    ret = vm_https_send_request(
        0,									/* Request ID */
        VM_HTTPS_METHOD_POST,                /* HTTP Method Constant */
        VM_HTTPS_OPTION_NO_CACHE,                                      /* HTTP request options */
        VM_HTTPS_DATA_TYPE_BUFFER,               /* Reply type (wps_data_type_enum) */
        MAX_READ_LENGHT,                    /* bytes of data to be sent in reply at a time. If data is more that this, multiple response would be there */
        //100,                     	            /* bytes of data to be sent in reply at a time. If data is more that this, multiple response would be there */
        (VMUINT8 *)VMHTTPS_TEST_URL,        /* The request URL */
        strlen(VMHTTPS_TEST_URL),           /* The request URL length */
        HTTP_HEADER,                       /* The request header */
        strlen(HTTP_HEADER),               /* The request header length */
        HTTP_BODY,							/* The request body*/
        strlen(HTTP_BODY));					/* The request body length */


    if (ret != 0) {
        vm_https_unset_channel(channel_id);
    }


}

static void https_unset_channel_rsp_cb(VMUINT8 channel_id, VMUINT8 result)
{
    //vm_log_debug("https_unset_channel_rsp_cb()");
}
static void https_send_release_all_req_rsp_cb(VMUINT8 result)
{
    //vm_log_debug("https_send_release_all_req_rsp_cb()");
}
static void https_send_termination_ind_cb(void)
{
    //vm_log_debug("https_send_termination_ind_cb()");
}
static void https_send_read_request_rsp_cb(VMUINT16 request_id, VMUINT8 result,
                                         VMUINT16 status, VMINT32 cause, VMUINT8 protocol,
                                         VMUINT32 content_length,VMBOOL more,
                                         VMUINT8 *content_type, VMUINT8 content_type_len,
                                          VMUINT8 *new_url, VMUINT32 new_url_len,
                                         VMUINT8 *reply_header, VMUINT32 reply_header_len,
                                         VMUINT8 *reply_segment, VMUINT32 reply_segment_len)
{
    VMINT ret = -1;
    vm_log_debug("https_send_request_rsp_cb()");
    if (result != 0) {
        vm_https_cancel(request_id);
        vm_https_unset_channel(g_channel_id);
    }
    else {
        vm_log_debug("reply_content:%s", reply_segment);
        ret = vm_https_read_content(request_id, ++g_read_seg_num, 100);
        if (ret != 0) {
            vm_https_cancel(request_id);
            vm_https_unset_channel(g_channel_id);
        }
    }
}
static void https_send_read_read_content_rsp_cb(VMUINT16 request_id, VMUINT8 seq_num,
                                                 VMUINT8 result, VMBOOL more,
                                                 VMUINT8 *reply_segment, VMUINT32 reply_segment_len)
{
    VMINT ret = -1;
    vm_log_debug("reply_content:%s", reply_segment);
    char* Result = (reply_segment);
    vm_log_debug("I am Here");
    vm_log_debug(Result);

    if (more > 0) {
        ret = vm_https_read_content(
            request_id,                                    /* Request ID */
            ++g_read_seg_num,                 /* Sequence number (for debug purpose) */
            100);                                          /* The suggested segment data length of replied data in the peer buffer of
                                                              response. 0 means use reply_segment_len in MSG_ID_WPS_HTTP_REQ or
                                                              read_segment_length in previous request. */
        if (ret != 0) {
            vm_https_cancel(request_id);
            vm_https_unset_channel(g_channel_id);
        }
    }
    else {
        /* don't want to send more requests, so unset channel */
        vm_https_cancel(request_id);
        vm_https_unset_channel(g_channel_id);
        g_channel_id = 0;
        g_read_seg_num = 0;

    }
}
static void https_send_cancel_rsp_cb(VMUINT16 request_id, VMUINT8 result)
{
    //vm_log_debug("https_send_cancel_rsp_cb()");
}
static void https_send_status_query_rsp_cb(VMUINT8 status)
{
    //vm_log_debug("https_send_status_query_rsp_cb()");
}



void set_custom_apn(void)
{
    vm_gsm_gprs_apn_info_t apn_info;

    memset(&apn_info, 0, sizeof(apn_info));
    strcpy(apn_info.apn, CUST_APN);
    strcpy(apn_info.proxy_address, PROXY_ADDRESS);
    apn_info.proxy_port = PROXY_PORT;
    apn_info.using_proxy = USING_PROXY;
    vm_gsm_gprs_set_customized_apn_info(&apn_info);
}



static void https_send_request(VM_TIMER_ID_NON_PRECISE timer_id, void* user_data)
{
     /*----------------------------------------------------------------*/
     /* Local Variables                                                */
     /*----------------------------------------------------------------*/
     VMINT ret = -1;
     VMINT apn = VM_BEARER_DATA_ACCOUNT_TYPE_GPRS_CUSTOMIZED_APN;
     vm_https_callbacks_t callbacks = {
         https_send_request_set_channel_rsp_cb,
         https_unset_channel_rsp_cb,
         https_send_release_all_req_rsp_cb,
         https_send_termination_ind_cb,
         https_send_read_request_rsp_cb,
         https_send_read_read_content_rsp_cb,
         https_send_cancel_rsp_cb,
         https_send_status_query_rsp_cb
     };

    /*----------------------------------------------------------------*/
     /* Code Body                                                      */
     /*----------------------------------------------------------------*/

    do {
        set_custom_apn();
        vm_timer_delete_non_precise(timer_id);
        ret = vm_https_register_context_and_callback(
            apn, &callbacks);

        if (ret != 0) {
            break;
        }

        /* set network profile information */
        ret = vm_https_set_channel(
            0, 0,
            0, 0, 0, 0,
            0, 0, 0, 0,
            0, 0,
            0, 0
        );
    } while (0);


}


void handle_sysevt(VMINT message, VMINT param)
{
    switch (message)
    {
    case VM_EVENT_CREATE:
        vm_timer_create_non_precise(60000, https_send_request, NULL);
        break;

    case VM_EVENT_QUIT:
        break;
    }
}

void vm_main(void) 
{
    /* register system events handler */
    vm_pmng_register_system_event_callback(handle_sysevt);
}

Found a solution to this problem.
Thank you for reading.

How did you solve it? (to learn)
Casting?

Yup, can confirm: casting works.

eg:

VMWSTR msg= (VMWSTR) “Casting works…”;