Code Monkey home page Code Monkey logo

Comments (3)

86simonepenna avatar 86simonepenna commented on July 20, 2024

I have the same problem:

`public sealed class StartupTask : IBackgroundTask
{
public void Run(IBackgroundTaskInstance taskInstance)
{

       string deviceConnectionString = "xxxxxxxxxxxxx";

        var deviceClient = DeviceClient.CreateFromConnectionString(deviceConnectionString, TransportType.Mqtt);

        deviceClient.OpenAsync().Wait();

        deviceClient.SetMethodHandlerAsync("WriteToConsole", WriteToConsole, null).Wait();


    }




    static Task<MethodResponse> WriteToConsole(MethodRequest methodRequest, object userContext)
    {
        var pin = GpioController.GetDefault().OpenPin(5);
        pin.SetDriveMode(GpioPinDriveMode.Output);

        if (pin.Read() == GpioPinValue.High)
        {
            pin.Write(GpioPinValue.Low);

        }
        else
        {
            pin.Write(GpioPinValue.High);
        }

        return Task.FromResult(new MethodResponse(200));
    }


}`

When from my webapi app call the method with:
`serviceClient = ServiceClient.CreateFromConnectionString(connectionString);

    CloudToDeviceMethod oc = new CloudToDeviceMethod("WriteToConsole");

    CloudToDeviceMethodResult r = await serviceClient.InvokeDeviceMethodAsync("RaspberryVecomp", oc);`

non function.

The error is:

"Device {"Message":"ErrorCode:DeviceNotOnline;Timed out waiting for device to connect.","ExceptionMessage":"Tracking ID:b467cb8e1c544fbea30eb68bc0fee870-G:6-TimeStamp:01/29/2017 23:16:41"} not registered"

from azure-iot-sdk-csharp.

tameraw avatar tameraw commented on July 20, 2024

@carlosaxpires - Thanks for filing. We'll provide a fix shortly.

from azure-iot-sdk-csharp.

tameraw avatar tameraw commented on July 20, 2024

latest package released with this fix.

from azure-iot-sdk-csharp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.