top

Network

This class provides network setting information(ip, dns(domain name server) address, gateway address etc.) and methods which can set these.

Add the following line for Network class into a html file your own :

  object id="plugin" classid="clsid:SAMSUNG-INFOLINK-SEF" style="width:0px; height:0px;">/object>

You can declare Network class like this :

  ex) plugin = document.getElementById("plugin");

        plugin.Open('Network', '1.001', 'Network');

        plugin.Execute('method', 'parm1', 'parm2');


Methods

GetActiveType

Description
The GetActiveType function gets the current active interface (Wired or Wireless).
Parameters
none
Return■Success
  - 1 : active interface is WIRED
  - 0 : active interface is WIRELESS

■Fail
  - -1
Emulator SupportY
SDK ConstraintNone
Example
var cType = SefPlugin.Execute("GetActiveType");
if (cType == 1)
    document.getElementById('ActiveConnection').value = "wired";
if (cType == 0)
    document.getElementById('ActiveConnection').value = "wireless";
if (cType == -1)
{
    document.getElementById('ActiveConnection').value =
    "no active connection";
    return;
}

GetIPMode

Description
The GetIPMode function gets the IP address type (Auto/Manual).
Parameters
■interfaceType
  - Number
  - The type of interface (Wired/Wireless)
     1: wired,
     0: wireless
Return■Success
  - 0 : Auto
  - 1 : Manual

■Fail
  - returns -1
Emulator SupportY
SDK ConstraintNone
Example
var cType = SefPlugin.Execute("GetActiveType");
if (cType != -1)
    var ipType = SefPlugin.Execute("GetIPMode", cType);

SetIPMode

Description
The SetIPMode function sets the IP address type (Auto/Manual).
Parameters
■interfaceType
  - Number
  - The type of interface (Wired/Wireless)
     1: wired,
     0: wireless
■mode
  - Number
  - The IP mode (Auto/Manual)
     0: Auto,
     1: Manual
Return■Success
  - returns 1

■Fail
  - returns -1
Emulator SupportY
SDK ConstraintNone
Example
var cType = SefPlugin.Execute("GetActiveType");
if (cType != -1)
    var result = SefPlugin.Execute("SetIPMode", cType, 0);

GetDNSMode

Description
The GetDNSMode function gets the DNS type (Auto/Manual).
Parameters
■interfaceType
  - Number
  - The type of interface (Wired/Wireless)
     1: wired,
     0: wireless
Return■Success
  - 0 : Auto
  - 1 : Manual

■Fail
  - returns -1
Emulator SupportY
SDK ConstraintNone
Example
var cType = SefPlugin.Execute("GetActiveType");
if (cType != -1) {
    var DnsType = SefPlugin.Execute('GetDNSMode', cType);
}

SetDNSMode

Description
The SetDNSMode function sets the DNS type (Auto/Manual).
Parameters
■interfaceType
  - Number
  - The type of interface (Wired/Wireless)
   * 1: wired, 0: wireless
■mode
  - Number
  - The IP mode (Auto/Manual)
   * 0: Auto, 1: Manual
Return■Success
  - returns 1

■Fail
  - returns -1
Emulator SupportY
SDK ConstraintNone
Example
var cType = SefPlugin.Execute("GetActiveType");
if (cType != -1)
    var result = SefPlugin.Execute("SetDNSMode" cType, "0");

CheckPhysicalConnection

Description
The CheckPhysicalConnection function checks the connectivity of cable (for wired) or access point (wireless).
Parameters
■interfaceType
  - Number
  - type of interface (Wired/Wireless)
   *1: wired, 
   *0: wireless
Return■Success
  - 1 : connected
  - 0 : not connected

■Fail
  - returns -1
Emulator SupportY
SDK ConstraintNone
Example
var phyConnection = SefPlugin.Execute("CheckPhysicalConnection", cType);
if (phyConnection == 1) document.getElementById('PhysicalConnection').value = "OK";
if (phyConnection == 0) document.getElementById('PhysicalConnection').value = "Failure";
if (phyConnection == -1) {document.getElementById('PhysicalConnection').value = "Error"; return;}

CheckGateway

Description
The CheckGateway function checks the gateway by pinging.
Parameters
■interfaceType
  - Number
  - The type of interface (Wired/Wireless)
        1: wired, 0: wireless
Return■Success
  - 1 : Gateway is reachable
  - 0 : Gateway is not reachable

