Hardware P2P Infairy Cocina How To
THE ONE OF IoT,YOUR ONLY CHOICE!
P2P DNA
 

P2P


The P2P Object is a important object for all the P2P / uPnP devices to interactive with other bundle, each hardware device can implement a P2P function by implement P2PHandlerInterface to be controlled by others.

      public class myP2PBundle  implements  P2PHandlerInterface{
          ...
      }

      
Then, you have to implement the above functions.
      
          /**
             * Get P2P search timeout in millis
             * @return P2P search timeout millis
             */
            public long getP2PTimeoutMillis();
            
            
            /**
             * P2P Search function
             * @return
             */
            public boolean P2PSearch();
            
            /**
             * Check if the P2P search was done or not.
             * @return true:done, false: failed
             */
            public boolean P2PSearchDone();
            
            /**
             * Check if the P2P device was found.
             * @return true:found, false: not found
             */
            public boolean P2PFound();
            
            
            /**
             * Stop P2P search process
             */
            public void P2PStopSearch();
            
            
            /**
             * Check the P2P search progress
             * @return progress in percent(%)
             */
            public int P2PProgress();
            
            /**
             * Get Bundle ID
             * @return Bundle id
             */
            public String getBundleID();

      
After you done the code, your bundle will appear in the OneShot Installation bundle's p2p object list
Fig-1-6-1. Oneshot installation p2p devices list
Users can just click the bundle icon of yours to search your devices by your own process.
Or, if you want to write a one shot installation bundle, it's easy and simple,
      
        /*
         * p2pBundleId  is p2p object's bundle id
         */
        device.postP2PSearch(p2pBundleId);