Skip to content
On this page

1 Overview

The Near-End Debugging SDK is a developer tool that integrates the near-end debugging function of Solis inverter. The SDK provides the near-end connection and control functions of all models of Solis inverter that support Bluetooth modules, and also supports multi-language switching. The SDK implements online function updates, and developers can complete the update of internal functions without frequently updating the SDK. The SDK provides an easy-to-use, stable, and unified interface for developers to call, and developers can implement Bluetooth near-end debugging related functions according to their own services.

2****Android Bluetooth SDK Integration

2.1 SDK Access

2.1.1 Development Environment

  • Android Studio 3.0 or above

  • Android minSdkVersion:21

  • Gradle:4.4 or above

2.1.2 Configuration Information

Step1: Contact the official website of Solis to obtain the corresponding aar package for the SDK.

Step2: Copy the aar package to the project engineering app/lib directory.

Step3: Add SDK component dependencies in the app/build. gradle file, as shown in the following figure.

2.1.3 Initialization

Initialize the Bluetooth SDK in onCreate () of the custom Application class, as shown in the following figure

dependencies

  • AppKey (required): The key obtained by the SDK caller on the Ginlong Cloud platform

  • Language (optional): Use the enumeration type GlLanguage, which defaults to English. Currently supported languages include (corresponding enumerations in parentheses): Chinese(CHINESE), English(ENGLISH), Spain(SPAIN), Poland(POLAND), German(GERMAN), French(FRENCH), Korean(KOREAN), Dutch(DUTCH), Portugal(PORTUGAL), Italian(ITALIAN), Ukrainian(UKRAINIAN), Swedish(SWEDISH), Vietnamese(VIETNAMESE), Thai(THAI), Urdu(URDU), Arabic(ARABIC), Turkish(TURKISH), Czech(CZECH), Bosnian(BOSNIAN).

  • Theme color (optional): The hexadecimal value of RGB must be passed in.

class GlBleApp: Application() {
    override fun onCreate() {
        super.onCreate()
        // Initialize SDK
        GlConfig.ConfigBuilder()
            .setAppKey("xxx") // set appKey
            .setApiKey("xxx") // set apiKey
            .setApiSecret("xxx") // set apiSecret
            .setLanguage(GlLanguage.CHINESE) // set sdk language
            .setMainColor("#FFFFFF") // default color is white
            .init(this)
    }
}
public class TestApp extends Application {
    @Override
    public void onCreate() {
        super.onCreate();
        new GlConfig.ConfigBuilder()
                .setAppKey("xxx")
                .setApiKey("xxx")
                .setApiSecret("xxx")
                .setLanguage(GlLanguage.CHINESE)
                .setMainColor("#FFFFFF")
                .init(this);
    }
}

2.1.4 Sensitive permission access

Currently, most Android phones on the market are Android 6.0 or above, so before entering the Bluetooth device scanning page, you must apply for the following sensitive permissions required for Bluetooth operation:

permissionsuse
ACCESS_FINE_LOCATIONTo use Bluetooth, you need to apply for this permission
BLUETOOTH_SCANNew permission added in Android 12, required for scanning Bluetooth
BLUETOOTH_CONNECTNew permission added in Android 12, required to connect to Bluetooth

General Permissions:

permissionsuse
INTERNETInternet permissions are allowed
ACCESS_INTERNET_STATEProvide information about the network
BLUETOOTHBluetooth permissions
BLUETOOTH_ADMINDiscover local Bluetooth device permissions for use with Bluetooth

2.1.5 Enter the Bluetooth scanning page

After applying for permission, you can jump to the Bluetooth device scanning page with the page name:BleConnectActivity。

2.1.6 Successfully connected screenshot

If you can see the name of the Bluetooth device that needs to be connected on the Bluetooth device scan page (as shown in the following figure), you have fully integrated the Bluetooth Near End SDK.

distributionNetwork

2.2 API usage

2.2.1 Set Key

The key obtained by the SDK caller on the Solis Cloud platform, and the calling method:

.setAppKey(“XXX”)

2.2.2 Set color

Theme color (optional): The hexadecimal value of RGB must be passed in.

