Is this page helpful?
YesNoLast Updated on : 2022-03-02 03:55:04download
Version | Write/Revision Description | Reviser | Revision date | Remarks |
---|---|---|---|---|
1.0.0 | Created document | Bi Xingjian | 2020-03-05 |
This document mainly introduces Tuya RF test SDK interface functions. In the production test process, the production test tool performs RF test on the module through this SDK and obtains the test result.
https://github.com/TuyaInc/TUYA_PTS_SDK/tree/master/TuyaCloudLib
|-TuyacloudLib
| |-Login
| | |- BouncyCastle.Crypto.dll
| | |-Newtonsoft.Json.dll
| | |-TuyaCloudIfLib.dll
| | |-TuyaCloudIfLib.xml
| | |-RleaseNote.txt
| |-RF production test
| | |-Newtonsoft.Json.dll
| | |-InstrumentRFTest.dll
Interface | Description |
---|---|
UserLogin | Account Login |
SetUrlSftVer | Set the working environment of the graffiti tool |
Interface | Description |
---|---|
InitRFTestEnvironment | RF test environment initialization |
GetStandardfromCloud | Pull standard files from the cloud (Tuya Environment) |
GetLineLossFile | Get line loss file (Tuya PMS environment) |
LineLossCalibration | Gold Machine Calibration Line |
Do_RF_test | RF automated test |
TestEnded | Disconnected Environment |
Function Description (Summary)
This interface is used to select the working environment of the Tuya tool and set the name and version information of the application that calls the SDK. After calling this interface, every time the Tuya network communication interface is called, the name and version information of the application are automatically attached to the calling parameters.
Function prototype
void SetUrlSftVer(string sftVer, string sftIdentity, _LoginUrlType urlType = _LoginUrlType.Release)
Parameters (Parameters)
Parameter name | Description |
---|---|
sftVer | The version number of the software calling the SDK |
sftIdentity | The name of the software calling the SDK |
urlType | Tuya tool working environment, the default is online environment |
Return Values
|Return Value|Description|
|-|-|-|
|None|None|
Notes
The urlType must be _LoginUrlType.Release, otherwise the product authorization may be invalid.
Function Description (Summary)
This interface implements Tuya PMS account login and user authentication. The account and password can be applied by contacting the project manager. Each customer needs to apply for an account and password separately, and different accounts have different scopes of authority and scope of use. Most of the Tuya network communication interfaces require account login before they can be accessed.
Function prototype
UserLoginRspParas UserLogin(UserLoginReqParas ReqParas, string apiVer = "1.0")
Parameters (Parameters)
Parameter name | Description |
---|---|
ReqParas | Account login request parameter, UserLoginReqParas type object |
apiVer | API version, the default is 1.0 |
Return Values
|Return Value|Description|
|-|-|-|
|Object of UserLoginRspParas|Contains login returned success information, and error information, etc.|
Function Description (Summary)
This interface is used to initialize Tuya RF automatic test function in the production test tool. After calling this interface, various environmental parameters will be set and the instrument communication link will be connected.
Function prototype
int InitRFTestEnvironment(InitRFPara initRFPara,ref string errorcode, ref string error)
Parameters (Parameters)
Parameter name | Description |
---|---|
initRFPara | Parameters related to the instrument and the module to be tested |
errorcode | Fault code |
error | Fault description |
Return Values
|Return Value|Description|
|-|-|-|
|int|0 means success, 1 means failure |
|errorcode|Fault code |
|error|Fault description |
Notes
urlType must be _LoginUrlType.Release.
Function Description (Summary)
This interface implements to pull the gold board files and standard files needed for RF testing from Tuya PMS to ensure that the test instrument can perform the test normally.
Function prototype
int GetStandardfromCloud( GetStandardPara para,ref string errorcode, ref string errormsg)
Parameters (Parameters)
Parameter name | Description |
---|---|
para | Pull parameters of cloud standard files and gold plate files, objects of GetStandardPara type |
errorcode | Fault code |
errormsg | Fault Information |
Return Values
|Return Value|Description|
|-|-|-|
|int|0 means success, 1 means failure |
|errorcode|fault code|
|errormsg|Fault Information|
Notes
This interface must be run under the premise of Tuya PMS.
Function Description (Summary)
This interface implements to pull the line loss file of the specified instrument from Tuya PMS to ensure that the instrument compensates for the correct line loss during the RF test.
Function prototype
int GetLineLossFile(GetLineLossFilePara para, ref string errorcode, ref string errormsg)
Parameters (Parameters)
Parameter name | Description |
---|---|
para | Pull parameters of cloud line loss files, objects of type GetLineLossFilePara |
errorcode | Fault code |
errormsg | Fault Information |
Return Values
|Return Value|Description|
|-|-|-|
|int|0 means success, 1 means failure |
|errorcode|fault code|
|errormsg|Fault Information|
Notes
This interface must be run under the premise of Tuya PMS.
Function Description (Summary)
This interface realizes the use of instruments and gold boards to calculate the line loss of the current test environment. And on the premise of Tuya PMS, report the line loss file to Tuya PMS.
Function prototype
int LineLossCalibration(DocablePara docablepara, int ch, string PlatFormName,ref string errorcode, ref string errormsg)
Parameters (Parameters)
Parameter name | Description |
---|---|
docablepara | The parameters required by the test instrument to calculate the line loss, the object of the DocablePara type |
ch | Test channel number, distinguish specific links in multi-channel test |
PlatFormName | Platform name of the chip to be tested |
errorcode | Fault code |
errormsg | Fault Information |
Return Values
|Return Value|Description|
|-|-|-|
|int|0 means success, 1 means failure |
|errorcode|fault code|
|errormsg|Fault Information|
Function Description (Summary)
This interface realizes the use of the instrument to perform RF automated testing on the current module.
Function prototype
int Do_RF_test(Com2RFport portInfo, int ch, string PlatFormName,ref string errorcode, ref string errormsg)
Parameters (Parameters)
Parameter name | Description |
---|---|
portInfo | The mapping information between RF port and serial port, Com2RFport type object |
ch | Test channel number, distinguish specific links in multi-channel test |
PlatFormName | Platform name of the chip to be tested |
errorcode | Fault code |
errormsg | Fault Information |
Return Values
|Return Value|Description|
|-|-|-|
|int|0 means success, 1 means failure |
|errorcode|fault code|
|errormsg|Fault Information|
Function Description (Summary)
This interface realizes the end of the RF test and disconnects the connection with the test instrument.
Function prototype
int TestEnded()
Parameters (Parameters)
Parameter name | Description |
---|---|
None | None |
Return Values
|Return Value|Description|
|-|-|-|
|int|0 means success, 1 means failure |
enum _LoginUrlType
{
Release = 0, //Online environment, default
Preview = 1, //Pre-release environment
Daily = 2 //Daily environment
}
public class UserLoginReqParas
{
public string username; //User name, required
public string password; //Password, required
public string token; //token, not required
}
public class PermissionsData
{
public string permissionCode; // Login permission code
public string permissionName; // login permission name
}
public class UserLoginResult
{
public string sessionId; // login session id
public List<PermissionsData> permissions; // Login permission data list
}
public class UserLoginRspParas{
public bool success; //Interface execution result, success is true, failure is false
public string errorMsg; // error message
public string errorCode; //error code
public string status; // Operation status, including some specific error information or status
public long t; //Interface call time
public UserLoginResult result; // Account login return result
}
public struct InitRFPara
{
/// <summary>
/// RF test mode IQ or Itest
/// </summary>
public RFTestMode SelectedTestMode;
/// <summary>
///Instrument SN
/// </summary>
public string InstrumentSN;
/// <summary>
/// Cloud address setting
/// </summary>
public string loginurltmp;
/// <summary>
/// Software version
/// </summary>
public string sftversiontmp;
/// <summary>
/// Chip platform
/// </summary>
public string ChipPlatform;
/// <summary>
/// Whether to connect Tuya PMS
/// </summary>
public bool IsCloud;
/// <summary>
/// IP of the ultimate instrument
/// </summary>
public string InstrumentIP;
/// <summary>
/// Native IP
/// </summary>
public string LocalIP;
/// <summary>
/// The port of the TCP server
/// </summary>
public string ItestTCPServerPort;
/// <summary>
/// The extreme instrument COM ->RF port ->TCP client port list
/// </summary>
public List<ItestPortMap> ItestPortMapList;
/// <summary>
/// The initial RF port of the ultimate instrument
/// </summary>
public string ItestOrginRFPort;
}
Notes
①When IsCloud is true, SelectedTestMode, InstrumentSN, loginurltmp, sftversiontmp, ChipPlatform required, InstrumentIP, LocalIP, ItestTCPServerPort, ItestPortMapList, ItestOrginRFPort is optional according to whether SelectedTestMode is Itest.
②When IsCloud is false, SelectedTestMode, InstrumentSN, ChipPlatform are required, InstrumentIP, LocalIP, ItestTCPServerPort, ItestPortMapList, ItestOrginRFPort is optional according to whether SelectedTestMode is Itest.
public enum RFTestMode
{
IQ, // IQ
Itest, //The ultimate instrument
ESP //Espressif
}
public class ItestPortMap
{
/// <summary>
/// Serial port number
/// </summary>
public string COMnum {get; set;}
/// <summary>
/// RF port
/// </summary>
public string RFport {get; set;}
/// <summary>
/// TCP client communication port
/// </summary>
public string TCPport {get; set;}
}
public struct GetStandardPara
{
public string ProductModel; //Product model
public string GoldPlateSN;//Gold plate number
public string InstrumentSN;//Instrument SN
public string Equipment;//Test instrument
public string ChipPlatform;//The chip platform corresponding to the instrument vendor
}
public struct GetLineLossFilePara
{
public string ProductModel; //Product model
public string GoldPlateSN;//Gold plate number
public string InstrumentSN;//Instrument SN
public int RFport;//The corresponding chip platform of the instrument manufacturer
}
public struct DocablePara
{
public string Comname; //Serial port name
public string RFport;//Instrument RF port
public string GoldPlateSN;//Gold plate number
public string InstrumentSN;//Instrument SN
public string ProductModel;//Product type
}
public struct Com2RFport
{
public string Comname;//Serial port name
public string RFport;//RF port name
}
The execution of the instrument RF test SDK is divided into the process of connecting Tuya PMS and the process of not connecting Tuya PMS. The Lianyun process refers to the connection of Tuya PMS for RF testing. This process is mainly used for factory automation production testing. The cloud-free process means that the Tuya PMS is not connected for RF testing. The process is relatively simple and has a large degree of freedom.
Steps of Lianyun process:
① Upload the parameter information of the RF test on the cloud. Product model, responsible person, version, test equipment, maintenance time, gold plate number, line loss max value, etc.
②Log in to the Tuya account password to obtain the permission to interact with the cloud.
③ Connect the instrument to test.
④After the gold plate is calibrated, the newly generated line loss file will be uploaded back to the cloud; after the RF test is completed, the test log information will be uploaded back to the cloud.
The specific test process is shown in the figure below:
Process steps without cloud connection:
① Modify and save the configuration parameters in the local interface file.
②Connect the instrument to test.
③The test results will be saved in the local log folder.
The specific test steps are as follows:
The implementation of the instrument RF test SDK is divided into a cloud process and a cloudless process. Cloud process refers to connecting Tuya PMS for RF testing. This process is mainly used in factory automation production testing. The cloudless process refers to not connecting to Tuya PMS for RF testing. The process is relatively simple and has a large degree of freedom. Tuya modules currently supported by this SDK include: WB1S, WB2L, WB2S, WB3L, WB3S, WBLC5, TYLC4, TYWE3L, TYWE3S, TYWE5P, TYWRD1S, TYWRD2S, TYWRD3S, WR1, WR1E, WR2, WR2E, WR3, WR3E, WR4, WR6, TYWRD1S, WRD2L, WRD3L, WRD8P, RDLC5, WRG1.
Is this page helpful?
YesNoIs this page helpful?
YesNo