Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Device cannot be reregistered after being deleted #72

Open
dpap opened this issue Jan 20, 2018 · 3 comments
Open

Device cannot be reregistered after being deleted #72

dpap opened this issue Jan 20, 2018 · 3 comments

Comments

@dpap
Copy link

dpap commented Jan 20, 2018

A device cannot be re-registered after being deleted.

05:26:38.612 [Thread-2] INFO i.a.devicemanager.DeviceManagerImp - Connection established: org.freedesktop.dbus.DBusConnection@623fc1bd
05:26:38.871 [Thread-2] INFO i.a.devicemanager.DeviceManagerImp - Creating new device: Dummy
05:26:38.959 [Thread-2] INFO i.a.devicemanager.DeviceManagerImp - Created new device: [iot.agile.object.DeviceDefinition<dummy001122334455, 00:11:22:33:44:55, Dummy, , iot.agile.protocol.Dummy, /iot/agile/Device/dummy001122334455, [iot.agile.object.DeviceComponent<DummyData, dum>]>]
05:26:38.986 [Thread-8] INFO i.a.devicemanager.DeviceManagerImp - Device connected
05:26:43.401 [Thread-2] INFO i.a.devicemanager.DeviceManagerImp - Deleting device dummy001122334455
05:26:43.406 [Thread-2] INFO i.a.devicemanager.DeviceManagerImp - Device deleted: dummy001122334455
05:26:45.285 [Thread-2] INFO i.a.devicemanager.DeviceManagerImp - Connection established: org.freedesktop.dbus.DBusConnection@623fc1bd
05:26:47.751 [Thread-2] INFO i.a.devicemanager.DeviceManagerImp - Device already registered: dummy001122334455

05:26:47.755 [Thread-9] INFO i.a.devicemanager.DeviceManagerImp - Device connected

@dpap
Copy link
Author

dpap commented Jan 20, 2018

@cskiraly By trying to fix #63 we don't deregister the device from dbus so we can't reregister the same device.
The d-feet tool did help to clear up things ( but I'm not sure how it can connect to a socket file)

In DeviceManagerImp.java line 96
DeviceDefinition registeredDev = null;
if (device != null) {
registeredDev = device.Definition();
logger.info("Device already registered: {}", device.Id());

So if DeviceFactory doesn't delete the old device object a new device will never get registered

the Stop method in DeviceImp.java should include code to deregister the device. I'm not sure what dbusDisconnect() is supposed to do here

Proposed change in DeviceImp.java line 437 (I'll make a pull request later on)
logger.info ("removing "+deviceID+ "object from " + connection.toString());
String devicePath = AGILE_DEVICE_BASE_BUS_PATH + deviceID;
if (connection != null) connection.unExportObject(devicePath);

@cskiraly
Copy link
Contributor

@dpap I've seen the same happening. Can you do the pull request?

@dpap
Copy link
Author

dpap commented Feb 16, 2018

@cskiraly I did the change before the namespaces changed. I'll see what I can do. Check #74

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants