RishiGupta12 / SerialPundit

Serial port communication in Java - FTDI D2XX, HID API, X/Y modem
GNU Affero General Public License v3.0
125 stars 56 forks source link

Drop "SerialComManager.BAUDRATE baudRate" parameter of SerialComManager.configureComPortData() function #46

Open powerbroker opened 2 years ago

powerbroker commented 2 years ago

The "SerialComManager.BAUDRATE baudRate" parameter duplicates the "int custBaud" parameter. Nothing prevents from invoking SerialComManager.configureComPortData() with e.g. BAUDRATE.B115200.getValue() as "custBaud" value.

The first scenario of using configureComPortData() which comes into mind is:

DATABITS db = DATABITS.DB_8;
STOPBITS sb = STOPBITS.SB_1;
PARITY p = PARITY.P_NONE;
int userTypedBaudRate;

// Some code affecting db, sb, p and userTypedBaudRate here

...configureComPortData(handle, db, sb, p, BAUDRATE.BCUSTOM, userTypedBaudRate);
RishiGupta12 commented 2 years ago

I am unable to understand what is the real problem.

On Fri, Sep 3, 2021, 4:09 PM powerbroker @.***> wrote:

The "SerialComManager.BAUDRATE baudRate" parameter duplicates the "int custBaud" parameter. Nothing prevents from invoking SerialComManager.configureComPortData() with e.g. BAUDRATE.B115200.getValue() as "custBaud" value.

The first scenario of using configureComPortData() which comes into mind is:

DATABITS db = DATABITS.DB_8;STOPBITS sb = STOPBITS.SB_1;PARITY p = PARITY.P_NONE;int userTypedBaudRate; // Some code affecting db, sb, p and userTypedBaudRate here ...configureComPortData(handle, db, sb, p, BAUDRATE.BCUSTOM, userTypedBaudRate);

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/RishiGupta12/SerialPundit/issues/46, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACJVFLDDDYJO7I7GNN6IJQDUACQVNANCNFSM5DLPGXLQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

powerbroker commented 2 years ago

Hi,

Could you please review the attached sample of utilizing SerialPundit library? Please focus on the static private void startCommunication(String ... args) method, there are explanation comments.

This is most likely not a problem but usability issue.

I'm implementing a GUI tool for serial IO through RS-485, running a CDBUS host on PC. There are some rooms in SerialPundit API require extra coding. The extra coding definitely can be avoided with little changes in API design.

On 04.09.2021 19:20, Rishi Gupta wrote:

I am unable to understand what is the real problem.

On Fri, Sep 3, 2021, 4:09 PM powerbroker @.***> wrote:

The "SerialComManager.BAUDRATE baudRate" parameter duplicates the "int custBaud" parameter. Nothing prevents from invoking SerialComManager.configureComPortData() with e.g. BAUDRATE.B115200.getValue() as "custBaud" value.

The first scenario of using configureComPortData() which comes into mind is:

DATABITS db = DATABITS.DB_8;STOPBITS sb = STOPBITS.SB_1;PARITY p = PARITY.P_NONE;int userTypedBaudRate; // Some code affecting db, sb, p and userTypedBaudRate here ...configureComPortData(handle, db, sb, p, BAUDRATE.BCUSTOM, userTypedBaudRate);

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/RishiGupta12/SerialPundit/issues/46, or unsubscribe

https://github.com/notifications/unsubscribe-auth/ACJVFLDDDYJO7I7GNN6IJQDUACQVNANCNFSM5DLPGXLQ . Triage notifications on the go with GitHub Mobile for iOS

https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android

https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/RishiGupta12/SerialPundit/issues/46#issuecomment-912999641, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAPZKQIVQSICB7OVCKN32SLUAJBMFANCNFSM5DLPGXLQ. Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

powerbroker commented 2 years ago

for some reason web ui fails to attach a file... please use https://disk.yandex.ru/d/T4tMFgahl01Qfw

On 04.09.2021 19:20, Rishi Gupta wrote:

I am unable to understand what is the real problem.

On Fri, Sep 3, 2021, 4:09 PM powerbroker @.***> wrote:

The "SerialComManager.BAUDRATE baudRate" parameter duplicates the "int custBaud" parameter. Nothing prevents from invoking SerialComManager.configureComPortData() with e.g. BAUDRATE.B115200.getValue() as "custBaud" value.

The first scenario of using configureComPortData() which comes into mind is:

DATABITS db = DATABITS.DB_8;STOPBITS sb = STOPBITS.SB_1;PARITY p = PARITY.P_NONE;int userTypedBaudRate; // Some code affecting db, sb, p and userTypedBaudRate here ...configureComPortData(handle, db, sb, p, BAUDRATE.BCUSTOM, userTypedBaudRate);

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/RishiGupta12/SerialPundit/issues/46, or unsubscribe

https://github.com/notifications/unsubscribe-auth/ACJVFLDDDYJO7I7GNN6IJQDUACQVNANCNFSM5DLPGXLQ . Triage notifications on the go with GitHub Mobile for iOS

https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android

https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/RishiGupta12/SerialPundit/issues/46#issuecomment-912999641, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAPZKQIVQSICB7OVCKN32SLUAJBMFANCNFSM5DLPGXLQ. Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.