-
Notifications
You must be signed in to change notification settings - Fork 803
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
feat: added support for wireless communication using ESP01 #2561
base: development
Are you sure you want to change the base?
Conversation
Reviewer's Guide by SourceryThis PR implements wireless communication support for the PSLab board using the ESP8266 ESP01 chip. The implementation replaces the existing HTTP-based communication with a socket-based approach, introducing a new SocketClient class for handling TCP/IP connections. The changes modify the communication layer to support both USB and WiFi connections seamlessly. Sequence diagram for wireless communication using SocketClientsequenceDiagram
participant ESPFragment
participant SocketClient
participant ScienceLabCommon
participant ScienceLab
ESPFragment->>SocketClient: openConnection(espIPAddress, 80)
SocketClient-->>ESPFragment: isConnected()
ESPFragment->>ScienceLabCommon: setIsWifiConnected(true)
ScienceLabCommon->>ScienceLab: openDevice()
ScienceLab->>PacketHandler: new PacketHandler()
PacketHandler->>SocketClient: read(buffer, bytesToRead)
PacketHandler->>SocketClient: write(data)
Class diagram for the new SocketClient classclassDiagram
class SocketClient {
-SocketClient socketClient
-Socket socket
-OutputStream outputStream
-InputStream inputStream
-boolean isConnected
-byte[] buffer
+void openConnection(String ip, int port)
+static SocketClient getInstance()
+boolean isConnected()
+void write(byte[] data)
+int read(byte[] dest, int bytesToRead)
+void closeConnection()
}
note for SocketClient "Handles TCP/IP connections for wireless communication"
Updated class diagram for PacketHandlerclassDiagram
class PacketHandler {
-int timeout
-int VERSION_STRING_LENGTH
-int FW_VERSION_LENGTH
-ByteBuffer burstBuffer
-SocketClient socketClient
+PacketHandler(int timeout, CommunicationHandler communicationHandler)
+PacketHandler()
+boolean isConnected()
+int commonRead(int bytesToRead)
+void commonWrite(byte[] data)
}
note for PacketHandler "Replaced HttpAsyncTask with SocketClient for wireless communication"
File-Level Changes
Assessment against linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
@CloudyPadmal Could you please provide feedback on the fact that if the lines on which I'm working here are correct. |
Build successful. APKs to test: https://github.com/fossasia/pslab-android/actions/runs/11876914159/artifacts/2197828980 |
THIS IS CURRENTLY A WORK IN PROGRESS.
Fixes #2509
Adds support for wireless communication with the PSLab board using the ESP8266 ESP01 chip.
Screenshots / Recordings
N/A
Checklist:
strings.xml
,dimens.xml
andcolors.xml
without hard coding any value.strings.xml
,dimens.xml
orcolors.xml
.Summary by Sourcery
Add support for wireless communication with the PSLab board using the ESP8266 ESP01 chip, replacing the existing HTTP-based communication with a new SocketClient implementation for improved performance.
New Features:
Enhancements: