简体   繁体   中英

.NET Gadgeteer how to get response from web service

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM