-
Install the Library:
- Install the necessary compiler and build system (e.g., GCC, Clang).
- Set up a development environment (e.g., VirtualBox, Docker).
- Create a new project structure with appropriate folders for headers, code, and include files.
-
Set Up the Development Environment:
- Use the provided makefile for compiling.
- Install the necessary development libraries and headers.
-
Create a New Project:
- Navigate to the project directory and create a new file
__init__.pyto set up the application structure.
- Navigate to the project directory and create a new file
-
Write the Setup Script:
- Include the necessary headers.
- Create a function
setup()that initializes the soft real-time kernel and creates a soft real-time stream. - Handle exceptions and exit codes.
-
Run the Application:
- Use the provided
main.pyscript to compile and run the application. - Use the
main()function to initialize the kernel and stream.
- Use the provided
-
Use the Soft Real-Time Stream:
- Read data from the soft real-time stream using
readSoftRealtimeStreamData. - Write data back to the soft real-time stream using
writeSoftRealtimeStreamData.
- Read data from the soft real-time stream using
Here's a sample main.py file to get started:
import sys
from softEther import initSoftEther, soft_realtime_init, soft_realtime_stream
def main():
try:
# Initialize soft real-time kernel
initSoftEther()
# Create soft real-time stream
soft_realtime_stream = soft_realtime_stream()
# Start the kernel
soft_realtime_init(soft_realtime_stream)
# Read data from stream
data = soft_realtime_stream.readSoftRealtimeStreamData(soft_realtime_stream.buffer)
# Write data to stream
soft_realtime_stream.writeSoftRealtimeStreamData(soft_realtime_stream.buffer, data)
print("Data has been read and written to the soft real-time stream.")
except Exception as e:
print(f"Error: {str(e)}")
sys.exit(1)
if __name__ == "__main__":
main()
Note: Before using SoftEther, ensure you have the correct compiler and build system installed. Also, be cautious with exception handling to avoid crashes.
Further Reading:
Common Issues:
- Ensure the correct compiler and build system are installed.
- Be cautious with exception handling to avoid crashes.
- Optimize performance when dealing with slow systems.









