How to Configure Static Ethernet Parameters Using API: Difference between revisions

From wizarPOS
No edit summary
(Replaced content with "{{Migrating|https://smartpossdk.gitbook.io/cloudpossdk/faq/sim-ethenet-wifi/set-static-ethernet-api}}")
Tag: Replaced
 
Line 1: Line 1:
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.
{{Migrating|https://smartpossdk.gitbook.io/cloudpossdk/faq/sim-ethenet-wifi/set-static-ethernet-api}}
== Permission ==
The application declares the following permissions in the manifest:
  android.permission.CONNECTIVITY_INTERNAL
 
== API Overview ==
=== <big>enableStaticIp</big>===
  <syntaxhighlight lang="java">void enableStaticIp(boolean isStaticIp);</syntaxhighlight>
Enable static IP, true for static ip, else for dhcp.
 
{|class="wizarpostable"
|-
! scope="row" colspan="2" | Parameters
|-
| isStaticIp|| '''boolean:''' true for static ip, else for dhcp.
|}
{|
|-
|}
=== <big>isStaticIp</big>===
  <syntaxhighlight lang="java">boolean isStaticIp();</syntaxhighlight>
true for static ip, else for dhcp.
 
{|class="wizarpostable"
|-
!  scope="row" colspan="2" | Returns
|-
|  boolean || true is static IP.
|}
=== <big>setStaticIp</big>===
  <syntaxhighlight lang="java">boolean setStaticIp(IpBean ipBean);</syntaxhighlight>
Set static IP.
 
{|class="wizarpostable"
|-
! scope="row" colspan="2" | Parameters
|-
| ipBean|| '''IpBean
|-
!  scope="row" colspan="2" | Returns
|-
|  boolean || true is success, false is failure.
|}
=== <big>getStaticIp</big>===
  <syntaxhighlight lang="java">IpBean getStaticIp();</syntaxhighlight>
Get static IP parameters.
 
{|class="wizarpostable"
|-
!  scope="row" colspan="2" | Returns
|-
|  IpBean|| IpBean.
|}
 
<syntaxhighlight lang="java">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 + '\'' +
                '}';
    }
}</syntaxhighlight>
== Download ==
=== Demo ===
Please download the [http://ftp.wizarpos.com/advanceSDK/cloudpos/Eth0MgrTestDemo.zip demo]

Latest revision as of 09:13, 7 April 2024

Please visit new link of same subject:

https://smartpossdk.gitbook.io/cloudpossdk/faq/sim-ethenet-wifi/set-static-ethernet-api

We're making a move! Our site's content is migrating to a new URL, to provide you with an enhanced browsing experience. Please update your bookmarks accordingly. Thank you for your continuous support!