setMainColor(“#FFFFFF”)

Button color setting (optional): The hexadecimal value of RGB must be passed in.

.setBtnColor(“#FFFFFF”)

2.2.3 Set language

Currently supported languages include (corresponding enumerations in parentheses): Chinese(CHINESE), English(ENGLISH), Spain(SPAIN), Poland(POLAND), German(GERMAN), French(FRENCH), Korean(KOREAN), Dutch(DUTCH), Portugal(PORTUGAL), Italian(ITALIAN), Ukrainian(UKRAINIAN), Swedish(SWEDISH), Vietnamese(VIETNAMESE), Thai(THAI), Urdu(URDU), Arabic(ARABIC), Turkish(TURKISH), Czech(CZECH), Bosnian(BOSNIAN).

2.2.4 Set ApiKey and ApiSecret

Collector configures network must set apiKey,apiSecret,adapterType

.setApiKey("xxx") //xxx fill in the official API key provided
.setApiSecret("xxx") //xxx fill in the official API Secret provided
.setAdapterType("1") // This option must be set for configuring the network. If not set, it will default to the collector details page
new GlConfig
.ConfigBuilder()
.setAppKey("xxx")
.setLanguage(GlLanguage.CHINESE)
.setMainColor("#FFFFFF")
.setApiKey("xxx")
.setApiSecret("xxx")
.setAdapterType("1")
.init(this);`

2.2.5 Acquisition and clearing of collector configures network SN number obtain SN:

  • anywhere acquisition
new GlConfig.ConfigBuilder().getCollSn();
GlConfig.ConfigBuilder().getCollSn()
  • Initialize callback acquisition
GlConfig.ConfigBuilder()
  .setAppKey("xxx") // set appKey
  .setApiKey("xxx") // set apiKey
  .setApiSecret("xxx") // set apiSecret
  .setLanguage(GlLanguage.CHINESE) // set sdk language
  .setMainColor("#FFFFFF") // default color is white
  .setAdapterType("1")
  .setSnCallback(object : GlConfig.ConfigBuilder.SnCallback {
  override fun onReceiveSn(
    sn: String?, // SN number returned after network distribution is completed
    finishAllBlock: () -> Unit // Destroy all pages. When you need to destroy them, call finishAllBlock.invoke() directly.
) {

  }
})
.init(this)

If you call finishAllBlock.invoke() in the callback, all SDK pages will be destroyed after the network configuration is successful, and if you don't call finishAllBlock.invoke(), you will return to the "Nearby Devices" page. By default, you will return to the Nearby Devices page.

new GlConfig.ConfigBuilder().clearSn()

2.2.6 Bluetooth configurate network (default off)

.setAdapterType("1") // This option must be set for configuring the network. If not set, it will default to the collector details page

2.2.7 Running environment settings (default international environment)

Enumeration types used: GlRunEnv.SDK_RUN_ENV_INTERNATION (international environment), GlRunEnv.SDK_RUN_ENV_DOMESTIC (domestic environment)

2.3 Bluetooth Config Instruction

Step1: Open Bluetooth list.

step1.png

Step2: Enter the configure network page.

step2.png

Step3: Click Configuration.

step3.png

Step4: Configuration complete.

step4.png

2.4 Precautions

  • It needs to be run on a real machine, and errors may occur when compiling using the simulator.

  • It is necessary to declare the corresponding privacy permission usage instructions in the APP privacy agreement.

3** IOS Bluetooth SDK Integration**

3.1 SDK integration

3.1.1 Development environment

  • IOS 12.0 or above

  • Xcode 11.0 or higher (recommended to use the latest version)

3.1.2 Configuration Information

  1. SDK access
  • Contact the official website of Ginlong to obtain the latest Release version

  • Add Near Tool SDK. framework to your Xcode project

  1. Configuration of Link Binary With Libraries

TARGETS->Build Phases-> Link Binary With Libaries

configuration.png

Ensure that NearToolSDK.framework is added to Link Binary With Libraries and the option Status is set to Required.

  1. Resource file bundle configuration

Integrate the LocalOperation.bundle resource file into your project, making sure it's in the same directory as the NearToolSDK.

Resource.png

3.1.3 Permission configuration

IOS must first allow localization when using Bluetooth, so localization needs to be enabled. The use of Bluetooth requires the user's consent in order to use the permission to add location requests and Bluetooth requests in the engineering info.plist file.

Location permissions
Privacy - Location When In Use Usage Description 

Bluetooth permissions
Privacy - Bluetooth Peripheral Usage Description

When IOS uses Bluetooth for network pairing, it is necessary to get WiFi information. This requires the developer to check Access Wi-Fi Information when configuring the certificate.

permission.png

In the Xcode project, add Access Wi-Fi Information to Capacity.

permission2.png

3.1.4 Initialize & load view

Step1: Introduction of header files

Introducing in controllers that require SDK calls #import <NearToolSDK/NearToolSDK.h>

Step2: Load view

NearToolHomeViewController *vc = [[NearToolHomeViewController alloc] init];
//push show
// [self.navigationController pushViewController:vc animated:YES];
//present show
[self presentViewController:vc animated:YES completion:nil];

Step3: Screenshot of successful access

initializeStep3.png

3.2 API usage

3.2.1 Set Key

homeVC.appKey = @"xxxxxx";

3.2.2 Set APIKey/APISecret

homeVC.apiKey = @"xxxxxx";
homeVC.apiSecret = @"xxxxxx";

3.2.3 Set language

/*
NearToolLanguageTypeCN          =  1,   ///<中文
NearToolLanguageTypeEN          =  2,   ///<English
NearToolLanguageTypeES          =  3,   ///<Español
NearToolLanguageTypePL          =  4,   ///<Polski
NearToolLanguageTypeDE          =  5,   ///<Deutsch
NearToolLanguageTypeFR          =  6,   ///<Français
NearToolLanguageTypeKO          =  7,   ///<한국어
NearToolLanguageTypeNL          =  8,   ///<Nederlands
NearToolLanguageTypePT          =  9,   ///<Português
NearToolLanguageTypeIT          =  10,  ///<Italiano
NearToolLanguageTypeUK          =  11,  ///<Українська
NearToolLanguageTypeSV          =  12,  ///<Svenska
NearToolLanguageTypeVI          =  13,  ///<Tiếng Việt
NearToolLanguageTypeTH          =  14,  ///<ภาษาไทย
NearToolLanguageTypeUR          =  15,  ///<اللغة العربية
NearToolLanguageTypeAR          =  16,  ///<اردو
NearToolLanguageTypeTR          =  17,  ///<Türkçe
NearToolLanguageTypeCS          =  18,  ///<čeština
NearToolLanguageTypeBS          =  19,  ///<bosanski
 */
homeVC.languageTypeType = NearToolLanguageTypeCN;

3.2.4 Set color

// Configure Theme Colors
homeVC.mainColor = [UIColor colorWithRed:240/255.0f green:133/255.0f blue:25/255.0f alpha:1.0];
// Configure button colors
homeVC.btnColor = [UIColor colorWithRed:240/255.0f green:133/255.0f blue:25/255.0f alpha:1.0];

3.2.5 Operating environment (default international environment)

// Running environment (default international version)
/\*
 NearToolTargetInternational  international
 NearToolTargetDomestic       domestic
 \*/
homeVC.target = NearToolTargetInternational;

3.2.6 Bluetooth configures

Connect the collector to Bluetooth and directly access the configuration network function.

/// adapterType Whether to force turn on configuring the  network 1 to be turned on and 0 to be turned off (default off)
//Set the parameters
homeVC.adapterType=@"1" // This parameter must be set for network configure, otherwise the collector details page will be entered by default

Callback for successful network configuration (parameter: device SN)

/// After the network configuration is completed, the return is accompanied by SN
@property (copy, nonatomic) void(^popSnBlock)(NSString \*sn);
/// Declaring a successful callback
homeVC.popSnBlock = ^(NSString \* \_Nonnull sn) {
// After the network configuration is completed, the return is accompanied by SN

};

3.3 Operations

Step1: Open Bluetooth list.

operationsStep1.png

Step2: Enter the configure network page.

operationsStep2.png

Step3: Click Configuration.

operationsStep3.png

Step4: Configuration complete.

operationsStep4.png

3.4 Precautions

  • It needs to be run on a real machine, and errors may occur when compiling using the simulator.

  • It is necessary to declare the corresponding privacy permission usage instructions in the APP privacy agreement.

锦浪云平台