-
Notifications
You must be signed in to change notification settings - Fork 0
Closed
Description
Summary
CoreDeviceAdapter v0.4.0 uses LineBasedMessageParser which is designed for text-based protocols (like SCPI responses) but cannot parse binary protobuf messages sent by DAQiFi devices after initial command exchange.
Current Behavior
- CoreDeviceAdapter successfully connects to devices and sends SCPI commands
- Device responses after initial SCPI commands are binary protobuf messages
- LineBasedMessageParser cannot parse these binary messages, so MessageReceived events never fire
- Device initialization fails to complete due to lack of response processing
Root Cause
The CoreDeviceAdapter uses LineBasedMessageParser (see LineBasedMessageParser.cs) which:
- Expects text messages terminated by line endings (CRLF)
- Uses UTF-8 encoding to convert bytes to strings
- Cannot handle binary protobuf data that contains null bytes and non-text content
Expected Behavior
CoreDeviceAdapter should support both:
- Text-based SCPI command responses (current functionality)
- Binary protobuf message parsing for device status and data messages
Proposed Solution
Add support for protobuf message parsing in CoreDeviceAdapter by either:
- Creating a CompositeMessageParser that can handle both text and protobuf formats
- Adding a ProtobufMessageParser alongside LineBasedMessageParser
- Making the message parser configurable in CoreDeviceAdapter constructor
Impact
This limitation prevents Phase 2 integration of CoreDeviceAdapter in daqifi-desktop application. Current workaround is using Phase 1 approach (existing transport + Core 0.4.0 ScpiMessageProducer).
Device Communication Flow
- SCPI Commands (text-based):
DEVICE:ON,DEVICE:FORMAT PROTOBUF→ LineBasedMessageParser works - Device Status Responses (binary protobuf): DaqifiOutMessage with device metadata → LineBasedMessageParser fails
- Data Streaming (binary protobuf): Continuous measurement data → LineBasedMessageParser fails
Test Case
// This should work but currently fails:
var adapter = new CoreDeviceAdapter(transport);
adapter.MessageReceived += (sender, args) => {
// This event never fires for protobuf responses
Console.WriteLine($"Received: {args.Data}");
};
adapter.SendAsync("DEVICE:INFO"); // Response is protobuf, not parsedPriority
High - Required for Phase 2 CoreDeviceAdapter integration in daqifi-desktop v0.4.1
🤖 Generated with Claude Code
Metadata
Metadata
Assignees
Labels
No labels