Teach pendant development static library
Development static library function introduction
It provides complete teach pendant functions, supports adding user-defined interfaces, and supports communication between the teach pendant and the controller through specific fields.
Static library directory structure
"NextpLib" is the main folder
The "include" folder contains header files
The "Library" folder contains static library files for the Linux platform, ARM platform (only applicable for iNexBot T30 teach pendant), and Windows platform.
nrc2.out in the controller program folder is the controller program matching the current demo program.
Static library structure description
All development interfaces are described in the nextp.h header file
- nextp.h header file interface description:
//Create a Nextp class object
static QPointer<Nextp> getInstance();
//Get system font
QString getSystemFont();
//Transfer user-defined form to the main program
void setWidgetParentLocation(QPointer <QWidget> widget);
//Send message to controller
void sendMessage(const quint16 &command,const QByteArray &data);
//Notify the teach program that a custom form has been opened
widgetShowFinish()
//Signal to receive controller messages
void signal_receiveMessage(const quint16 &command,const QByteArray &data);
//Signal to open a custom form
void signal_openWidget();
//Signal to close a custom form
void signal_closeWidget();
//Hide other buttons in the process main interface except the custom buttons
void hideTechnologyToolbuttons();
//The command words in the static library that support the communication between the teach pendant and the controller
enum CommandList
{
SetFirstUserParaCommand = 0x9200,
GetFirstUserCommand = 0x9201,
ReceivedFirstUserCommand = 0x9202,
SetSecondUserParaCommand = 0x9203,
GetSecondUserCommand = 0x9204,
ReceivedSecondUserCommand = 0x9205,
SetThirdUserParaCommand = 0x9206,
GetThirdUserCommand = 0x9207,
ReceivedThirdUserCommand = 0x92,
ReceivedThirdUserCommand = 0x9208,
SetFourthUserParaCommand = 0x9209,
GetFourthUserCommand = 0x920a,
ReceivedFourthUserCommand = 0x920b,
SetFifthUserParaCommand = 0x920c,
GetFifthUserCommand = 0x920d,
ReceivedFifthUserCommand = 0x920e,
};
- The json/json.h header file provides assembly and parsing of the JSON data format
2.1 Example of JSON data assembly:
Json::Value root;
Json::FastWriter wt;
root["robot"] =1;
root["booldata"] =true;
root["data"] = 1.1;
root["name"] =”nihao”;
2.2 Example of JSON data parsing:
QByteArray jsonData //Data sent by the controller
Json::Value root;
Json::Reader reader;
QString jsonData = param.data();
if(reader.parse(jsonData.toStdString(), root))
{
int robot = root["robot"].asInt();
bool booldata= root["booldata"].asBool();
Int data= root["data"].asDouble();
Std::string name = root["name "].asString();
}
- digitallineedit.h provides a digital input box
It supports promoting the QLineEdit control to a digital input box Promotion method: right-click to select a QLineEdit control --->Promote to --->DigitalLineEdit (as shown below)
In the tree structure on the right, you can see that the Classes property of the control has changed to DigitLineEdit (as shown below)
After the program runs, the control effect is that clicking on the control will pop up a numeric keypad (as shown below):
- Lineeditwidget.h provides an alphanumeric input box
It supports promoting the QLineEdit control to an alphanumeric input box Promotion method: right-click to select a QLineEdit control --->Promote to --->LineEditWidget (as shown below)
In the tree structure on the right, you can see that the Classes property of the control has changed to LineEditWidget (as shown below)
After the program runs, the control effect is that clicking on the control will pop up an alphanumeric keypad (as shown below):