I’m new here. I would like to get value from my device light sensor that on the mbed pelion cloud. Can anyone point me to good tutorial on setting notification callback on C# or VB.net?
https://os.mbed.com/docs/v5.8/reference/callback.html can be of help
Thanks for the link, but I think I didn’t explain what I want to do. I would like to develop web application to read the sensor value from the mbed pelion cloud. I already have device connected to mbed pelion cloud. Below some of my codes so far…
Dim url As String
url = ""
If param = "resource" Then
'GET method - list of resources
url = "https://api.us-east-1.mbedcloud.com/v2/endpoints/xxxxx"
ElseIf param = "subscriptions" Then
'subscriptions
url = "https://api.us-east-1.mbedcloud.com/v2/subscriptions/xxxxx"
ElseIf param = "responseID" Then
'POST method - async-response-id
url = "https://api.us-east-1.mbedcloud.com/v2/endpoints/xxxxx/3200/0/5501"
ElseIf param = "events" Then
'GET method
'List all device events
url = "https://api.us-east-1.mbedcloud.com/v3/device-events/"
ElseIf param = "devices" Then
'list all devices
url = "https://api.us-east-1.mbedcloud.com/v3/devices/"
ElseIf param = "eventID" Then
'device event id
url = "https://api.us-east-1.mbedcloud.com/v3/device-events/xxxxx"
End If
Dim req As HttpWebRequest = TryCast(WebRequest.Create(url), HttpWebRequest)
req.Headers.Add("Authorization", "Bearer API Key")
req.Method = "GET"
req.KeepAlive = True
req.ContentType = "application/json; charset=UTF-8"
req.Accept = "application/json"
If req.Proxy IsNot Nothing Then
req.Proxy.Credentials = CredentialCache.DefaultCredentials
End If
Dim dataStream As System.IO.Stream
Dim res As WebResponse = req.GetResponse()
dataStream = res.GetResponseStream()
Dim reader As New System.IO.StreamReader(dataStream)
Dim responseFromServer As String = reader.ReadToEnd()
Return responseFromServer
reader.Close()
dataStream.Close()
res.Close()
Hello @yphasukyued,
There are actually some SDKs (one in C#) which should help you doing what you want:
https://cloud.mbed.com/docs/current/mbed-cloud-sdk-references/index.html
For C# examples, please have a look at corresponding repository.
Hope this helps,
Adrien