EspressifApp / EsptouchForAndroid

EspTouch is one way for Android Phone to tell the connected Router's Ssid, Password and etc. to make IOT devices to connect to the same Router. EspTouch is developed and maintained by Espressif Corp.
Other
1.03k stars 461 forks source link

Request - please allow a different SSID to be optionally typed #53

Closed jackdaddy69 closed 2 years ago

jackdaddy69 commented 4 years ago

In many cases I would like to set up a device locally and then give it to a customer where a different SSID is present. I do not want this customer to change the SSID or Password themselves. This software only allows the SSID to come from the local connection.

You could make the SSID default to the name as you do now, and if the app user types on top of it, then the new SSID would be sent to the ESP device.

Thank you for your consideration!

XuXiangJun commented 4 years ago

EspTouch Api support to post custom SSID.

    public EsptouchTask(byte[] apSsid, byte[] apBssid, byte[] apPassword, Context context)

In our demo App, you can change the SSID widget(id = ap_ssid_text) from TextView to EditText in the layout xml.

<EditText
        android:id="@+id/ap_ssid_text"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginStart="4dp"
        android:layout_marginLeft="4dp"
        android:singleLine="true"
        android:textAppearance="?android:attr/textAppearanceMedium"
        app:layout_constraintStart_toEndOf="@id/ap_ssid_label"
        app:layout_constraintTop_toTopOf="parent" />

And set SSID data from EditText in function public void onClick(View v) int our Activity

    @Override
    public void onClick(View v) {
        if (v == mConfirmBtn) {
            byte[] ssid = ByteUtil.getBytesByString(mApSsidTV.getText().toString());
            byte[] password = ByteUtil.getBytesByString(mApPasswordET.getText().toString());
            byte[] bssid = TouchNetUtil.parseBssid2bytes(mApBssidTV.getText().toString());
            byte[] deviceCount = mDeviceCountET.getText().toString().getBytes();
            byte[] broadcast = {(byte) (mPackageModeGroup.getCheckedRadioButtonId() == R.id.package_broadcast
                    ? 1 : 0)};

            if (mTask != null) {
                mTask.cancelEsptouch();
            }
            mTask = new EsptouchAsyncTask4(this);
            mTask.execute(ssid, bssid, password, deviceCount, broadcast);
        }
    }
nguyenvanquan7826 commented 4 years ago

thank, but use can not know bssid, but this requite bssid. On ios, bssid not requite, why it requite on android?