Package org.emrick.project
Class SerialTransmitter
java.lang.Object
org.emrick.project.SerialTransmitter
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanprivate com.fazecast.jSerialComm.SerialPortprivate String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static voiddrainOutput(com.fazecast.jSerialComm.SerialPort port, int byteCount) Blocks until everything written has actually left the PC, so the port can be safely closed.voidResets the Receiver into hardware Preview Mode.voidenterProgMode(String ssid, String password, int port, int id, long token, Color verificationColor) voidTells the Receiver to leave Preview Mode and resume normal operation.getBoardType(String port) static com.fazecast.jSerialComm.SerialPort[]com.fazecast.jSerialComm.SerialPortgetType()booleansetSerialPort(String port) voidvoidwriteBoardID(String boardID, String position) private static intwriteFully(com.fazecast.jSerialComm.SerialPort port, byte[] data) Writes every byte, looping in case the driver accepts only part of the buffer in one call.booleanwriteLabel(String label) Stores the board label (e.g.voidwriteLEDCount(String ledCount) voidwritePreviewPacket(String packetLine) Sends one packet line (Packet::fromString format) to be rendered immediately by the Receiver.voidwriteSet(int set) voidvoidwriteToSerialPort(String str)
-
Field Details
-
sp
private com.fazecast.jSerialComm.SerialPort sp -
type
-
inPreviewMode
private boolean inPreviewMode
-
-
Constructor Details
-
SerialTransmitter
public SerialTransmitter()
-
-
Method Details
-
writeFully
private static int writeFully(com.fazecast.jSerialComm.SerialPort port, byte[] data) Writes every byte, looping in case the driver accepts only part of the buffer in one call.- Returns:
- number of bytes written, or -1 on failure
-
drainOutput
private static void drainOutput(com.fazecast.jSerialComm.SerialPort port, int byteCount) Blocks until everything written has actually left the PC, so the port can be safely closed. Do not call flushIOBuffers() after a write: on Windows it purges bytes still queued for transmission, which silently cut off the tail of long writes such as a full show upload. -
getPortNames
public static com.fazecast.jSerialComm.SerialPort[] getPortNames() -
setSerialPort
-
getSerialPort
public com.fazecast.jSerialComm.SerialPort getSerialPort() -
getType
-
setType
-
writeBoardID
-
writeLabel
Stores the board label (e.g. T10L) on a receiver so it can identify itself without a project open. Sent as a runtime command after boot, so receivers on firmware without label support simply ignore it.- Returns:
- true if the receiver confirmed the label
-
writeLEDCount
-
enterPreviewMode
public void enterPreviewMode()Resets the Receiver into hardware Preview Mode. Idempotent; leaves the port open for subsequent packets. -
writePreviewPacket
Sends one packet line (Packet::fromString format) to be rendered immediately by the Receiver. -
exitPreviewMode
public void exitPreviewMode()Tells the Receiver to leave Preview Mode and resume normal operation. -
writeShow
-
getBoardType
-
writeSet
public void writeSet(int set) -
enterProgMode
-
writeToSerialPort
-