In order to facilitate our customers to tap into overseas markets and better offer the convenience brought by Gizwits IoT Cloud to developers, Gizwits provides standalone deployment abroad to reduce network delay for the devices sold abroad due to the great geographic distance to China and achieve a better interactive experience.
Currently, Gizwits overseas deployment nodes are distributed in the eastern United States and central Europe (Frankfurt), where AWS cloud computing services are used. As shown below:
For the response speed report of each node, please refer to the Gizwits Global Network Report (this document mainly introduces the global deployment solution of Gizwits to developers).
Currently the modules that support global deployment are as follows:
The firmware versions in the above figure and the newer ones running on Wi-Fi modules can employ the global deployment solution, however, it is recommended to use the latest version of the firmware to develop globally dispersed devices.
If you are unable to confirm whether the module’s firmware supports global deployment or not, consult Gizwits FAE for more information.
The Gizwits App SDKs in the following figure and the newer ones support global deployment.
For the global deployment, you need to contact Gizwits technical support team to provide the corresponding information for the product as follows.
Setting Sample
Product name
Product Key d187f9……
Android APPID 943d59……
iOS APPID 000593……
Your account name Myemail@xxx.com
Get Product Name and Product Key as shown below:
Get Android and iOS APPID as shown below:
To support global deployment, your devices need to run a supported firmware. In addition, the device MCU needs to reply its Product Secret per the protocol “3.1 Obtaining Device Information”, which is as follows:
The product key required in the above figure is obtained as follows:
The App development for the global deployment has two schemes:
Let’s first introduce the App startup function used in Scheme 1.
Startup function:
1 | public void startWithAppID(Context context, String appID, String appSecret, List<String> |
Parameters:
Parameter | Description |
---|---|
context | Context object |
appID | The product appID. Get it in the Developer Center. |
appSecret | The appSecret for APPID. Get it in the Developer Center. |
specialProductKeys | The productKey list of products to be filtered, string array. This parameter is required and cannot be set to NULL to enable global deployment. |
cloudServiceInfo | The domain information of server to be used. The default value of this parameter is null, and the Gizwits App SDK will set the domain name of the Gizwits IoT Cloud for the App according to the geographic location of the user’s mobile phone. If you want to use the domain name of a private cloud service, provide information in the format: {“openAPIInfo”: “xxx”, “siteInfo”: “xxx”, “pushInfo”: “xxx” }, where openAPIInfo and siteInfo are required, and pushInfo is optional. If the port numbers are not provided, the Gizwits App SDK will use the default service ports. In this case, write the domain name like this: api.gizwits.com. If you specify a port, you need to specify both the HTTP and HTTPS ports. In this case, write the domain name like this: api.gizwits.com:81&8443 |
autoSetDeviceDomain | Whether to enable the automatic setting of the device domain name. The default value of this parameter is false, that is, the automatic setting is disabled. If the parameter value is true, the automatic setting of the device domain name is enabled. In this case, the device in Micro Cycle will be connected to the cloud service currently used by the App. |
Note: There is no relation between cloudServiceInfo and autoSetDeviceDomain. When autoSetDeviceDomain is set to true, after the Gizwits App SDK is started, the App needs to connect to the Internet, so that the Gizwits App SDK can visit the cloud to obtain the relationship between the APPID of the current App and the ProudctKey list. The App only has permission to modify the domain name of a device when the device ProductKey is associated with the App APPID. Therefore, when the App needs to support global deployment, the ProudctKey parameter is required, which is used by the Gizwits App SDK to check the association between the APPID and the ProductKey.
The right moment for the App to change the device domain name
When the device and App are connected to the same LAN and the App finds that the domain name of the device is different from that of the App, the App will send its domain name information to the device through TCP to tell the device to update.
Startup function:
1 | +(void)startWithAppID:(NSString*)appID appSecret:(NSString*)appSecret specialProductKeys:(NSArray*)specialProductKeys cloudServiceInfo:(NSDictionary *)cloudSeviceInfo autoSetDeviceDomain:(BOOL)autoSetDeviceDomain; |
Parameter | Description |
---|---|
appID | The product appID. Get it in the Developer Center. |
appSecret | The appSecret for APPID. Get it in the Developer Center. |
specialProductKeys | The productKey list of products to be filtered, NSString array. This parameter is required and cannot be set to nil to enable global deployment. |
cloudServiceInfo | The domain information of server to be used. The default value of this parameter is null, and the Gizwits App SDK will set the domain name of the Gizwits IoT Cloud for the App according to the geographic location of the user’s mobile phone. If you want to use the domain name of a private cloud service, provide information in the format: { “openAPIInfo”: “xxx”, “siteInfo”: “xxx”, “pushInfo”: “xxx”}, where openAPIInfo and siteInfo are required, and pushInfo is optional. If the port numbers are not provided, the Gizwits App SDK will use the default service ports. In this case, write the domain name like this: api.gizwits.com. If you specify a port, you need to specify both the HTTP and HTTPS ports. In this case, write the domain name like this: api.gizwits.com:81&8443 |
autoSetDeviceDomain | Whether to enable the automatic setting of the device domain name. The default value of this parameter is false, that is, the automatic setting is disabled. If the parameter value is true, the automatic setting of the device domain name is enabled. In this case, the device in Micro Cycle will be connected to the cloud service currently used by the App. |
The cloudServiceInfo and autoSetDeviceDomain of iOS App are the same as the ones of Android App.
Scheme 1 allows the Gizwits App SDK to automatically change the connected server domain name according to the time zone. The startup function is invoked as follows:
For Android App:
1 | GizWifiSDK.sharedInstance().startWithAppID(this, AppID, AppSecret, ProductKeyList(), null, true); |
For iOS App:
1 | [GizWifiSDK startWithAppID:APPID appSecret:APPSECRET specialProductKeys: ProductKeyList cloudServiceInfo:nil autoSetDeviceDomain:YES]; |
Scheme 2 offers three App editions based on the deployment regions of Gizwits.
There are three major deployment regions of Gizwits: China, US East and European.
Similarly, The App is also has three editions corresponding to these three major regions respectively: China Edition, US East Edition and European Edition.
These three App editions are the same except for the startup function. Take iOS App as an example:
Startup function of China Edition:
1 | [GizWifiSDK startWithAppID:APP_ID appSecret:APP_SECRET specialProductKeys:[GosCommon sharedInstance].productKey cloudServiceInfo:@{@"openAPIInfo" : @"api.gizwits.com" , @"siteInfo": @"site.gizwits.com", @"pushInfo": @"push.gizwitsapi.com"} autoSetDeviceDomain:YES]; |
Startup function of US East Edition:
1 | [GizWifiSDK startWithAppID:APP_ID appSecret:APP_SECRET specialProductKeys:[GosCommon sharedInstance].productKey cloudServiceInfo:@{@"openAPIInfo" : @"usapi.gizwits.com" , @"siteInfo": @"ussite.gizwits.com", @"pushInfo": @"us.push.gizwitsapi.com"} autoSetDeviceDomain:YES]; |
Startup function of European Edition:
1 | [GizWifiSDK startWithAppID:APP_ID appSecret:APP_SECRET specialProductKeys:[GosCommon sharedInstance].productKey cloudServiceInfo:@{@"openAPIInfo" : @"euapi.gizwits.com" , @"siteInfo": @"eusite.gizwits.com", @"pushInfo": @" eupush.gizwits.com |
After Gizwits synchronizes the configuration information of the product on the domestic and overseas servers, you need to log in to the overseas editions of Gizwits Developer Center with the same user account to find the corresponding product, and request to use D3 Engine, then create the same rules as the ones in the domestic edition of Gizwits Developer Center.
Overseas editions of Gizwits Developer Center:
Europe: http://eusite.gizwits.com/en-us/developer/
US East: http://ussite.gizwits.com/zh-cn/developer/
Answer: Use the Gizwits App SDK version released after August 14, 2017, that is, the SDK version starting from 2.07.07.2, which has added the device domain change restriction.
Restriction description: After the Gizwits App SDK is started, the App needs to connect to the Internet, so that the Gizwits App SDK can visit the cloud to obtain the relationship between the APPID of the current App and the ProudctKey list. The App only has permission to modify the domain name of a device when the device ProductKey is associated with the App APPID.
a. Confirm whether the ProductKey parameter of the startup interface is passed and its value should not be empty.
b. Confirm whether the App can connect to the Internet, because the Gizwits App SDK starting from version 2.07.07.2 needs to visit the cloud to confirm the association between APPID and Productkey to change the device domain name.
c. Visit the Gizwits Developer Center to check if the APPID is associated with ProductKey.
Check whether there are several Apps which have permission to set the device domain name in the same LAN, and these Apps connected to different servers.
When testing devices deployed globally, Apps in the same LAN must be connected to the same server. Otherwise, several Apps will switch the server which the device is connected to, thus the problem arises.
Confirm which server of Gizwits the App was connected to when you sign up for the user account before, and which server of Gizwits the App is connected to when the error occurs. The reason is that the above two servers are not identical. It will work normally after the App switches to the original server to reconnect again.