Skip to content

Latest commit

 

History

History
41 lines (36 loc) · 978 Bytes

README.md

File metadata and controls

41 lines (36 loc) · 978 Bytes

EspTouch

  • Create task instance

    Context context; // Set Applicatioin context
    byte[] apSsid = {}; // Set AP's SSID
    byte[] apBssid = {}; // Set AP's BSSID
    byte[] apPassword = {}; // Set AP's password
    
    EsptouchTask task = new EsptouchTask(apSsid, apBssid, apPassword, context);
    task.setPackageBroadcast(true); // if true send broadcast packets, else send multicast packets
  • Set result callback

    task.setEsptouchListener(new IEsptouchListener() {
        @Override
        public void onEsptouchResultAdded(IEsptouchResult result) {
            // Result callback
        }
    });
  • Execute task

    int expectResultCount = 1;
    List<IEsptouchResult> results = task.executeForResults(expectResultCount);
    IEsptouchResult first = results.get(0);
    if (first.isCancelled()) {
      // User cancel the task
      return;
    }
    if (first.isSuc()) {
      // EspTouch successfully
    }
  • Cancel task

    task.interrupt();