Android SDK2.0 API Reference Manual
Android SDK2.0 API Reference Manual
1. GizWifiSDK Class
1.1. Introduction
Gizwits Wi-Fii SDK base class, which provides device discovery and configuration,
device control, user login and registration etc.
1
Android SDK 2.0 API Reference Manual
【setListener】
Definition public void setListener(GizWifiSDKListener listener)
Description set SDK General Listener
Parameters listener GizWifiSDKListener callback object
GizWifiSDK.sharedInstance().setListener(new GizWifiSDKListener() {
Sample code // app implement the callback function
});
【startWithAppID】
public void startWithAppID(Context context, String appID, String
appSecret, List<String> specialProductKeys,
Definition
ConcurrentHashMap<String, String> cloudServiceInfo, boolean
autoSetDeviceDomain)
This uses to initialize SDK. Only after this API is executed, can other APIs
do. If listener has been set, SDK will report discoverable devices
Description immediately by didDiscovered callback.
2
Android SDK 2.0 API Reference Manual
If you want to set domain of device, can enable auto-setting when this
API is called, SDK would let all devices which support setting domain and
App connect to the same cloud service domain, but auto-setting is
disabled by default.
Note: If auto-setting is enable, it will effective and remain in force, you can
call setDeviceServerInfo API to stop auto-setting.
context context object
On Gizwits Developer Zone (dev.gizwits.com),
each registered device can find its appID on its
appid corresponding “application setting”. This
parameter appID doesn’t have default value,
developer must send correct value.
On Gizwits Developer Zone (dev.gizwits.com),
can find appSecret corresponding to appID in
appSecret “application setting”. This parameter
appSecret doesn’t have default value,
developer must pass correct value.
This parameter is device productKeys which
you want to filter, it is String array.
The default value of specialProductKeys is null.
When it is default value, and then SDK would
Parameters specialProductKeys
return all devices. If you want SDK return
devices which have been filtered,
specialProductKeys should be special
productKey.
This parameter is the domain info of service
which you want to connect.
The default value is null. When it is default
value, SDK would base on location of mobile to
set service domain as Gizwits general cloud
service domain.
cloudServiceInfo
If App want to set cloud service domain as
stand-alone deployment, it should pass value
as the following format Dictionary{key: value}
{
"openAPIInfo": "xxx", // String, cloud API
service domain
3
Android SDK 2.0 API Reference Manual
4
Android SDK 2.0 API Reference Manual
5
Android SDK 2.0 API Reference Manual
【getCurrentCloudService】
Definition public void getCurrentCloudService()
Description get current cloud service domain info
GizWifiSDK.sharedInstance().setListener(mListener);
GizWifiSDK.sharedInstance().getCurrentCloudService();
// implement callback
public void didGetCurrentCloudService(GizWifiErrorCode result,
ConcurrentHashMap<String, String> cloudServiceInfo) {
Sample code
if(result == GizWifiErrorCode.GIZ_SDK_SUCCESS) {
// success
} else {
// failure
}
}
【getVersion】
Definition public String getVersion()
6
Android SDK 2.0 API Reference Manual
【setLogLevel】
Definition public void setLogLevel(GizLogPrintLevel logLevel)
Sets printing log level. This is the printing log level when debug in terminal,
it would print all log by default. Printing log level would not affect log file print,
Description
SDK would write all log into log file no matter what printing log level is. Log
file is stored in directory of SD card: GizWifiSDK/packageName/GizSDKLog/
Parameters logLevel Printing log level, see details on GizLogPrintLevel definition
GizWifiSDK.sharedInstance().setLogLevel(GizLogPrintLevel.
Sample code
GizLogPrintAll);
【getSSIDList】
Definition public void getSSIDList()
Get SSID list of device in Soft-AP mode, SSID list would return from
Description
asynchronous callback.
public void didGetSSIDList(GizWifiErrorCode result, List<GizWifiSSID>
Callback
ssidInfoList)
See details on GizWifiErrorCode enum definition,
Callback result GIZ_SDK_SUCCESS is success, others are failures.
parameters When result is failure, ssidInfoList would be null.
ssidInfoList SSID list consist of GizWifiSSID object
GizWifiSDK.sharedInstance().setListener(mListener);
GizWifiSDK.sharedInstance().getSSIDList();
// implement callback
GizWifiSDKListener mListener = new GizWifiSDKListener() {
@Override
public void didGetSSIDList(GizWifiErrorCode result,
Sample code
List<GizWifiSSID> ssidInfoList) {
if (result == GizWifiErrorCode.GIZ_SDK_SUCCESS) {
// get list success
} else {
// get list failure
}
}
7
Android SDK 2.0 API Reference Manual
};
【setDeviceOnboarding】
public void setDeviceOnboarding(String ssid, String key,
Definition GizWifiConfigureMode mode, String softAPSSIDPrefix, int timeout,
List<GizWifiGAgentType> types)
Configure device to LAN Wi-Fi network. When device in softap mode,
module will create a hotspot, mobile can configure after connecting to
this hotspot. While using firmware of Gizwits, prefix name of module
hotspot should be “XPG-GAgent-” and password should be
“123456789”. When device in airlink mode, mobile can configure at any
time. No matter choosing which configuration mode, when device is
Description
online, only after mobile connects to configuration LAN Wi-Fi, can
confirm that device has configured success.
8
Android SDK 2.0 API Reference Manual
// softap configuration
GizWifiSDK.sharedInstance().setListener(mListener);
GizWifiSDK.sharedInstance().setDeviceOnboarding("your_SSID",
"your_key", GizWifiConfigureMode.GizWifiSoftAP, "XPG-GAgent-
DF4A", 60, null);
Sample code
// implement callback
GizWifiSDKListener mListener = new GizWifiSDKListener() {
@Override
public void didSetDeviceOnboarding(GizWifiErrorCode result,
String MAC, String DID, String productKey) {
if (result == GizWifiErrorCode.GIZ_SDK_SUCCESS) {
// configure success
} else {
//configure failure
}
}
};
【getBoundDevices】
public void getBoundDevices(String UID, String token, List<String>
Definition
specialProductKey)
Get list of binding devices, in different network, it would have different
Description
operations:
9
Android SDK 2.0 API Reference Manual
When mobile can access internet, this API would send request to cloud
service to get binding devices. When mobile couldn’t access internet, it
would find devices of LAN in real time, but it would remain devices which
have been bound before. When mobile is out of network, unbinding
devices of LAN would disappear, but it would remain binding devices
which you have got before. Users couldn’t get list of binding devices
without login.
Note: In this API, if the length of UID or token is error, SDK would use
previous UID or token
UID UID get from user login or registration
token token get from user login or registration
The changing of device list would trigger this callback, the error code is
GIZ_SDK_SUCCESS, list of device means the collection merging
binding devices and LAN devices.
See details on GizWifiErrorCode enum definition.
result GIZ_SDK_SUCCESS means success, others mean
Callback failures. When result is failure, deviceList is not null.
parameters It is an array consist of GizWifiDevice object. This
deviceLis
parameter would only return devices filter by special
t
productKey.
GizWifiSDK.sharedInstance().setListener(mListener);
GizWifiSDK.sharedInstance().getBoundDevices("your_UID",
"your_token", null);
Sample code
// implement callback
GizWifiSDKListener mListener = new GizWifiSDKListener() {
@Override
10
Android SDK 2.0 API Reference Manual
【bindRemoteDevice】
public void bindRemoteDevice(String UID, String token, String MAC,
Definition
String productKey, String productSecret)
Description Bind remote device to server
UID UID get from user login or registration
token token get from user login or registration
MAC MAC of device waiting for binding
Parameters
productKey productKey of device waiting for binding
productSecr
productSecret of device waiting for binding
et
// implement callback
Sample code
GizWifiSDKListener mListener = new GizWifiSDKListener() {
@Override
public void didBindDevice(GizWifiErrorCode result, String DID) {
if (result == GizWifiErrorCode.GIZ_SDK_SUCCESS) {
// binding success
} else {
11
Android SDK 2.0 API Reference Manual
// binding failure
}
}
};
【unbindDevice】
Definition public void unbindDevice(String UID, String token, String DID)
Description unbind device from server
UID UID get from user login or registration
Parameters token token get from user login and registration
DID DID of device waiting for unbinding
// implement callback
GizWifiSDKListener mListener = new GizWifiSDKListener() {
@Override
Sample code public void didUnbindDevice(GizWifiErrorCode result, String DID) {
if (result == GizWifiErrorCode.GIZ_SDK_SUCCESS) {
// unbinding success
} else {
// unbinding failure
}
}
};
【getCaptchaCode】
Definition public void getCaptchaCode(String appSecret)
Get image captcha. Developers login on dev.gizwits.com, getting App
Description Secret from user’s application setting, then use App Secret to get image
captcha.
12
Android SDK 2.0 API Reference Manual
GizWifiSDK.sharedInstance().setListener(mListener);
GizWifiSDK.sharedInstance().getCaptchaCode("your_app_secret");
// implement callback
GizWifiSDKListener mListener = new GizWifiSDKListener() {
@Override
public void didGetCaptchaCode(GizWifiErrorCode result, String
Sample code token, String captchaId, String captchaURL) {
if (result == GizWifiErrorCode.GIZ_SDK_SUCCESS) {
// success
} else {
// failure
}
}
};
【requestSendPhoneSMSCode】
public void requestSendPhoneSMSCode(String appSecret, String
Definition
phone)
Description Get SMS verify code by phone
appSecret secret of app, can see it on dev.gizwits.com
Parameters
phone phone number
13
Android SDK 2.0 API Reference Manual
GizWifiSDK.sharedInstance().setListener(mListener);
GizWifiSDK.sharedInstance().requestSendPhoneSMSCode
("your_app_secret", "your_phone_number");
// implement callback
GizWifiSDKListener mListener = new GizWifiSDKListener() {
@Override
public void didRequestSendPhoneSMSCode(GizWifiErrorCode
Sample code
result, String token) {
if (result == GizWifiErrorCode.GIZ_SDK_SUCCESS) {
// success
} else {
// failure
}
}
};
【requestSendPhoneSMSCode】
public void requestSendPhoneSMSCode(String token, String captchaId,
Definition
String captchaCode, String phone)
Description Get SMS verify code by image captcha
token get token from getCaptchaCode API
captchaId get captchaId from getCaptchaCode API
Parameters
captchaCode code of image captcha
phone phone number
GizWifiSDK.sharedInstance().setListener(mListener);
GizWifiSDK.sharedInstance().requestSendPhoneSMSCode
("your_token", "your_captchaId", "your_captchaCode",
Sample code
"your_phone_number");
// implement callback
14
Android SDK 2.0 API Reference Manual
【registerUser】
public void registerUser(String username, String password, String code,
Definition
GizUserAccountType accountType)
Registration should specify account type, username of GizUserPhone is
Description phone number, username of GizUserEmail is email address, username
of GizUserNormal is normal username.
username (phone number, email address or normal
username
username)
password password
SMS verify code, it would be invalid after registration,
code
and it couldn’t be used again.
Parameters
account type, see details on GizUserAccountType enum
definition. If username is phone number, this parameter
should be GizUserPhone. If username is email address,
accountType
this parameter should be GizUserEmail. If username is
normal username, this parameter should be
GizUserNormal.
GizWifiSDK.sharedInstance().setListener(mListener);
Sample code
GizWifiSDK.sharedInstance().registerUser ("your_phone_number",
15
Android SDK 2.0 API Reference Manual
"your_password", "your_verify_code",
GizUserAccountType.GizUserPhone);
// implement callback
GizWifiSDKListener mListener = new GizWifiSDKListener() {
@Override
public void didRegisterUser(GizWifiErrorCode result, String UID,
String token) {
if (result == GizWifiErrorCode.GIZ_SDK_SUCCESS) {
// success
} else {
// failure
}
}
};
【userLoginAnonymous】
Definition public void userLoginAnonymous()
Description Login with anonymous user, no need to register account.
GizWifiSDK.sharedInstance().setListener(mListener);
GizWifiSDK.sharedInstance().userLoginAnonymous();
// implement callback
GizWifiSDKListener mListener = new GizWifiSDKListener() {
@Override
Sample code public void didUserLogin(GizWifiErrorCode result, String UID,
String token) {
if (result == GizWifiErrorCode.GIZ_SDK_SUCCESS) {
// login success
} else {
// login failure
}
16
Android SDK 2.0 API Reference Manual
}
};
【userLogin】
Definition public void userLogin(String username, String password)
User login, using username and password which have been registered
Description successfully. username can be phone number, email address and normal
username.
usernam
username
Parameters e
password password
GizWifiSDK.sharedInstance().setListener(mListener);
GizWifiSDK.sharedInstance().userLogin("your_user_name",
"your_password");
// implement callback
GizWifiSDKListener mListener = new GizWifiSDKListener() {
@Override
public void didUserLogin(GizWifiErrorCode result, String UID,
Sample code
String token) {
if (result == GizWifiErrorCode.GIZ_SDK_SUCCESS) {
// login success
} else {
// login failure
}
}
};
【changeUserPassword】
Definition public void changeUserPassword(String token, String oldPassword,
17
Android SDK 2.0 API Reference Manual
String newPassword)
Description change user password
token token from user login or registration
oldPassword old password
Parameters
newPasswor
new password
d
GizWifiSDK.sharedInstance().setListener(mListener);
GizWifiSDK.sharedInstance().changeUserPassword("your_token",
"your_old_password", "your_new_password");
// implement callback
GizWifiSDKListener mListener = new GizWifiSDKListener() {
@Override
Sample code public void didChangeUserPassword(GizWifiErrorCode result) {
if (result == GizWifiErrorCode.GIZ_SDK_SUCCESS) {
// success
} else {
// failure
}
}
};
【resetPassword】
public void resetPassword(String username, String code, String
Definition
newPassword, GizUserAccountType accountType)
Reset password. GizUserPhone user would reset password by using
Description SMS verify code. GizUserEmail user would reset password by uing
reset-link of email
username It should be phone number or email address.
SMS verify code is required to reset password by phone.
code
Parameters If reset by email, it can be set to null
newPasswor New password. It can be set to null if reset password by
d email.
18
Android SDK 2.0 API Reference Manual
GizWifiSDK.sharedInstance().setListener(mListener);
GizWifiSDK.sharedInstance().resetPassword("your_phone_number",
"your_verify_code", "your_new_password",
GizUserAccountType.GizUserPhone);
// implement callback
GizWifiSDKListener mListener = new GizWifiSDKListener() {
@Override
Sample code
public void didChangeUserPassword(GizWifiErrorCode result) {
if (result == GizWifiErrorCode.GIZ_SDK_SUCCESS) {
// success
} else {
// failure
}
}
};
【changeUserInfo】
public void changeUserInfo(String token, String username, String code,
Definition
GizUserAccountType accountType, GizUserInfo additionalInfo)
Change user info, include username and personal additional info.
username can only be changed to phone number or email address which
has been registered before. This API can be used by the following case:
Only change phone number
Only change email address
Only change personal additional info of normal user
Description
Change phone number and additional info
Change email address and additional info
If you only change personal additional info, accountTyoe should be
GizUserNormal. If you change phone number, accountType should be
GizUserPhone. If you change email address, accountType should be
GizUserEmail.
19
Android SDK 2.0 API Reference Manual
GizWifiSDK.sharedInstance().setListener(mListener);
GizWifiSDK.sharedInstance().changeUserInfo("your_token",
"your_phone_number", "your_verify_code",
GizUserAccountType.GizUserPhone, null);
// implement callback
GizWifiSDKListener mListener = new GizWifiSDKListener() {
@Override
Sample code
public void didChangeUserInfo(GizWifiErrorCode result) {
if (result == GizWifiErrorCode.GIZ_SDK_SUCCESS) {
// change info success
} else {
// change info failure
}
}
};
【getUserInfo】
Definition public void getUserInfo(String token)
20
Android SDK 2.0 API Reference Manual
GizWifiSDK.sharedInstance().setListener(mListener);
GizWifiSDK.sharedInstance().getUserInfo ("your_token");
// implement callback
GizWifiSDKListener mListener = new GizWifiSDKListener() {
@Override
public void didGetUserInfo(GizWifiErrorCode result, GizUserInfo
Sample code userInfo) {
if (result == GizWifiErrorCode.GIZ_SDK_SUCCESS) {
// get info success
} else {
// get info failure
}
}
};
【transAnonymousUser】
public void transAnonymousUser(String token, String username, String
Definition
password, String code, GizUserAccountType accountType)
Anonymous user convert to GizUserPhone or GizUserNormal. Note:
Description
username should not be registered before.
token Token fron user login or registration
Username, it should be normal username or phone
username
number
password password
Parameters code SMS verify code
Account type, see details on GizThirdAccountType enum
accountTyp definition. If username is phone number, this parameter
e should be GizUserPhone. If username is normal
username, this parameter should be GizUserNormal.
21
Android SDK 2.0 API Reference Manual
// implement callback
GizWifiSDKListener mListener = new GizWifiSDKListener() {
Sample code @Override
public void didTransAnonymousUser(GizWifiErrorCode result) {
if (result == GizWifiErrorCode.GIZ_SDK_SUCCESS) {
// transform success
} else {
// transform failure
}
}
};
22
Android SDK 2.0 API Reference Manual
2. GizWifiDevice Class
2.1. Introduction
This is the device class of Gizwits Wi-Fi. GizWifiDevice class provide developers with
device subscriptions, data notices, real-time status updates, device control, with
applications in products such as controlling the water temperature of water heater. The
device object is allocated by GizWifiDevice class, cannot be self-created.
【getMacAddress】
Definition public String getMacAddress()
Gets the MAC address of the device. If it is “Virtual: Site”, then it is a virtual
Description
device.
Returns Returns MAC address of the device.
// mDevice is the device object obtained from list of device
Sample code
String MAC = mDevice.getMacAddress();
【getDid】
Definition public String getDid()
Description Gets DID of the device on cloud
Returns Returns DID of the device
// mDevice is the device object obtained from the device list
Sample code
String DID = mDevice.getDid();
23
Android SDK 2.0 API Reference Manual
【getIPAddress】
Definition public String getIpAddress()
Gets ip address of device. If device is a WLAN, the ip address is the domain of
Description
cloud server.
Returns Returns the ip address of the device.
// mDevice is the device object obtained from device list
Sample code
String ip = mDevice.getIPAddress();
【getProductKey】
Definition public String getProductKey()
Description Gets the product type identifier of the device
Returns Returns the product type identifier of the device
// mDevice is the device object obtained from list of device
Sample code
String productKey = mDevice.getProductKey();
【getProductName】
Definition public String getProductName()
Description Gets the product name of the device
Returns Returns the product name of the device
// mDevice is the device object obtained from list of device
sample Code
String productName = mDevice.getProductName();
【getProductType】
Definition public GizWifiDeviceType getProductType()
Description Gets product type, it should be standard or gateway device.
Returns Returns the device type
// mDevice is the device object obtained from list of device
Sample code
GizWifiDeviceType type = mDevice.getProductType();
【getRemark】
Definition public String getRemark()
Description Gets remark of the device. After the device is bound, the remark can be
24
Android SDK 2.0 API Reference Manual
【getAlias】
Definition public String getAlias()
Gets the alias of the device. After the device is bound, the alias can be
Description
changed, default is null.
Returns Returns with the alias of the device.
// mDevice is the device object obtained from list of device
Sample code
String alias = mDevice.getAlias();
【getNetStatus】
Definition public GizWifiDeviceNetStatus getNetStatus()
Gets the network status of the device. For details, see the enumeration
Description
GizWifiDeviceNetStatus.
Returns Returns the device’s net state.
// mDevice is the device object obtained from list of device
Sample code
GizWifiDeviceNetStatus netStatus = mDevice. getNetStatus ();
【isLAN】
Definition public boolean isLAN()
Description Determines whether the device is a LAN device or WLAN device.
Returns Returns whether the device is a LAN device or a WLAN device
// mDevice is the device object obtained from list of device
Sample code
boolean isBind = mDevice.isLAN();
【isBind】
Definition public boolean isBind()
Description Determines whether the device has been bound
Returns Returns whether the device has been bound
Sample code // mDevice is the device object obtained from list of device
25
Android SDK 2.0 API Reference Manual
【isDisabled】
Definition public boolean isDisabled()
Description Determines whether the device has been disabled by the cloud.
Returns Determines whether the device has been disabled by the cloud.
// mDevice is the device object obtained from list of device
Sample code
boolean isDisabled = mDevice.isDisabled();
【isSubscribed】
Definition public boolean isSubscribed()
Description Determines whether the device has been subscribed.
Returns Returns whether the device has been subscribed.
// mDevice is the device object obtained from list of device
Sample code
boolean isSubscribed = mDevice.isSubscribed();
【isProductDefined】
Definition public boolean isProductDefined()
Description Determines whether the device has defined datapoint.
Returns Returns whether the device has defined datapoint.
// mDevice is the device object obtained from list of device
Sample code
boolean isProductDefined = mDevice.isProductDefined();
26
Android SDK 2.0 API Reference Manual
2.4. API
【didUpdateNetStatus】
public void didUpdateNetStatus(GizWifiDevice device,
Callback
GizWifiDeviceNetStatus netStatus)
// implement callback
GizWifiDeviceListener mListener = new GizWifiDeviceListener() {
Sample code
@override
public void didUpdateNetStatus(GizWifiDevice device,
GizWifiDeviceNetStatus netStatus) {
}
};
【setSubscribe】
Definition public void setSubscribe(String productSecret, boolean subscribed)
On whether the device is subscribed or unsubscribed. If the device is
subscribed, it means that the user is interested in the push messages of
the device. After subscription, the SDK will automatically sign in and
Description bound the device. After being unsubscribed, the device will automatically
disconnect, but will not automatically be unbound. Usually, subscriptions
will always succeed and the SDK will remember whether the device is
subscribed.
The product secret of device. On the product information
productSecr section found on GizWits Developer Zone
Parameters
et (dev.gizwits.com), the corresponding product key of the
product secret can be found. There is no default value
27
Android SDK 2.0 API Reference Manual
// implement callback
GizWifiDeviceListener mListener = new GizWifiDeviceListener() {
@Override
Sample code public void didSetSubscribe(GizWifiErrorCode result,
GizWifiDevice device, boolean isSubscribed) {
if (result == GizWifiErrorCode.GIZ_SDK_SUCCESS) {
// When subscription or unsubscription has succeeded.
} else {
// Failure
}
}
};
【getDeviceStatus】
Definition public void getDeviceStatus(List<String> attrs)
Acquires device status. For devices that are subscribed, the device must
be controllable before the status can be acquired. If the device has
Description
variable-length datapoints, you can also search for status of special
datapoint.
28
Android SDK 2.0 API Reference Manual
// implement callback
GizWifiDeviceListener mListener = new GizWifiDeviceListener() {
29
Android SDK 2.0 API Reference Manual
@Override
public void didReceiveData(GizWifiErrorCode result,
GizWifiDevice device, ConcurrentHashMap<String, Object>
dataMap, int SN) {
if (result == GizWifiErrorCode.GIZ_SDK_SUCCESS) {
// Query success
} else {
// Query failure
}
}
};
【write】
Definition public void write(ConcurrentHashMap<String, Object> data, int sn)
Gives a controlled command to the device. Commands can only be sent
Description
after a subscribed device is in a controllable status.
The parameters are the commands given to the device. This is in
dictionary format, the key-value pair can be input with the
following ways:
• If the device has definitions for its datapoints, one single
sending can be given to multiple datapoints. Keys within a
dictionary should be named its datapoints, and values
should be the datapoint values. Value types have to be the
same as datapoint definitions:
(1)If the datapoint is boolean, input boolean as the value
data type;
(2)If the datapoint is of the numerical type, input int or float
Parameters as the value type;
(3)If the datapoint is of the enum type, input an enumerated
serial number(int type) or an enumerated string(String type);
(4)If the datapoint is an extended type, input value as a
Byte[] type;
If the device is operated in a transparent format, transparent
commands can only be sent one at a time. The key in the
dictionary is binary, and the value is of Byte[] type.
The serial number of the control command, corresponding to the
sn responded data of the command. When device has confirmed the
command, this SN will be returned.
30
Android SDK 2.0 API Reference Manual
/*
* The following code uses SN as an example. If the application uses a
command serial number SN, SN can be set to the corresponding value.
Sample code
*/
// After a subscribed device is under the controllable state, a light opening
action will be executed.
int SN = 0;
ConcurrentHashMap command = new ConcurrentHashMap<String,
boolean> ();
31
Android SDK 2.0 API Reference Manual
command.put("LED_OnOff", true);
mDevice.write(command, SN);
// implement callback
GizWifiDeviceListener mListener = new GizWifiDeviceListener() {
@Override
public void didReceiveData(GizWifiErrorCode result,
GizWifiDevice device, ConcurrentHashMap<String, Object>
dataMap, int SN) {
if (result == GizWifiErrorCode.GIZ_SDK_SUCCESS) {
// Command serial number matches, the light opening
sequence
} else {
// Light has failed to open
}
}
};
【setCustomInfo】
Definition public void setCustomInfo(String remark, String alias)
Description Changes the remarks and alias. Can only be set after the device is bound.
Changes the remarks. null means not being changed, “” means
remark
an empty string.
Parameters
Changes the alias. null means not being changed, “” means an
alias
empty string.
32
Android SDK 2.0 API Reference Manual
if (result == GizWifiErrorCode.GIZ_SDK_SUCCESS) {
// Change success
} else {
// Change failure
}
}
};
【getHardwareInfo】
Definition public void getHardwareInfo()
Obtains hardware information. This API can be used with unsubscribed
Description
device, as long as device is under the normal operation mode.
{
"Wi-Fi HardVersion": [value], // values are of the string
type, and is the devices Wi-Fi hardware version
number
hardwareInfo
"wifiFirmwareId": [value], // ID values are of the string
type, and is the device Wi-Fi firmware ID number
33
Android SDK 2.0 API Reference Manual
mDevice.setListener(mListener);
mDevice.getHardwareInfo();
// implement callback
GizWifiDeviceListener mListener = new GizWifiDeviceListener() {
@Override
public void didGetHardwareInfo(GizWifiErrorCode result,
Sample code GizWifiDevice device, ConcurrentHashMap<String, String>
hardwareInfo) {
if (result == GizWifiErrorCode.GIZ_SDK_SUCCESS) {
// Success
} else {
// Failure
}
}
};
34
Android SDK 2.0 API Reference Manual
3. GizUserInfo Class
3.1. Introduction
GizUserInfo class is provided for developers to get and modify user info.
UID Type: String. Get UID after user logs in. Provide get method.
username Type: String. Username: phone number or email address. Provide get method
email Type: String. User email address. Provide get method.
phone Type: String. User phone number. Provide get method.
isAnonymous Type: Boolean. Judge whether it is anonymous user. Provide get method.
lang Type: String. User’s language environment. Provide get method.
name Type: String. User’s nickname. Provide get and set methods.
userGender Type: GizUserGenderType. User’s gender. Provide get and set methods.
birthday Type: String. User’s birthday. Provide get and set methods.
address Type: String. User’s home address. Provide get and set methods.
remark Type: String. User’s remark. Provide get and set methods.
Type: String. This variable means the time user binds the device. Provide get
deviceBindTime
methods.
35
Android SDK 2.0 API Reference Manual
4. GizWifiSSID Class
4.1. Introduction
SSID info class of the route, includes the signal name SSID and signal strength of the Wi-
Fi.
SSID SSID name: Name could be searched when we connect to a Wi-Fi hotspot.
RSSI Signal strength of the corresponding hotspot. Ranges: 0-100
【getSsid】
Definition public String getSsid()
Get the SSID name of the Wi-Fi. Name could be searched when we connect to
Description
a Wi-Fi hotspot.
Returns SSID name of the Wi-Fi
//mWifiSSID is the SSID class object provided in SDK hotspot list
Sample code
String SSID= mWifiSSID.getSsid();
【getRssi】
Definition public int getRssi()
Description Signal strength of the corresponding hotspot. Ranges: 0-100
Returns SSID name of the Wi-Fi
//mWifiSSID is the SSID class object provided in SDK hotspot list
Sample code
int RSSI= mWifiSSID.getRssi();
36
Android SDK 2.0 API Reference Manual
5.2. Definition
【GizLogPrintLevel】
【GizEventType】
【GizWifiConfigureMode】
37
Android SDK 2.0 API Reference Manual
【GizWifiDeviceType】
Description:device type
【GizThirdAccountType】
【GizWifiDeviceNetStatus】
0 GizDeviceOffline Offline
1 GizDeviceOnline Online
2 GizDeviceControlled Controlled
【GizWifiGAgentType】
38
Android SDK 2.0 API Reference Manual
【GizUserGenderType】
Description:user’s gender
0 GizUserGenderMale Male
1 GizUserGenderFemale Female
2 GizUserGenderUnknown Unknow
【GizWifErrorCode】
Description: error code definition
39
Android SDK 2.0 API Reference Manual
40
Android SDK 2.0 API Reference Manual
41
Android SDK 2.0 API Reference Manual
42
Android SDK 2.0 API Reference Manual
GIZ_OPENAPI_DATAPOINT_DATA_NOT_FOUN
9029 datapoint data not found!
D
9030 GIZ_OPENAPI_SCHEDULER_NOT_FOUND scheduler not found!
9031 GIZ_OPENAPI_QQ_OAUTH_KEY_INVALID qq oauth key invalid!
GIZ_OPENAPI_OTA_SERVICE_OK_BUT_IN_IDL ota upgrade service OK, but
9032
E in idle or disable!
bt firmware unverified,
9033 GIZ_OPENAPI_BT_FIRMWARE_UNVERIFIED
except verify device!
43
Android SDK 2.0 API Reference Manual
44
Android SDK 2.0 API Reference Manual
bind!
permission denied, you are
9093 GIZ_OPENAPI_ONLY_OWNER_CAN_OPERATE
not owner!
GIZ_OPENAPI_SHARING_ALREADY_CANCELL
9094 sharing already canceled!
ED
GIZ_OPENAPI_OWNER_CANNOT_UNBIND_SE
9095 can not unbind self!
LF
GIZ_OPENAPI_ONLY_GUEST_CAN_CHECK_Q permission denied, you are
9096
RCODE not guest!
GIZ_OPENAPI_MESSAGE_ALREADY_DELETE
9098 notify delele binding failed!
D
9099 GIZ_OPENAPI_BINDING_NOTIFY_FAILED notify delele binding failed!
GIZ_OPENAPI_ONLY_SELF_CAN_MODIFY_ALI permission denied, you are
9100
AS not owner or guest!
GIZ_OPENAPI_ONLY_RECEIVER_CAN_MARK_ permission denied, you are
9101
MESSAGE not the receiver!
9999 GIZ_OPENAPI_RESERVED reserved
45