Menu

x10 Bundle

2008-08-22
2012-11-28
  • Guido Zockoll

    Guido Zockoll - 2008-08-22

    Hi,

    after playing around with the x10 bundle, i found out a problem. If you stop the bundle, the serial ports are not freed. So starting again fails, because the port is now locked. I added a cleanup function to Config.java an call it when the bundle is stopped.

    I also update my local copy of the bundle to use currect version 1.3 of the underlaying tjx10 library.

    Regards,

    Guido

    Index: Config.java

    --- Config.java    (Revision 2460)
    +++ Config.java    (Arbeitskopie)
    @@ -53,7 +53,20 @@
           }
         }
       }
    -

    +  public void stop() {
    +    synchronized(controllers) {
    +        Iterator iter=controllers.values().iterator();
    +        while(iter.hasNext()) {
    +            ControllerWrap wrap = (ControllerWrap)iter.next();
    +            if(wrap != null)
    +                wrap.stop();
    +           
    +        }
    +        controllers.clear();
    +    }
    +  }

       public String getName() {
         return "Creates instances of x10.Controller";
       }
    @@ -65,7 +78,8 @@
       String              port;
       String              module;
       Controller          controller;
    -
    +  ControllerServer    srv;

       ServiceRegistration reg;

       ControllerWrap(String     pid,
    Index: Activator.java
    ===================================================================
    --- Activator.java    (Revision 2460)
    +++ Activator.java    (Arbeitskopie)
    @@ -25,6 +25,7 @@
       }

       public void stop(BundleContext bc) {
    +    config.stop();
         this.log = null;
         this.bc  = null;
       }

     
    • Erik Wistrand

      Erik Wistrand - 2008-08-28

      Hi,

      Thanks for the patch.

      I created two bug reports, one for the missing close() and one for the need for tjx10 upgrade and assigned myself to those.

      Both should be quite easy to fix, since you made all the work :)

      thanks again,

      /E

       

Log in to post a comment.

MongoDB Logo MongoDB