FLIR One Developer / Blog / Topics / c#, S60, xamarin / Implemented interfaces not being called

Implemented interfaces not being called

Home Forums FLIR ONE SDK Development Device specific CAT S60/S61 smartphones Implemented interfaces not being called

Tagged: , ,

This topic contains 3 replies, has 2 voices, and was last updated by Profile photo of Dominique Dominique 2 years, 5 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)

  • Author

    Posts

  • #6215

    Profile photo of Bill
    Bill

    Participant

    I’m trying to use the FLIR One thermal camera library in a xamarin.forms project. The device I’m using is the Cat S60. I’ve created a binding for the AAR and have added the DLL to my xamarin.forms Android project’s references. The projects compile and run without errors. The next step I’m trying to complete is to create a device. I’ve followed the FLIR Android Java example. Here’s my class

    using Application = Android.App.Application;
    using Device = Com.Flir.Flironesdk.Device;
    using Exception = System.Exception;
    using FlirUsbDevice = Com.Flir.Flironesdk.FlirUsbDevice;
    using Frame = Com.Flir.Flironesdk.Frame;
    using FrameProcessor = Com.Flir.Flironesdk.FrameProcessor;
    using LoadedFrame = Com.Flir.Flironesdk.LoadedFrame;
    using RenderedImage = Com.Flir.Flironesdk.RenderedImage;
    using SimulatedDevice = Com.Flir.Flironesdk.SimulatedDevice;
    
    public partial class MainMenu : ContentPage, Device.IDelegate, FrameProcessor.IDelegate, Device.IStreamDelegate, Device.IPowerUpdateDelegate 
    {
        private Device flirDevice;
    
        public MainMenu()
        {
            try
            {
                Device.StartDiscovery(Application.Context, this);
            }
            catch (IllegalStateException exception)
            {
                // it's okay if we've already started discovery
            }
            catch (SecurityException securityException)
            {
                // 
            }
        }
    
        public void OnDeviceConnected(Device device)
        {
            flirDevice = device;
            flirDevice.SetPowerUpdateDelegate(this);
            flirDevice.StartFrameStream(this);
        }
    }

    The StartDiscovery call completes without error, and no IllegalStateException or SecurityException, but then I get the following error:

    Unhandled Exception: Java.Lang.NullPointerException: Attempt to invoke interface method ‘void com.flir.flironesdk.Device$Delegate.onDeviceConnected(com.flir.flironesdk.Device)’ on a null object reference

    I’m guessing that the interface can’t see my OnDeviceConnected method. There are no compiler errors, and I have implemented the OnDeviceConnected method, which can be seen in my code above. Do I have to somehow manually assign the onDeviceConnected delegate to my method, or does the problem lie elsewhere? Any help much appreciated.

    • This topic was modified 2 years, 6 months ago by Profile photo of Bill Bill.
    • This topic was modified 2 years, 6 months ago by Profile photo of Bill Bill.

    #6317

    Profile photo of Dominique
    Dominique

    Member

    Hi Bill,

    I’m curious about the naming conventions in Xamarin. Is there something that changes the SDK function names?

    Ex:SetPowerUpdateDelegate to SetPowerUpdateDelegate?

    Thank you,
    Dominique Strauss

    #6324

    Profile photo of Bill
    Bill

    Participant

    It’s more of a C# convention to name methods starting with capitals. I also tried implementing the interface method with a method name starting with lowercase, but still get the same error.

    • This reply was modified 2 years, 5 months ago by Profile photo of Bill Bill.

    #6328

    Profile photo of Dominique
    Dominique

    Member

    Hi Bill,

    Unfortunately I don’t have any other ideas for you. We don’t support Xamarin development with the current version of the FLIR ONE SDK.

    I know that there is another person on the forums named Sofia. She posted recently so perhaps you can collaborate with her?

    If you are having further issues with the SDK in the Android environment in the future, please let us know.

    Thank you,
    Dominique Strauss

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.