-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
陈力
committed
Oct 26, 2023
1 parent
cd4bb33
commit 210e809
Showing
7 changed files
with
156 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 71 additions & 0 deletions
71
serial_lib/src/main/java/com/kongqw/serialportlibrary/SerialConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
package com.kongqw.serialportlibrary; | ||
|
||
import androidx.annotation.NonNull; | ||
|
||
import com.cl.log.XLogConfig; | ||
|
||
/** | ||
* name:cl | ||
* date:2023/10/26 | ||
* desc:串口配置类 | ||
*/ | ||
public class SerialConfig { | ||
|
||
//配置日志相关参数 | ||
private XLogConfig xLogConfig; | ||
//串口接收间隔时间 | ||
private int intervalSleep; | ||
//串口重连机制 | ||
private boolean serialPortReconnection; | ||
|
||
|
||
public SerialConfig(Builder builder) { | ||
this.xLogConfig=builder.xLogConfig; | ||
this.intervalSleep=builder.intervalSleep; | ||
this.serialPortReconnection=builder.serialPortReconnection; | ||
} | ||
|
||
|
||
public XLogConfig getxLogConfig() { | ||
return xLogConfig; | ||
} | ||
|
||
public int getIntervalSleep() { | ||
return intervalSleep; | ||
} | ||
|
||
public boolean isSerialPortReconnection() { | ||
return serialPortReconnection; | ||
} | ||
|
||
public static class Builder { | ||
|
||
//配置日志相关参数 | ||
private XLogConfig xLogConfig; | ||
//串口接收间隔时间 | ||
private int intervalSleep = 100; | ||
//串口重连机制 | ||
private boolean serialPortReconnection = false; | ||
|
||
public Builder setXLogConfig(@NonNull XLogConfig config) { | ||
xLogConfig = config; | ||
return this; | ||
} | ||
|
||
public Builder setIntervalSleep(int sleep) { | ||
intervalSleep = sleep; | ||
return this; | ||
} | ||
|
||
public Builder setSerialPortReconnection(boolean serialReconnection) { | ||
serialPortReconnection = serialReconnection; | ||
return this; | ||
} | ||
|
||
public SerialConfig build() { | ||
return new SerialConfig(this); | ||
} | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters