AbstractDriverModuleHook - device re-create

I’ve a simple driver based on the AbstractTagDriverExample.
All is fine excepted when I delete the device in the GW and recreate the same device with the same name.

I have the following message :

I would like to delete all the tag assosied to the device before the device is re-created :
Is the shutdown method of AbstractTagDriver the rigth place to do that ?
removeDriverTag need tag address, what is the path synthax adress (provider ? device ? path to tag ?)

public class DriverPing extends AbstractTagDriver {

	private volatile int tagCount = 1;	
	private volatile String tagPrefix = "eqt_";
	private List<String> listeTag = new ArrayList<String>();
		
	@Override
	public void initialize(
			String deviceName,
			DriverContext driverContext,
			NodeManager nodeManager,
			NodeBuilderFactory builderFactory) {
		super.initialize(deviceName, driverContext, nodeManager, builderFactory);
		
		for (int i = 0; i < tagCount; i++) {
			final int tagNumber = i + 1;

			String debPath = String.format("%s%s",tagPrefix,tagNumber);
			
			IpAdresseWritableDriverTag tagIp = new IpAdresseWritableDriverTag(debPath + "/ip");
			// TODO : parm timeout
			EtatPingDriverTag etat = new EtatPingDriverTag(debPath + "/status",3000, tagIp);
			
			addDriverTag(tagIp);			
			addDriverTag(etat);				
			
			listeTag.add(debPath + "/ip");
			listeTag.add(debPath + "/status");
		}
	}
	
	@Override
	public void shutdown(){		
		for (int i = 0;i < listeTag.size();i++){
			removeDriverTag(listeTag.get(i));
		}
	}


If you override shutdown, make sure to call super.shutdown(). AbstractTagDriver removes any nodes that you added for you during the course if its shutdown. In your case though you’ve overridden it without the call to super.

1 Like

Thanks a lot.
All is ever done in the AbstractTagDriver !