.NET Gadgeteer how to get response from web service

326 views Asked by At

I'm a beginner when it comes to .NET Gadgeteer programming I only managed to find how I can send data to web service but how do I receive it I'd like to control Gadgeteer using website I only need to pass some values when necessary I'd like to know where I should start learning it I can't find decent developer guide or such so I don't know what some of the functions really mean. Any simple explanation or beginner examples would really help.

1

There are 1 answers

2
dumbledad On

It does depend on which version of Gadgeteer you are using, but here is some simple code I have used on our physical charts which are written recently (though using the Gadgeteer 4.3 .Net Micro Framework 4.2) in C# on Spider main-boards. Try it.

[...]

using Gadgeteer.Networking;

[...]

    var request = HttpHelper.CreateHttpGetRequest(_GetCurrentDemoURL + _ID);
    request.ResponseReceived += GetDataResponseReceived;
    request.SendRequest();

[...]

private void GetDataResponseReceived(HttpRequest sender, HttpResponse response)
{
    Debug.Print(response.StatusCode + ": " + response.Text);
    if (response.StatusCode == "200")
    {
        DataReceived(response.Text);
    }
}

That said, although I love Stack Overflow I have not found it the best place to get answers for Gadgeteer or even .Net Micro Frameworks questions. I have had more luck with GHI's forums. In any case, there or here, you will be expected to read up more before posting a question. It really helps if you can show what code you have already tried.