Files
geutebruck/GeViSoft_SDK_Functions_and_Examples.md
Administrator a92b909539 feat: GeViScope SDK integration with C# Bridge and Flutter app
- Add GeViScope Bridge (C# .NET 8.0) on port 7720
  - Full SDK wrapper for camera control, PTZ, actions/events
  - 17 REST API endpoints for GeViScope server interaction
  - Support for MCS (Media Channel Simulator) with 16 test channels
  - Real-time action/event streaming via PLC callbacks

- Add GeViServer Bridge (C# .NET 8.0) on port 7710
  - Integration with GeViSoft orchestration layer
  - Input/output control and event management

- Update Python API with new routers
  - /api/geviscope/* - Proxy to GeViScope Bridge
  - /api/geviserver/* - Proxy to GeViServer Bridge
  - /api/excel/* - Excel import functionality

- Add Flutter app GeViScope integration
  - GeViScopeRemoteDataSource with 17 API methods
  - GeViScopeBloc for state management
  - GeViScopeScreen with PTZ controls
  - App drawer navigation to GeViScope

- Add SDK documentation (extracted from PDFs)
  - GeViScope SDK docs (7 parts + action reference)
  - GeViSoft SDK docs (12 chunks)

- Add .mcp.json for Claude Code MCP server config

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-19 08:14:17 +01:00

871 lines
24 KiB
Markdown

# GeViSoft SDK - Functions & Examples Summary
**Document Version:** 2012_1.7
**Total Pages:** 113
**Total Examples Found:** 33
**Generated:** 2026-01-12
## Table of Contents
1. [SDK Overview](#sdk-overview)
2. [Core Components](#core-components)
3. [API Functions & Methods](#api-functions--methods)
4. [Examples by Category](#examples-by-category)
5. [Testing Plan](#testing-plan)
---
## SDK Overview
### Supported Languages
- **C++** (primary)
- **Delphi**
- **C# (.NET wrapper)**
### Main SDKs
1. **GeViProcAPI** - Flat C function calls for GeViServer communication
2. **GeViAPIClient** - Object-oriented abstraction layer over GeViProcAPI
3. **GscActions** - GeViScope action message handling
### Architecture
- **Client-Server paradigm**
- **GeViServer** - Backend server managing database
- **GeViIO** - IO client handling peripheral connections
- **GeViSet** - Configuration tool
- **GeViAPITestClient** - Testing and debugging tool
---
## Core Components
### 1. Connection Management
**Found in:** Chunks 2, 6, 7, 10, 11
#### Key Functions:
- `GeViAPI_Database_Connect()` - Connect to GeViServer
- `GeViAPI_Database_Disconnect()` - Disconnect from server
- `GeViAPI_Database_Ping()` - Check connection status
- Password encryption functions
#### Example Implementations:
1. **Direct GeViProcAPI Connection** (Chunk 7, Pages 61-70)
- Declare database handle
- Encrypt password string
- Create remote database object
- Connect to database
2. **GeViAPIClient Connection** (Chunk 7, Pages 61-70)
- Use higher-level abstraction
- Simpler connection management
3. **Connection Monitoring** (Chunk 7, Pages 61-70)
- Create separate monitoring thread
- Send periodic pings
- Auto-reconnect on failure
- 10-second sleep intervals
4. **C# Connection** (Chunk 10, Pages 91-100)
- Event-based connection handling
- Database notification callbacks
---
### 2. Action Messages
**Found in:** Chunks 3, 4, 7, 8, 10
#### Key Actions:
##### Video Control:
- `CrossSwitch(IDVideoInput, IDVideoOutput, Switchmode)` - Route video signals
- `ClearOutput(IDVideoOutput)` - Clear video output
- Video routing and matrix control
##### Digital I/O:
- `InputContact(ContactID, State)` - Digital input state
- `OpenContact(ContactID)` - Open digital output
- `CloseContact(ContactID)` - Close digital output
##### Timer Control:
- `StartTimer(TimerID, TimerName)` - Start timer
- `StopTimer(TimerID, TimerName)` - Stop timer
##### Event Control:
- Event start/stop/kill operations
- Event retriggering
- AutoStop configuration
##### Alarm Control:
- Alarm start/acknowledge/quit
- Monitor group assignment
- Priority-based alarm handling
- Retrigger options
#### Message Creation Methods:
1. **Direct Constructor** (Chunk 7, Pages 61-70)
```cpp
CGeViMessage* gevimessage = new CActCustomAction(123, "HelloGeViSoft!");
```
2. **From ASCII String** (Chunk 7, Pages 61-70)
```cpp
string buffer("CustomAction(123,\"Hello GeViSoft!\")");
CGeViMessage* gevimessage = CGeViMessage::ReadASCIIMessage(
buffer.c_str(), buffer.size(), bytesRead);
```
3. **ASCII Output** (Chunk 7, Pages 61-70)
- Convert binary messages to ASCII representation
4. **C# Message Creation** (Chunk 10, Pages 91-100)
```csharp
// Method 1: Instance creation
GeViAct_CrossSwitch myAction = new GeViAct_CrossSwitch(7, 1, GeViTSwitchMode.sm_Normal);
myDB.SendMessage(myAction);
// Method 2: String-based
myDB.SendMessage("CrossSwitch(7,1,0)");
```
---
### 3. GeViScope Integration
**Found in:** Chunks 2, 8, 10, 11
#### Key Functions:
- `CActGscAction` - GeViScope action wrapper
- GeViScope server alias configuration
- Bidirectional action passing
#### Examples:
1. **Creating GeViScope Actions** (Chunk 8, Pages 71-80)
```cpp
CGeViMessage* gevimessage = new CActGscAction(
"YourGscServerName",
GscAct_CreateCustomAction(1, L"HelloGeViScope!"));
```
2. **Sending GeViScope Messages** (Chunk 8, Pages 71-80)
- Use server alias from GeViSet configuration
- See "ActionMessages -> Creating Action Messages -> Example 4"
3. **C# GeViScope Actions** (Chunk 10, Pages 91-100)
```csharp
GscAct_CustomAction myGscAction = new GscAct_CustomAction(23, "HelloGeViScope!");
myDB.SendMessage("GEVISCOPE_ALIAS", myGscAction);
```
4. **Receiving/Dispatching GeViScope Actions** (Chunk 11, Pages 101-110)
- Use `GscActionDispatcher` class
- Event-based dispatching
- Register handlers for specific GeViScope actions
- Embedded actions in `GscAction` wrapper
**Configuration Required:**
- GeViScope SDK installation
- Connection configuration in GeViSet
- Server alias setup
---
### 4. State Queries
**Found in:** Chunks 8, 11
#### Query Types:
- `CSQGetFirstVideoInput` - Get first video input channel
- `CSQGetNextVideoInput` - Get next video input channel
- `CSQGetFirstVideoOutput` - Get first video output channel
- `CSQGetNextVideoOutput` - Get next video output channel
- Digital I/O enumeration queries
#### Usage Pattern (Chunk 8, Pages 71-80):
1. Create state query
2. Send query with `SendStateQuery(query, INFINITE)`
3. Receive `CStateAnswer` object
4. Process answer data
5. Iterate with "next" queries
#### C# Implementation (Chunk 11, Pages 101-110):
```csharp
GeViMessage myAnswer;
GeViMessage myQuery = new GeViSQ_GetFirstVideoInput(true, true);
myDB.SendQuery(myQuery, out myAnswer);
if (myAnswer is GeViSA_VideoInputInfo) {
// Process video input info
}
```
**Timeout Control:**
- Default: 3000ms
- Use `INFINITE` for no timeout
- C#: `SetQueryTimeoutInMs()` method
---
### 5. Database Queries
**Found in:** Chunks 8, 9
#### Query Session Workflow:
1. **Create Action Query** (Chunk 9, Pages 81-90)
```cpp
CDataBaseQuery* geviquery = new CDBQCreateActionQuery(0);
CDataBaseAnswer* dbanswer = m_APIClient->SendDatabaseQuery(geviquery, INFINITE);
```
2. **Get Query Handle** (Chunk 9, Pages 81-90)
```cpp
if (dbanswer->m_AnswerCode == dbac_QueryHandle) {
CDBQQueryHandle* handle = reinterpret_cast<CDBQQueryHandle*>(dbanswer);
}
```
3. **Navigate Records** (Chunk 9, Pages 81-90)
- `CDBQGetLast` - Get latest record
- `CDBQGetNext` - Get next record
- `CDBQGetPrev` - Get previous record
- `CDBQGetFirst` - Get first record
4. **Filter Queries** (Chunk 9, Pages 81-90)
- `CDBFTypeName` - Filter by action type name
- `CDBFPK_GrtEqu` - Filter by primary key >= value
- `CDBFPK_LowEqu` - Filter by primary key <= value
- Filters use LIKE comparison: `dbc_LIKE`
- Multiple filters can be combined (AND logic)
5. **Close Query Session**
- Release query handle
- Clean up resources
#### Example: Retrieve Two Latest Actions (Chunk 9, Pages 81-90)
- Create `CDBQCreateActionQuery`
- Get handle from response
- Send `CDBQGetLast` query
- Extract primary key
- Send `CDBQGetPrev` with handle and PK
- Process results
#### Example: Filtered Query (Chunk 9, Pages 81-90)
- Filter for `CustomAction` types
- With primary key between 500-600
- Send filters after obtaining handle
- Iterate through filtered results
---
### 6. Event Configuration
**Found in:** Chunks 4, 5
#### Event Options:
| Option | Description |
|--------|-------------|
| Name | Event name for actions |
| Description | Event description |
| EventID | Event identifier |
| Active | Must be checked to trigger |
| Startby | Actions that trigger the event (OR logic) |
| Onstart | Actions executed on start (AND logic) |
| Onstop | Actions executed on stop (AND logic) |
| Stopafter | Auto-stop timeout period |
| Retriggerable | Allow event retriggering |
#### Example: Video Routing Event (Chunk 4, Pages 31-40)
**Scenario:** Digital input 3 triggers video routing
- **Trigger:** `InputContact(3, true)` - Contact 3 closes
- **On Start:** `CrossSwitch(3, 2, 0)` - Route input 3 to output 2
- **On Stop:** `ClearOutput(2)` - Clear output 2
- **Auto Stop:** After 5 seconds
- **Retriggerable:** Yes
---
### 7. Timer Configuration
**Found in:** Chunk 4
#### Timer Types:
- **Periodical** - Regular intervals
- **Periodical with embedded tick** - Two ticks per cycle
#### Example: Beacon Light Timer (Chunk 4, Pages 31-40)
**Scenario:** Toggle beacon at 1Hz
- **Main Tick:** Every 1000ms → `CloseContact(2)` - Turn on
- **Embedded Tick:** Every 500ms → `OpenContact(2)` - Turn off
- **Control:**
- Start: `StartTimer(1, "BeaconTimer")`
- Stop: `StopTimer(1, "BeaconTimer")`
**Timer Addressing:**
- By Name: `StartTimer(0, "BeaconTimer")`
- By ID: `StartTimer(1, "")`
- Name takes precedence over ID
---
### 8. Alarm Configuration
**Found in:** Chunks 5
#### Alarm Options:
| Option | Description |
|--------|-------------|
| Name/Description | Alarm identification |
| AlarmID | Numeric identifier |
| Active | Enable/disable alarm |
| Priority | 1 (high) to 10 (low) |
| Monitor Group | Display target monitors |
| Cameras | Video inputs to show |
| Retriggerable | Allow retriggering |
| Popup (Retrigger) | Show popup on retrigger |
| Undo acknowledge (Retrigger) | Reset ack state on retrigger |
| User specific (Retrigger) | Custom retrigger actions |
#### Alarm Actions:
- **Start by** - Actions that trigger alarm (OR)
- **On start** - Actions on alarm start (AND)
- **Acknowledge by** - Actions to acknowledge (OR)
- **On acknowledge** - Actions on acknowledgment (AND)
- **Quit by** - Actions to quit alarm (OR)
- **On quit** - Actions on alarm quit (AND)
#### Example: Parking Lot Alarm (Chunk 5, Pages 41-50)
**Scenario:** Vehicle detection and barrier control
1. **Trigger:** `InputContact(1, true)` - Vehicle detected
2. **Acknowledge:** `InputContact(2, true)` - Operator button
3. **On Acknowledge:** `OpenContact(1)` - Open barrier
4. **Quit:** `InputContact(3, true)` - Vehicle passed
5. **On Quit:** `CloseContact(1)` - Close barrier
6. **Cameras:** Video inputs 4 and 7
7. **Monitor Group:** Outputs 1 and 2
---
### 9. Callback & Notification Handling
**Found in:** Chunks 6, 7, 8, 10
#### Callback Types:
1. **Database Notification Callback** (Chunk 8, Pages 71-80)
- Triggered on server messages
- `NFServer_NewMessage` - New message received
- `NFServer_Disconnected` - Connection lost
- `NFServer_GoingShutdown` - Server shutting down
2. **C# Event Handlers** (Chunk 10, Pages 91-100)
- Event-based message dispatching
- Register handlers for specific actions
- Automatic action parsing
#### Example: Receiving Messages (Chunk 8, Pages 71-80)
```cpp
void DatabaseNotification(TServerNotification Notification, void* Params) {
if (Notification == NFServer_NewMessage) {
TMessageEntry* messageEntry = reinterpret_cast<TMessageEntry*>(Params);
CGeViMessage* gevimessage = CGeViMessage::ReadBinMessage(
messageEntry->Buffer,
messageEntry->Length,
noOfBytesRead);
// Process message
}
}
```
#### C# Example: Action Events (Chunk 10, Pages 91-100)
```csharp
// Register event handler
myDB.ReceivedCrossSwitch += myDB_ReceivedCrossSwitch;
// Handler method
void myDB_ReceivedCrossSwitch(object sender, GeViAct_CrossSwitchEventArgs e) {
// Process CrossSwitch action
}
```
---
## Examples by Category
### Connection Examples (6 examples)
1. **CPP_SimpleActionClient** (C++, VS2008/VS2010)
- Basic connection/disconnection
- Sending/receiving actions
- Server notifications
- Message conversion
2. **CPP_MonitoredConnectionClient** (C++, VS2008/VS2010)
- Connection monitoring
- Auto-reconnect on loss
- Ping-based health checks
3. **CS_SimpleActionClient** (C#, VS2008/VS2010)
- .NET connection handling
- Event-based notifications
4. **CS_ConsoleClient** (C#, VS2008/VS2010)
- Console-based client
- User input parsing
5. **Delphi_SimpleActionClient** (Delphi, RAD Studio XE)
- Delphi connection implementation
6. **Delphi_ConsoleClient** (Delphi, RAD Studio XE)
- Delphi console client
### Video/IO Control Examples (3 examples)
1. **CrossSwitching Video** (Chunk 2, 3, Pages 11-30)
- Select input and output
- Route video signals
- Use GeViAPI TestClient
2. **Virtual VX3 Matrix** (Chunk 2, Pages 11-20)
- Configure virtual matrix
- VirtualVX3 setup
3. **GeViScope Video Control** (Chunk 2, Pages 11-20)
- Control GeViScope/GscView
- Like analogue matrix
### Timer Examples (1 example)
1. **Beacon Timer** (Chunk 4, Pages 31-40)
- Periodical with embedded tick
- 1Hz toggle frequency
- Digital output control
### Event Examples (1 example)
1. **Video Routing Event** (Chunk 4, Pages 31-40)
- Digital input trigger
- Auto-stop after 5 seconds
- Retriggerable configuration
### Alarm Examples (1 example)
1. **Parking Lot Alarm** (Chunk 5, Pages 41-50)
- Multi-stage alarm flow
- Acknowledge/quit pattern
- Monitor group routing
- Camera assignment
### State Query Examples (4 examples)
1. **Enumerate Video Inputs** (Chunk 8, Pages 71-80, C++)
- GetFirst/GetNext pattern
- Active/enabled filtering
- INFINITE timeout
2. **Enumerate Video Inputs** (Chunk 11, Pages 101-110, C#)
- .NET implementation
- Query timeout configuration
- List building
3. **Enumerate Video Outputs** (Referenced, similar pattern)
4. **Enumerate Digital I/O** (Referenced, similar pattern)
### Database Query Examples (5 examples)
1. **Create Action Query** (Chunk 9, Pages 81-90)
- Get query handle
- Basic query session
2. **Retrieve Two Latest Actions** (Chunk 9, Pages 81-90)
- GetLast/GetPrev navigation
- Primary key extraction
3. **Filter by Action Type** (Chunk 9, Pages 81-90)
- TypeName filter
- LIKE comparison
4. **Filter by Primary Key Range** (Chunk 9, Pages 81-90)
- PK_GrtEqu and PK_LowEqu
- Range filtering
5. **Complex Filtered Query** (Chunk 9, Pages 81-90)
- Multiple filters combined
- CustomAction with PK 500-600
### GeViScope Examples (4 examples)
1. **Create GeViScope Action** (Chunk 8, Pages 71-80, C++)
- CActGscAction constructor
- Server alias usage
2. **Send GeViScope Message** (Chunk 8, Pages 71-80)
- Through GeViSoft connection
3. **Send GeViScope Action** (Chunk 10, Pages 91-100, C#)
- .NET wrapper usage
- GscAct_CustomAction
4. **Receive/Dispatch GeViScope Actions** (Chunk 11, Pages 101-110)
- GscActionDispatcher
- Event-based handling
- Embedded action extraction
### Message Conversion Examples (3 examples)
1. **Binary to ASCII** (Chunk 7, Pages 61-70)
- ReadASCIIMessage
- ASCII representation
2. **ASCII to Binary** (Chunk 7, Pages 61-70)
- Parse string messages
- bytesRead tracking
3. **Direct Constructor** (Chunk 7, Pages 61-70)
- Type-safe message creation
- No parsing required
---
## Testing Plan
### Phase 1: Connection & Basic Communication
**Duration:** Test 1-3 days
#### Test Cases:
1. **TC-001: Connect to GeViServer**
- Input: Server IP, username, password
- Expected: Successful connection
- Verify: Connection status indicator
2. **TC-002: Disconnect from GeViServer**
- Pre-condition: Connected
- Expected: Clean disconnection
- Verify: Resources released
3. **TC-003: Connection Monitoring**
- Action: Disconnect network
- Expected: Auto-reconnect
- Verify: Connection restored within 10s
4. **TC-004: Send Ping**
- Action: Send ping command
- Expected: Pong response
- Verify: Latency measurement
### Phase 2: Video Control
**Duration:** Test 2-4 days
#### Test Cases:
5. **TC-005: Cross-Switch Video**
- Input: VideoInput=7, VideoOutput=3
- Action: Send CrossSwitch(7, 3, 0)
- Expected: Video routed
- Verify: Output shows input 7
6. **TC-006: Clear Video Output**
- Pre-condition: Video routed
- Action: Send ClearOutput(3)
- Expected: Output cleared
- Verify: Output shows no video
7. **TC-007: Enumerate Video Inputs**
- Action: GetFirstVideoInput, loop GetNextVideoInput
- Expected: List of all inputs
- Verify: Count matches configuration
8. **TC-008: Enumerate Video Outputs**
- Action: GetFirstVideoOutput, loop GetNextVideoOutput
- Expected: List of all outputs
- Verify: Count matches configuration
### Phase 3: Digital I/O Control
**Duration:** Test 1-2 days
#### Test Cases:
9. **TC-009: Close Digital Output**
- Input: ContactID=1
- Action: CloseContact(1)
- Expected: Output closed
- Verify: Physical contact state
10. **TC-010: Open Digital Output**
- Input: ContactID=1
- Action: OpenContact(1)
- Expected: Output opened
- Verify: Physical contact state
11. **TC-011: Read Digital Input**
- Action: Monitor InputContact events
- Expected: Receive state changes
- Verify: Event data matches hardware
12. **TC-012: Enumerate Digital I/O**
- Action: Query all contacts
- Expected: List of all contacts
- Verify: Active/inactive states
### Phase 4: Timer Operations
**Duration:** Test 1-2 days
#### Test Cases:
13. **TC-013: Start Timer by Name**
- Input: TimerName="BeaconTimer"
- Action: StartTimer(0, "BeaconTimer")
- Expected: Timer starts
- Verify: Timer ticks received
14. **TC-014: Start Timer by ID**
- Input: TimerID=1
- Action: StartTimer(1, "")
- Expected: Timer starts
- Verify: Timer events
15. **TC-015: Stop Timer**
- Pre-condition: Timer running
- Action: StopTimer(1, "BeaconTimer")
- Expected: Timer stops
- Verify: No more ticks
16. **TC-016: Beacon Timer (Embedded Tick)**
- Configuration: MainTick=1000ms, EmbeddedTick=500ms
- Expected: 1Hz toggle pattern
- Verify: Digital output toggles
### Phase 5: Event Handling
**Duration:** Test 2-3 days
#### Test Cases:
17. **TC-017: Trigger Event by Digital Input**
- Configuration: StartBy=InputContact(3, true)
- Action: Close contact 3
- Expected: Event starts
- Verify: OnStart actions execute
18. **TC-018: Event Auto-Stop**
- Configuration: StopAfter=5 seconds
- Expected: Event stops automatically
- Verify: OnStop actions execute
19. **TC-019: Retrigger Event**
- Configuration: Retriggerable=true
- Action: Trigger again while running
- Expected: Event restarts
- Verify: Event counter resets
20. **TC-020: Video Routing Event**
- Full scenario from documentation
- Expected: Complete workflow
- Verify: All actions execute
### Phase 6: Alarm Handling
**Duration:** Test 2-3 days
#### Test Cases:
21. **TC-021: Start Alarm**
- Trigger: InputContact(1, true)
- Expected: Alarm state active
- Verify: OnStart actions execute
22. **TC-022: Acknowledge Alarm**
- Action: InputContact(2, true)
- Expected: Alarm acknowledged
- Verify: OnAcknowledge actions execute
23. **TC-023: Quit Alarm**
- Action: InputContact(3, true)
- Expected: Alarm quit
- Verify: OnQuit actions execute
24. **TC-024: Parking Lot Alarm (Full Scenario)**
- Full workflow from documentation
- Expected: Complete alarm lifecycle
- Verify: All stages work correctly
25. **TC-025: Alarm Priority**
- Configuration: Multiple alarms with different priorities
- Expected: High priority displaces low
- Verify: Monitor group shows correct alarm
26. **TC-026: Alarm Retriggering**
- Configuration: Retriggerable=true
- Action: Trigger again
- Expected: Alarm restarted
- Verify: Undo acknowledge if configured
### Phase 7: Database Queries
**Duration:** Test 2-3 days
#### Test Cases:
27. **TC-027: Create Action Query**
- Action: Send CDBQCreateActionQuery
- Expected: Query handle received
- Verify: Handle != 0
28. **TC-028: Get Last Action**
- Action: CDBQGetLast with handle
- Expected: Latest action record
- Verify: Primary key matches
29. **TC-029: Navigate Previous/Next**
- Action: GetPrev, GetNext sequence
- Expected: Sequential navigation
- Verify: Record order
30. **TC-030: Filter by Action Type**
- Filter: TypeName="CustomAction"
- Expected: Only CustomAction records
- Verify: All results are CustomAction
31. **TC-031: Filter by Primary Key Range**
- Filter: PK >= 500 AND PK <= 600
- Expected: Records in range
- Verify: All PKs between 500-600
32. **TC-032: Complex Multi-Filter Query**
- Filters: TypeName + PK range
- Expected: Combined filter results
- Verify: Results match all criteria
33. **TC-033: Close Query Session**
- Action: Release query handle
- Expected: Resources freed
- Verify: No memory leaks
### Phase 8: GeViScope Integration
**Duration:** Test 2-3 days
#### Test Cases:
34. **TC-034: Send GeViScope CustomAction**
- Input: TypeID=123, Text="HelloGeViScope!"
- Expected: Action sent to GeViScope
- Verify: GeViScope receives action
35. **TC-035: Receive GeViScope Action**
- Pre-condition: GeViScope sends action
- Expected: Action received in GeViSoft
- Verify: Correct parsing
36. **TC-036: Dispatch GeViScope Actions**
- Configuration: Event handlers registered
- Expected: Handlers called
- Verify: Correct action types
37. **TC-037: GeViScope Server Alias**
- Configuration: Multiple GeViScope servers
- Action: Address by alias
- Expected: Correct server receives
- Verify: Alias routing works
### Phase 9: Message Conversion & Parsing
**Duration:** Test 1-2 days
#### Test Cases:
38. **TC-038: Binary to ASCII Conversion**
- Input: Binary CGeViMessage
- Expected: ASCII string output
- Verify: Correct format
39. **TC-039: ASCII to Binary Conversion**
- Input: "CrossSwitch(7,3,0)"
- Expected: Binary CGeViMessage
- Verify: Correct parsing
40. **TC-040: Direct Constructor Creation**
- Action: new CActCrossSwitch(7, 3, 0)
- Expected: Valid message
- Verify: Type-safe construction
### Phase 10: Error Handling & Edge Cases
**Duration:** Test 1-2 days
#### Test Cases:
41. **TC-041: Invalid Connection Parameters**
- Input: Wrong IP/password
- Expected: Connection failure
- Verify: Error message
42. **TC-042: Send Action While Disconnected**
- Pre-condition: Not connected
- Expected: Error or queue
- Verify: Graceful handling
43. **TC-043: Query Timeout**
- Action: Query with 1ms timeout
- Expected: Timeout error
- Verify: No deadlock
44. **TC-044: Invalid Action Parameters**
- Input: CrossSwitch(-1, 999, 0)
- Expected: Parameter validation
- Verify: Error message
45. **TC-045: Server Shutdown During Operation**
- Action: Stop GeViServer
- Expected: NFServer_GoingShutdown
- Verify: Graceful cleanup
---
## Implementation Status Tracking
### To Be Mapped Against Flutter App:
- [ ] Connection management
- [ ] Video control actions
- [ ] Digital I/O control
- [ ] Timer management
- [ ] Event configuration
- [ ] Alarm handling
- [ ] State queries
- [ ] Database queries
- [ ] GeViScope integration
- [ ] Message parsing
- [ ] Callback handling
- [ ] Error handling
### Priority Matrix:
| Priority | Category | Reason |
|----------|----------|--------|
| P0 (Critical) | Connection Management | Foundation for all operations |
| P0 (Critical) | Video Control | Core functionality |
| P1 (High) | Digital I/O | Hardware integration |
| P1 (High) | State Queries | System information |
| P2 (Medium) | Events | Automation logic |
| P2 (Medium) | Alarms | Alert handling |
| P2 (Medium) | Timers | Scheduled operations |
| P3 (Low) | Database Queries | Historical data |
| P3 (Low) | GeViScope | Advanced integration |
---
## Notes
### Important Considerations:
1. **Thread Safety:** All callback handlers must be thread-safe
2. **Memory Management:** Call DeleteObject() on messages after use
3. **Timeouts:** Use INFINITE cautiously, prefer explicit timeouts
4. **Error Handling:** Always check answer codes before processing
5. **Query Sessions:** Close query handles to prevent resource leaks
### Configuration Prerequisites:
- GeViServer must be running
- GeViIO client configured for virtual or physical hardware
- GeViSet configuration completed
- For GeViScope: SDK installed and connection configured
### Development Tools:
- **GeViAPITestClient** - Essential for testing and debugging
- Use communication log to monitor action flow
- Database Viewer tab for query testing
- Video/DigIO tab for visual verification
---
**Next Steps:**
1. Map each function to Flutter app implementation
2. Identify missing implementations
3. Prioritize implementation gaps
4. Execute test plan systematically
5. Document results and issues