Use the configuration file to generate the specified logic plug-in.
This tool can help you generate specific logic plug-ins.
You can refer to the sample configuration file.
PSS_PLUGIN_LOGIC_MAKER\Build\plugin_maker.json
- how to create logic plugin
- how to create user class
- how to create logic command
- how to use maked logic plugin
"plugin project name": "example_logic",
"plugin project path": "../../Module_Logic/",
Add the plugin name and the path generated by the plugin here.
"plugin class": [
{
"message type": "Message Input",
"class name": "Crecv_sample",
"class type": [
{
"name": "message_version_",
"type": "uint16"
},
{
"name": "message_command_id_",
"type": "uint16"
},
{
"name": "message_length_",
"type": "uint32"
},
{
"name": "message_session_",
"type": "string",
"buffer_length": 32
},
{
"name": "message_data_",
"type": "string",
"buffer_length": 200
}
]
},
{
"message type": "Message Output",
"class name": "Csend_sample",
"class type": [
{
"name": "message_version_",
"type": "uint16"
},
{
"name": "message_command_id_",
"type": "uint16"
},
{
"name": "message_length_",
"type": "uint32"
},
{
"name": "message_session_",
"type": "string"
},
{
"name": "message_data_",
"type": "string"
}
]
}
],
You can customize your message receiving class or sending class here.
When the plug-in receives the specified message, it will deserialize the specified message into a modified class.
Similarly, when there is a message to be sent, this class will transfer the data Format the message to be sent.
You can create multiple such receiving and dispatching classes according to your needs to receive and dispatch the corresponding messages.
"Message Input" is recv message.
"Message Output" is send message.
"message map": [
{
"command macro": "LOGIC_COMMAND_CONNECT",
"command id": "",
"command function": "logic_connect",
"message in": "",
"message out": ""
},
{
"command macro": "LOGIC_COMMAND_DISCONNECT",
"command id": "",
"command function": "logic_disconnect",
"message in": "",
"message out": ""
},
{
"command macro": "COMMAND_TEST_SYNC",
"command id": "0x2101",
"command function": "logic_test_sync",
"message in": "Crecv_sample",
"message out": "Csend_sample"
},
{
"command macro": "COMMAND_TEST_ASYN",
"command id": "0x2102",
"command function": "logic_test_asyn",
"message in": "Crecv_sample",
"message out": ""
}
],
Here, you specify the message command you need to process, and bind the corresponding message sending and receiving class.
Of course, if you want to build a method that only sends data, you can declare it in the following form.
"asynchronous send interface": [
{
"message out": "Csend_sample"
}
]
you can add logic at Cexample_logic_do_message.cpp.