■Fail
  - returns -1
Emulator SupportY
SDK ConstraintNone
Example
var cType = "1"; //wired
var checkGW = SefPlugin.Execute("CheckGateway",cType);
if (checkGW == 1) document.getElementById('CheckGateway').value = "OK";
if (checkGW == 0) document.getElementById('CheckGateway').value = "Failure";
if (checkGW == -1) {document.getElementById('CheckGateway').value = "Error"; return;}

CheckDNS

Description
The CheckDNS function checks the DNS by pinging.
Parameters
■interfaceType
  - Number
  - The type of interface (Wired/Wireless)
        1: wired, 0: wireless
Return■Success
  - 1 : DNS is reachable
  - 0 : DNS is not reachable

■Fail
  - -1
Emulator SupportY
SDK ConstraintNone
Example
var type = "1"; //wired
var checkDNS = SefPlugin.Execute("CheckDNS", type );
if (checkDNS == 1) document.getElementById('CheckDNS').value = "OK";
if (checkDNS == 0) document.getElementById('CheckDNS').value = "Failure";
if (checkDNS == -1){ document.getElementById('CheckDNS').value = "Error"; return;}

CheckHTTP

Description
The CheckHTTP function checks the HTTP connectivity.
Parameters
■interfaceType
  - Number
  - The type of interface (Wired/Wireless)
        1: wired, 0: wireless
Return■Success
  - 1 : HTTP is operating successfully
  - 0 : HTTP is not available

■Fail
  - returns -1
Emulator SupportY
SDK ConstraintNone
Example
var cType = "1"; //wired
var checkHttp = SefPlugin.Execute("CheckHTTP", cType);
if (checkHttp== 1) document.getElementById('HttpTest').value = "OK";
if (checkHttp== 0) document.getElementById('HttpTest').value = "Failure";
if (checkHttp== -1) {document.getElementById('HttpTest').value = "Error"; return; }

IsValidMAC

Description
The IsValidMAC function checks whether the MAC address is valid.
Parameters
■interfaceType
  - Number
  - The type of interface (Wired/Wireless)
        1: wired,
        0: wireless
Return■Success
 - 1 : MAC address is valid
 - 0 : MAC is not valid

■Fail
 - returns -1
Emulator SupportY
SDK ConstraintNone
Example
if (SefPlugin.Execute("IsValidMAC", cType) == 1 &&
    SefPlugin.Execute("IsValidIP", cType) == 1 &&
    SefPlugin.Execute("IsValidSubnetMask",cType) == 1 &&
    SefPlugin.Execute("IsValidGateway",cType) == 1 &&
    SefPlugin.Execute("IsValidDNS",cType) == 1)
    document.getElementById('Validate').value = "OK";
else {

    document.getElementById('Validate').value = "Failure";
    return;
}

IsValidIP

Description
The IsValidIP function checks whether the IP address is valid.
Parameters
■interfaceType
  - Number
  - The type of interface (Wired/Wireless)
        1: wired,
        0: wireless
Return■Success
  - 1 : IP address is valid
  - 0 : IP is not valid

■Fail
  - returns -1
Emulator SupportY
SDK ConstraintNone
Example
if (SefPlugin.Execute("IsValidMAC", cType) == 1 &&
    SefPlugin.Execute("IsValidIP", cType) == 1 &&
    SefPlugin.Execute("IsValidSubnetMask",cType) == 1 &&
    SefPlugin.Execute("IsValidGateway",cType) == 1 &&
    SefPlugin.Execute("IsValidDNS",cType) == 1)
    document.getElementById('Validate').value = "OK";
else {

    document.getElementById('Validate').value = "Failure";
    return;
}

IsValidSubnetMask

Description
The IsValidSubnetMask function checks whether the SubNet Mask address is valid.
Parameters
■interfaceType
  - Number
  - The type of interface (Wired/Wireless)
        1: wired,
        0: wireless
Return■Success
  - 1 : SubNet Mask address is valid
  - 0 : SubNet Mask is not valid

■Fail
  - returns -1
Emulator SupportY
SDK ConstraintNone
Example
if (SefPlugin.Execute("IsValidMAC", cType) == 1 &&
    SefPlugin.Execute("IsValidIP", cType) == 1 &&
    SefPlugin.Execute("IsValidSubnetMask",cType) == 1 &&
    SefPlugin.Execute("IsValidGateway",cType) == 1 &&
    SefPlugin.Execute("IsValidDNS",cType) == 1)
    document.getElementById('Validate').value = "OK";
