Quick Start¶
Port operates by reflecting messages in the most recently updated repository. Try creating and editing a basic project to see how you can modify and configure projects. Follow along to understand the process better.
How to create a port-project¶
Before starting a Port project, you need to create a root folder that defines your messages. The subfolders within this root folder are managed as groups by Port, allowing users to organize messages by group. The root folder contains files with the *.enum
extension and the structure of sub-group folders. Within the sub-group folders, message definition documents with the *.msg
extension are created.
Here's an example
¶
Project Layouts¶
sample/
│
├── room1/
│ ├── *.msg
│
├── room2/
│ ├── *.msg
│
└── *.enum
How to add messages¶
To declare a message, you need to edit the *.msg
file in the sub-folder you created. By defining message data types and attributes as shown below, you can later utilize various features such as automatic logging and backup. Additionally, you can define relationships using predefined relations.
Sample message files¶
BulbOnOff enum.OffOn pkg:Blub1.OffOn
RoomTemp1 num pkg:Heater1.Temp property:{"MIN":0,"MAX":300,"Arguments":"C"}
RoomTemp2 num pkg:Heater1.Temp property:{"MIN":0,"MAX":300,"Arguments":"F"}
How to add rules¶
To declare a rule, you need to edit the *.rule
file in the sub-folder you created. The rule script can control whether the user can modify settings through the setable function. The first parameter is the condition that triggers the rule, and the second parameter is the condition that determines whether the setting is modifiable. When the user changes the message value, the function is automatically called to check these conditions.
Setable script structure:¶
setable([group.message-name]|[operator]|[set-value]
,[script]
)
Sample rule files¶
setable("room1.BulbOnOff==Off","(room1.RoomTemp1>=20)&&(room2.RoomTemp2>=20)")
setable("room1.RoomTemp2>=30","room2.RoomTemp2>=5")
How to link packages¶
Check packages¶
Add packages¶
move directory¶
Add the package to the current project under the name "bulb1"¶
Add the package to the current project under the name "bulb2"¶
Add the package to the current project under the name "heater1"¶
Add the package to the current project under the name "heater2"¶
Tip
If you see a message like [ERROR][open ..\proj.toml: Access is denied.]
granting administrator privileges to the port.exe program will resolve the issue.
After linking the relations to your project, you can verify the integration using the following command
How to start project¶
Once all message definitions are complete, you can start the message server based on these definitions. Before running the server, upload all updated content to the local repository by entering port push
in the console. Then, run the server with the command port run [project-name]
.
Tip
When running the server, if you include --ng ignore
in the command, it will summarize only the points where errors (NG) occur. For detailed information on these NG points, you can visit the following URL to view the NG point table: