Attach and Detach Events not firing

Supporting Java SE version 7 and up
benji2505
Phidgetsian
Posts: 5
Joined: Fri Sep 22, 2017 5:47 pm
Contact:

Attach and Detach Events not firing

Postby benji2505 » Wed Sep 27, 2017 7:03 pm

I am running across the following issue:
I can open input and output channels and they fire attach and detach events. I can see the hardware in the phidget control panel.
If I open a manager channel it does not fire attach or detach events. When logging it shows that the driver realizes the attachment, but it does not fire the event.
I am using a slightly modified version of the manager sample code. I have added the logger and some sysout's.
I am using Mac OS Sierra 10.12.6.; JDK 1.8.0_45.
Question: can anybody replicate the issue?
Output is:
Opening...
DEBUG [phidget22][2017-09-27T21:07:07 dispatch.c+161 entryDispatched()]: creating dispatcher
DEBUG [phidget22][2017-09-27T21:07:07 dispatch.c+163 entryDispatched()]: created dispatcher
Phidget simple playground (plug and unplug devices)
Press enter to end anytime
INFO [phidget22][2017-09-27T21:07:12 macusb.c+416 RawDeviceAdded()]: Attach: 0x0000c903
DEBUG [phidget22][2017-09-27T21:07:12 phidget.c+1463 _addDevice()]: PhidgetInterfaceKit 8/8/8(1010/1018/1019) (279472)
DEBUG [phidget22][2017-09-27T21:07:12 dispatch.c+161 entryDispatched()]: creating dispatcher
DEBUG [phidget22][2017-09-27T21:07:12 dispatch.c+163 entryDispatched()]: created dispatcher
DEBUG [phidget22][2017-09-27T21:07:12 dispatch.c+161 entryDispatched()]: creating dispatcher
DEBUG [phidget22][2017-09-27T21:07:12 dispatch.c+163 entryDispatched()]: created dispatcher
INFO [phidget22][2017-09-27T21:07:16 macusb.c+580 RawDeviceRemoved()]: Detach: 0x0000c903
DEBUG [phidget22][2017-09-27T21:07:16 manager.c+268 deviceDetach()]: PhidgetInterfaceKit 8/8/8(1010/1018/1019) (279472)
DEBUG [phidget22net][2017-09-27T21:07:16 server.c+346 sendNetDeviceDetached()]: 0x7f85bb865600 PhidgetInterfaceKit 8/8/8(1010/1018/1019) (279472)


code is as follows:

Code: Select all

import com.phidget22.*;

public class HelloWorldExample {

    public static void main(String[] args) throws Exception {

        Manager phidman = new Manager();
        com.phidget22.Log.enable(LogLevel.DEBUG, null);
       
        phidman.addAttachListener((ManagerAttachEvent ev)->{
              System.out.println("AttachEvent fired");
            Phidget phid = ev.getChannel();
            try{
            System.out.println("Hello device: " + phid.getDeviceName() + ", Serial Number: " + phid.getDeviceSerialNumber());
            }catch(PhidgetException ex){
                System.out.println(ex.getDescription());
            }
        });
       
        phidman.addDetachListener((ManagerDetachEvent ev) -> {
            Phidget phid = ev.getChannel();
            try{
            System.out.println("Goodbye device: " + phid.getDeviceName() + ", Serial Number: " + phid.getDeviceSerialNumber());
            }catch(PhidgetException ex){
                System.out.println(ex.getDescription());
            }
        });
      
        try {
            System.out.println("Opening...");
            phidman.open();
            System.out.println("Phidget simple playground (plug and unplug devices)");
            System.out.println("Press enter to end anytime");
            System.in.read();
            System.out.println("Closing...");
            phidman.close();
           
        } catch (PhidgetException ex) {
            System.out.println(ex.getDescription());
        }
    }
}

User avatar
Patrick
Lead Developer
Posts: 3098
Joined: Mon Jun 20, 2005 8:46 am
Location: Canada
Contact:

Re: Attach and Detach Events not firing

Postby Patrick » Fri Sep 29, 2017 12:37 pm

I can confirm this, and am looking into it.

-Patrick

benji2505
Phidgetsian
Posts: 5
Joined: Fri Sep 22, 2017 5:47 pm
Contact:

Re: Attach and Detach Events not firing

Postby benji2505 » Fri Sep 29, 2017 2:22 pm

Thank you for your help!


Return to “Java”

Who is online

Users browsing this forum: No registered users and 1 guest