else {

    document.getElementById('Validate').value = "Failure";
    return;
}

IsValidGateway

Description
The IsValidGateway function checks whether the gateway address is valid.
Parameters
■interfaceType
  - Number
  - The type of interface (Wired/Wireless)
        1: wired,
        0: wireless
Return■Success
  - 1 : gateway address is valid
  - 0 : gateway is not valid

■Fail
  - returns -1
Emulator SupportY
SDK ConstraintNone
Example
if (SefPlugin.Execute("IsValidMAC", cType) == 1 &&
    SefPlugin.Execute("IsValidIP", cType) == 1 &&
    SefPlugin.Execute("IsValidSubnetMask",cType) == 1 &&
    SefPlugin.Execute("IsValidGateway",cType) == 1 &&
    SefPlugin.Execute("IsValidDNS",cType) == 1)
    document.getElementById('Validate').value = "OK";
else {

    document.getElementById('Validate').value = "Failure";
    return;
}

IsValidDNS

Description
The IsValidDNS function checks whether the DNS address is valid.
Parameters
■interfaceType
  - Number
  - The type of interface (Wired/Wireless)
     1: wired,
     0: wireless
Return■Success
  - 1 : DNS address is valid
  - 0 : DNS is not valid

■Fail
  - returns -1
Emulator SupportY
SDK ConstraintNone
Example
if (SefPlugin.Execute("IsValidMAC", cType) == 1 &&
    SefPlugin.Execute("IsValidIP", cType) == 1 &&
    SefPlugin.Execute("IsValidSubnetMask",cType) == 1 &&
    SefPlugin.Execute("IsValidGateway",cType) == 1 &&
    SefPlugin.Execute("IsValidDNS",cType) == 1)
    document.getElementById('Validate').value = "OK";
else {

    document.getElementById('Validate').value = "Failure";
    return;
}

GetMAC

Description
The GetMAC function gets the MAC address.
Parameters
■interfaceType (Optional)
  - Number
  - If this function is called without parameter, it returns result for wired network.
  - The type of interface (Wired/Wireless)
   * 1: wired, 0: wireless
Return■Success
  - String
  - MAC address

■Fail
  - null string
Emulator SupportY
SDK ConstraintNone
Example
//for wired interface
var mac = SefPlugin.Execute("GetMAC" ,"1");

GetIP

Description
The GetIP function gets the IP address.
Parameters
■interfaceType (Optional)
  - Number
  - If this function is called without parameter, it returns result for wired network.
  - The type of interface (Wired/Wireless)
   * 1: wired, 0: wireless
Return■Success
  - String 
  - IP address

■Fail
  - null string
Emulator SupportY
SDK ConstraintNone
Example
//for wired interface
var IP = SefPlugin.Execute("GetIP", "1");

GetGateway

Description
The GetGateway function gets the gateway address.
Parameters
■interfaceType (Optional)
  - Number
  - If this function is called without parameter, it returns result for wired network.
  - The type of interface (Wired/Wireless)
   * 1: wired, 0: wireless
Return■Success
  - String 
  - gateway address

■Fail
  - null string
Emulator SupportY
SDK ConstraintNone
Example
//for wired interface
var GW = SefPlugin.Execute('GetGateway', "1");

GetNetMask

Description
The GetNetMask function gets the NetMask address.
Parameters
■interfaceType (Optional)
  - Number
  - If this function is called without parameter, it returns result for wired network.
  - The type of interface (Wired/Wireless)
   * 1: wired, 0: wireless
Return■Success
  - String 
  - NetMask address

■Fail
  - null string
Emulator SupportY
SDK ConstraintNone
Example
//for wired interface
var NetMask = SefPlugin.Execute("GetNetMask", "1");

GetDNS

Description
The GetDNS function gets the DNS address.
Parameters
■interfaceType
  - Number
  - This function accepts call with One parameter Or WITHOUT parameter
     The type of interface (Wired/Wireless)
        1: wired,
        0: wireless
    If called without parameter, the command returns the result for wired network.
Return■Success
  - String 
  -  DNS address

■Fail
  - returns 0
Emulator SupportY
SDK ConstraintNone
Example
//for wired interface
var Dns = SefPlugin.Execute("GetDNS" , "1");

//or with default parameter
var Dns = SefPlugin.Execute("GetDNS");