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

Serial Port on MAUI(Android) #10

Open
rivenww opened this issue Jul 31, 2023 · 2 comments
Open

Serial Port on MAUI(Android) #10

rivenww opened this issue Jul 31, 2023 · 2 comments
Labels
enhancement New feature or request

Comments

@rivenww
Copy link

rivenww commented Jul 31, 2023

Well, I am interested in this repo and I found this repo because I'm investigating a way to communicate with a PLC on android device.

Actually, it might work well on MAUI for Android as I made a demo to do some simple operations.

Now I am learning how to implement a serial version for this repo, but for Android it usually use Android USB Host Mode (OTG) to communicate with a device via Serial port.

So my question is, is it possible to implement it with a cross platform way? Cuz for IOS or some other CLR there may be no same API as on Windows or Android.

@rivenww
Copy link
Author

rivenww commented Aug 1, 2023

I roughly read the code of this project, and I think I can implement a serial communication class for Android devices based on the MewtocolInterface class.

This class will not use the System.IO.Ports namespace in order to allow it to run on Android devices.

This repo is quite wonderful😊

@Sandoun
Copy link
Contributor

Sandoun commented Aug 15, 2023

Hi @rivenww,

sorry for my late response.
I have reworked the whole repository from the ground up this also includes an implementation of System.IO.Ports.
Still have to do some householding and cleanup but i have tested the serial feature with some PLCs.

The builder pattern for PLC interfaces has changed quite a lot, this is an example for a connection to COM4 with 19200 baud rate:

using(IPlc plc = Mewtocol.Serial("COM4", BaudRate._19200).Build()) {
await plc.ConnectAsync();
}

There are now also interfaces for IPlc, IPlcEthernet, and IPlcSerial.

Feel free to take a look at my latest commits, the changes were made for future additions like this one in mind!

I don't know if System.IO.Ports will work with android, but yeah if not feel free to make another interface for MAUI based on the IPlc interface!

My only concern is that if you need an additional library for the android serial interface it might be wiser to separate the feature into an other package and namespace like: MewtocolNet.MAUI to prevent bloating of the core

Edit:

I made some new subprojects during the rewrite for example the WPF Example. The wiki and readme are unfortunately not up to date...

@Sandoun Sandoun added the enhancement New feature or request label Aug 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants