Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding a new type of Channel #16

Closed
ajaywazir opened this issue Jul 10, 2024 · 4 comments
Closed

Adding a new type of Channel #16

ajaywazir opened this issue Jul 10, 2024 · 4 comments

Comments

@ajaywazir
Copy link

Hi,
How to add a new type of channel. I call as FileSystem Channel, that works like TCP or UDP channel but does not make any active connections.
I have implemented the Constant value plugin that reads data from CSV file, but I am forced to use a TCP type connector and I cannot seem to use a Blank (Other) type channel.
Do you have any suggestions?
I added the following file to ThingsGateway.Foundation.csproj but it does not appear in my Channel options.
FileSystemSession.zip

Regards
Ajay

@kimdiego2098
Copy link
Owner

通道类型选择other,区别是插件init方法中传入的channel参数为null,这不影响你的实现目的

@ajaywazir
Copy link
Author

Thanks. Let me try

@ajaywazir
Copy link
Author

In this case, there will be only a one time read at loading time.
If I use a dummy TCP channel as a channel that enables periodic read and write, I am able to have more interaction with variables.
How can we achieve this with a dummy (other) type channel?
How to add a new type of channel with no connectivity but timer based read and write

@kimdiego2098
Copy link
Owner

1、public override Init

In this method, initialize the connections you need, such as CSV file paths, encapsulated objects, etc. This method will only be executed once during the plugin lifecycle

2、protected override ProtectedExecuteAsync

In this method, perform the read operation you need, and the method will execute infinitely (serially) throughout its lifecycle. Please note that the interval between each execution is the minimum interval (default is 10ms)

3、example

Check the non subscription mode in the OPCUAMaster plugin, this is the same operation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants