Set Static Ethernet API
The system provides the AIDL interface to set the static Ethernet parameters, When connect the service, the package name is com.wizarpos.wizarviewagentassistant, and the class name is com.wizarpos.wizarviewagentassistant.Eth0MgrService. When the application uses the interface, it must import wizarviewagentassistant and add permissions to the Android manifest file.
Permission
The application declares the following permissions in the manifest:
android.permission.CONNECTIVITY_INTERNAL
API Overview
enableStaticIp
void enableStaticIp(boolean isStaticIp);
Enable static IP, true for static ip, else for dhcp.
isStaticIp
for the enable static IP setting, a boolean value is used: true for static ip, else for dhcp.
isStaticIp
boolean isStaticIp();
true for static ip, else for dhcp.
boolean
a boolean representation of the result.
true if static ip. false if dhcp.
setStaticIp
boolean setStaticIp(IpBean ipBean);
Set static IP.
ipBean
IpBean
boolean
a boolean representation of the result.
true if success. false if failure.
getStaticIp
IpBean getStaticIp();
Get static IP parameters.
IpBean
IpBean.
public class IpBean implements Parcelable {
private String ipAddress;
private String prefixLength;
private String gateway;
private String dnsServer;
public IpBean(){}
protected IpBean(Parcel in) {
ipAddress = in.readString();
prefixLength = in.readString();
gateway = in.readString();
dnsServer = in.readString();
}
public static final Creator<IpBean> CREATOR = new Creator<IpBean>() {
@Override
public IpBean createFromParcel(Parcel in) {
return new IpBean(in);
}
@Override
public IpBean[] newArray(int size) {
return new IpBean[size];
}
};
public String getIpAddress() {
return ipAddress;
}
public void setIpAddress(String ipAddress) {
this.ipAddress = ipAddress;
}
public String getPrefixLength() {
return prefixLength;
}
public void setPrefixLength(String prefixLength) {
this.prefixLength = prefixLength;
}
public String getGateway() {
return gateway;
}
public void setGateway(String gateway) {
this.gateway = gateway;
}
public String getDnsServer() {
return dnsServer;
}
public void setDnsServer(String dnsServer) {
this.dnsServer = dnsServer;
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(this.ipAddress);
dest.writeString(this.prefixLength);
dest.writeString(this.gateway);
dest.writeString(this.dnsServer);
}
@Override
public String toString() {
return "IpBean{" +
"ipAddress='" + ipAddress + '\'' +
", prefixLength='" + prefixLength + '\'' +
", gateway='" + gateway + '\'' +
", dnsServer='" + dnsServer + '\'' +
'}';
}
}
Download
Demo
Please download the demo
Last updated