Skip to content
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

HTTPRestClient is broken #51

Closed
clm6rt opened this issue May 4, 2018 · 2 comments
Closed

HTTPRestClient is broken #51

clm6rt opened this issue May 4, 2018 · 2 comments
Labels
Bug Something isn't working good first issue Good for newcomers Platform: XDK110 Prio.Medium

Comments

@clm6rt
Copy link

clm6rt commented May 4, 2018

code:

package main;
import platforms.xdk110;


setup internet : WLAN {
	ssid = "";	
	psk = "";
}

setup http : HttpRestClient {
	endpointBase = "http://google.com/test";
	transport = internet;
	var foo = resource("","application/json");
}



every 1 second {
	var x = accelerometer.x_axis.read();
	if (x>500){
		http.foo.write("");
	}
}
Retcode_T ConnectivityHttpRestClientHttp_Enable(void)
{
	retcode = HttpClient_initialize();
	if(retcode != RETCODE_OK) 
	{
		return retcode;
	}
	
	return NO_EXCEPTION;
}

var retcode needs to be declared

@wegendt-bosch wegendt-bosch added Bug Something isn't working Prio.Medium Platform: XDK110 good first issue Good for newcomers labels May 4, 2018
@wegendt-bosch wegendt-bosch changed the title [Platform xdk110] HTTPRestClient is broken HTTPRestClient is broken May 4, 2018
@rherrmannr
Copy link
Contributor

I think this is already fixed.

With the current master you need to specify connection
Using the example with declared connection

setup internet : WLAN {
	ssid = "";	
	psk = "";
	connection = Personal;
}

setup http : HttpRestClient {
	endpointBase = "http://google.com/test";
	transport = internet;
	var foo = resource("","application/json");
}



every 1 second {
	var x = accelerometer.x_axis.read();
	if (x>500){
		http.foo.write("");
	}
}

Generates

Retcode_T ConnectivityHttpRestClientHttp_Enable(void)
{
	Retcode_T retcode = PAL_initialize();
	if (retcode != RETCODE_OK)
	{
	    return retcode;
	}
	
	PAL_socketMonitorInit();
	
	retcode = HttpClient_initialize();
	if(retcode != RETCODE_OK) 
	{
		return retcode;
	}
	
	return NO_EXCEPTION;
}

var retcode will be declared.
The issue can be closed.

@wegendt-bosch
Copy link
Contributor

Thanks for trying it out! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working good first issue Good for newcomers Platform: XDK110 Prio.Medium
Projects
None yet
Development

No branches or pull requests

3 participants