添加wifi接口增加wifi类型和密码参数
This commit is contained in:
@@ -18,7 +18,9 @@ data class WiFiZoneBean(
|
||||
var wifiName: String,
|
||||
var longitude: Double,
|
||||
var latitude: Double,
|
||||
var wifiPass: String,
|
||||
var wifiAuth: Int,
|
||||
var type: Int //1是home 2是office
|
||||
) : Parcelable {
|
||||
constructor() : this("", "", "", "", "", "", 0.0, 0.0, 1)
|
||||
constructor() : this("", "", "", "", "", "", 0.0, 0.0, "", 0, 1)
|
||||
}
|
||||
|
||||
@@ -53,6 +53,7 @@ import androidx.annotation.StringDef
|
||||
ConstantString.Id,
|
||||
ConstantString.PetWeight,
|
||||
ConstantString.Upgrade,
|
||||
ConstantString.Password,
|
||||
ConstantString.PackageUnitMonth,
|
||||
ConstantString.PackageUnitYear,
|
||||
ConstantString.SetMealIndex
|
||||
@@ -105,6 +106,7 @@ annotation class ConstantString {
|
||||
const val UserBean = "userBean"
|
||||
const val HistoryDataBean = "historyDataBean"
|
||||
const val Upgrade = "upgrade"
|
||||
const val Password = "password"
|
||||
|
||||
//套餐单位
|
||||
const val PackageUnitMonth = "MONTH"
|
||||
|
||||
@@ -567,6 +567,8 @@ interface INetworkService {
|
||||
@Field("wifiName") wifiName: String,
|
||||
@Field("longitude") longitude: Double,
|
||||
@Field("latitude") latitude: Double,
|
||||
@Field("wifiPass") wifiPass: String,
|
||||
@Field("wifiAuth") wifiAuth: Int,
|
||||
@Field("type") type: Int
|
||||
): BaseResponse<String>
|
||||
|
||||
|
||||
@@ -475,10 +475,21 @@ object NetworkApi : BaseNetworkApi<INetworkService>(INetworkService.BASE_URL) {
|
||||
wifiName: String,
|
||||
longitude: Double,
|
||||
latitude: Double,
|
||||
wifiPass: String,
|
||||
wifiAuth: Int,
|
||||
type: Int
|
||||
) = getResult {
|
||||
service.addWifiZone(
|
||||
deviceId, wifiZoneName, address, wifiMac, wifiName, longitude, latitude, type
|
||||
deviceId,
|
||||
wifiZoneName,
|
||||
address,
|
||||
wifiMac,
|
||||
wifiName,
|
||||
longitude,
|
||||
latitude,
|
||||
wifiPass,
|
||||
wifiAuth,
|
||||
type
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -283,6 +283,8 @@ class AddWifiPasswordActivity :
|
||||
intent.putExtra(ConstantString.Pet, mPetBean)
|
||||
intent.putExtra(ConstantString.Latitude, mPetCurrentLat)
|
||||
intent.putExtra(ConstantString.Longitude, mPetCurrentLon)
|
||||
val pws = mViewBinding.ilAddWifiPwdPassword.etInputContent.text.toString()
|
||||
intent.putExtra(ConstantString.Password, pws)
|
||||
startActivityFinish(intent)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -221,9 +221,11 @@ class EditWifiPowerZoneActivity :
|
||||
}
|
||||
|
||||
private fun initWifiData() {
|
||||
var pws = ""
|
||||
intent.extras?.apply {
|
||||
isFirstBind = getBoolean(ConstantString.isFirstBind, false)
|
||||
isDisabledMode = getBoolean(ConstantString.isCheck, false)
|
||||
pws = getString(ConstantString.Password, "")
|
||||
//设备里的wifi数据,添加使用到
|
||||
mWiFiBean =
|
||||
Util.getParcelableAdaptive(intent, ConstantString.WiFi, WiFiBean::class.java)
|
||||
@@ -264,6 +266,8 @@ class EditWifiPowerZoneActivity :
|
||||
mWiFiBean?.let {
|
||||
wifiName = it.name
|
||||
wifiMac = it.mac
|
||||
wifiAuth = it.auth_type
|
||||
wifiPass = pws
|
||||
wifiZoneName = getString(R.string.txt_home)
|
||||
}
|
||||
mViewBinding.let {
|
||||
|
||||
@@ -29,7 +29,16 @@ class WiFiZoneViewModel : ViewModel() {
|
||||
viewModelScope.launch {
|
||||
wiFiZoneBean.apply {
|
||||
val result = NetworkApi.addWifiZone(
|
||||
deviceId, wifiZoneName, address, wifiMac, wifiName, longitude, latitude, type
|
||||
deviceId,
|
||||
wifiZoneName,
|
||||
address,
|
||||
wifiMac,
|
||||
wifiName,
|
||||
longitude,
|
||||
latitude,
|
||||
wifiPass,
|
||||
wifiAuth,
|
||||
type
|
||||
)
|
||||
mAddWiFiZoneLiveData.value = result
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user