This MVP release provides a complete full-stack solution for managing action mappings in Geutebruck's GeViScope and GeViSoft video surveillance systems. ## Features ### Flutter Web Application (Port 8081) - Modern, responsive UI for managing action mappings - Action picker dialog with full parameter configuration - Support for both GSC (GeViScope) and G-Core server actions - Consistent UI for input and output actions with edit/delete capabilities - Real-time action mapping creation, editing, and deletion - Server categorization (GSC: prefix for GeViScope, G-Core: prefix for G-Core servers) ### FastAPI REST Backend (Port 8000) - RESTful API for action mapping CRUD operations - Action template service with comprehensive action catalog (247 actions) - Server management (G-Core and GeViScope servers) - Configuration tree reading and writing - JWT authentication with role-based access control - PostgreSQL database integration ### C# SDK Bridge (gRPC, Port 50051) - Native integration with GeViSoft SDK (GeViProcAPINET_4_0.dll) - Action mapping creation with correct binary format - Support for GSC and G-Core action types - Proper Camera parameter inclusion in action strings (fixes CrossSwitch bug) - Action ID lookup table with server-specific action IDs - Configuration reading/writing via SetupClient ## Bug Fixes - **CrossSwitch Bug**: GSC and G-Core actions now correctly display camera/PTZ head parameters in GeViSet - Action strings now include Camera parameter: `@ PanLeft (Comment: "", Camera: 101028)` - Proper filter flags and VideoInput=0 for action mappings - Correct action ID assignment (4198 for GSC, 9294 for G-Core PanLeft) ## Technical Stack - **Frontend**: Flutter Web, Dart, Dio HTTP client - **Backend**: Python FastAPI, PostgreSQL, Redis - **SDK Bridge**: C# .NET 8.0, gRPC, GeViSoft SDK - **Authentication**: JWT tokens - **Configuration**: GeViSoft .set files (binary format) ## Credentials - GeViSoft/GeViScope: username=sysadmin, password=masterkey - Default admin: username=admin, password=admin123 ## Deployment All services run on localhost: - Flutter Web: http://localhost:8081 - FastAPI: http://localhost:8000 - SDK Bridge gRPC: localhost:50051 - GeViServer: localhost (default port) Generated with Claude Code (https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
149 lines
5.6 KiB
Markdown
149 lines
5.6 KiB
Markdown
# Implementation Progress Summary
|
|
|
|
## ✅ Completed
|
|
|
|
### 1. Research & Discovery
|
|
- ✅ Extracted 2403 HTML files from SDK CHM documentation
|
|
- ✅ Analyzed SDK architecture and identified correct approach
|
|
- ✅ Found that action mappings are stored as Alarms with associated Actions
|
|
- ✅ Identified database query functions: `GeViDBQ_CreateActionQuery`, `GeViDBQ_GetFirst`, `GeViDBQ_GetNext`
|
|
- ✅ Identified answer types: `GeViDBA_ActionEntry` with `GeViActionData._ActionData`
|
|
|
|
### 2. Code Implementation
|
|
- ✅ Created `AlarmQueryService.cs` - Service for querying alarms and actions via SDK
|
|
- ✅ Updated `ActionMappingHandler.cs` - Modified to use AlarmQueryService instead of in-memory storage
|
|
- ✅ Documented complete solution approach in `FINAL_SOLUTION.md`
|
|
|
|
### 3. Key Findings
|
|
**Action Mapping Structure**:
|
|
- Alarms = Containers for action mappings
|
|
- Actions = Stored separately, linked to alarms via `AlarmReference`
|
|
- `AlarmRelation`:
|
|
- `1` = Start/Input action (trigger)
|
|
- `2` = Follow/Output action (response)
|
|
- `ActionData._ActionData` = Actual command string (e.g., "VMD_Start(101038)")
|
|
|
|
## ⏸️ Current Blocker
|
|
|
|
### Callback Registration Issue
|
|
The SDK callback mechanism works differently than initially expected:
|
|
|
|
**Errors encountered**:
|
|
1. `GeViDatabase` doesn't have `OnNewGeViSA_FirstAlarm` event
|
|
2. `GeViSQ_GetNextAlarm` requires parameters (not found in docs)
|
|
3. `GeViDBQ_GetNext/GetFirst` require handle parameters
|
|
4. `OnNewGeViDBA_ActionEntry` event doesn't exist
|
|
|
|
**Root cause**: Need to understand the actual SDK callback/dispatcher system.
|
|
|
|
### Files with compilation errors:
|
|
- `SDK/AlarmQueryService.cs` - Lines 103-104, 124-125, 250, 273 (event registration)
|
|
- Lines 151, 188 (GeViSQ_GetNextAlarm parameters)
|
|
- Lines 234, 259 (GeViDBQ query handles)
|
|
|
|
## 🔄 Next Steps
|
|
|
|
### 1. Fix Callback Registration
|
|
Need to investigate:
|
|
- Check `C:\GEVISOFT\Examples\` for callback registration examples
|
|
- Examine `GeViDatabase.RegisterCallback()` implementation
|
|
- Look for event dispatcher or message handler pattern
|
|
- Possible that answers come through a different mechanism (e.g., message queue)
|
|
|
|
### 2. Alternative Approach: Action Dispatcher
|
|
The SDK may use an Action Dispatcher pattern instead of direct events:
|
|
```csharp
|
|
// Possible approach:
|
|
var dispatcher = new GeViActionDispatcher();
|
|
dispatcher.RegisterHandler<GeViDBA_ActionEntry>(HandleActionEntry);
|
|
_database.SetDispatcher(dispatcher);
|
|
```
|
|
|
|
### 3. Fix Query Handle Management
|
|
Database queries likely return handles that must be tracked:
|
|
```csharp
|
|
// Create query and get handle
|
|
var query = new GeViDBQ_CreateActionQuery(alarmPK);
|
|
long queryHandle = await _database.SendQueryAsync(query);
|
|
|
|
// Use handle to navigate results
|
|
var getFirst = new GeViDBQ_GetFirst(queryHandle);
|
|
await _database.SendMessageAsync(getFirst);
|
|
```
|
|
|
|
### 4. Test & Verify
|
|
Once compilation succeeds:
|
|
1. Build SDK Bridge
|
|
2. Start services
|
|
3. Test API endpoint `/api/v1/action-mappings`
|
|
4. Verify live data from GeViServer appears
|
|
5. Cross-reference with GeViSet to confirm accuracy
|
|
|
|
## 📁 Files Modified/Created
|
|
|
|
**New Files**:
|
|
- `SDK/AlarmQueryService.cs` - Alarm/action query service (needs callback fixes)
|
|
- `FINAL_SOLUTION.md` - Complete solution documentation
|
|
- `IMPLEMENTATION_PROGRESS.md` - This file
|
|
- `docs/chm-extracted/` - 2403 HTML files extracted from CHM
|
|
|
|
**Modified Files**:
|
|
- `SDK/ActionMappingHandler.cs` - Now uses AlarmQueryService (compiles successfully)
|
|
- Added `using System.Linq;`
|
|
- Injected `AlarmQueryService`
|
|
- Updated `EnumerateActionMappingsAsync()` to query live data
|
|
|
|
**Unchanged (working)**:
|
|
- `SDK/GeViDatabaseWrapper.cs` - Connection management
|
|
- `Program.cs` - Service initialization
|
|
- `Services/ActionMappingService.cs` - gRPC service layer
|
|
|
|
## 🎯 Solution Benefits
|
|
|
|
Once implemented, this will:
|
|
✅ Access LIVE GeViSoft configuration (not separate database)
|
|
✅ Read action mappings that exist in GeViSet
|
|
✅ Use official SDK (no direct database access)
|
|
✅ Respect GeViServer's database locking
|
|
✅ Get same data GeViSet sees
|
|
✅ Potential for real-time updates via SDK events
|
|
|
|
## 📚 Reference Documentation
|
|
|
|
**Key SDK Classes**:
|
|
- `GeViSQ_GetFirstAlarm(activeOnly, enabledOnly)` - Query first alarm
|
|
- `GeViSQ_GetNextAlarm(...)` - Iterate alarms (parameters unknown)
|
|
- `GeViDBQ_CreateActionQuery(alarmPK)` - Query actions for alarm
|
|
- `GeViDBQ_GetFirst(handle?)` - Get first result (handle param unknown)
|
|
- `GeViDBQ_GetNext(handle?)` - Get next result (handle param unknown)
|
|
- `GeViDBA_ActionEntry` - Action answer with:
|
|
- `sActionData._ActionData` (String) - Action command
|
|
- `sAlarmRelation` (Int32) - 0=none, 1=input, 2=output
|
|
- `sAlarmReference` (Int64) - FK to alarm
|
|
|
|
**SDK Documentation**:
|
|
- Location: `C:\GEVISOFT\Documentation\GeViSoft .NET SDK API Documentation.chm`
|
|
- Extracted: `C:\DEV\COPILOT\geutebruck-api\docs\chm-extracted\`
|
|
- Examples: `C:\GEVISOFT\Examples\` (should check these next)
|
|
|
|
## 💡 Recommendations
|
|
|
|
1. **Check SDK Examples**: Look at `C:\GEVISOFT\Examples\` for working callback examples
|
|
2. **Ask Geutebruck Support**: If callback mechanism unclear, contact vendor
|
|
3. **Fallback Option**: If SDK callbacks too complex, consider hybrid:
|
|
- Use SDK for alarms list (`GeViSQ_GetFirstAlarm`/`GetNextAlarm`)
|
|
- For now, accept read-only alarm metadata
|
|
- Document limitation and revisit when SDK understanding improves
|
|
|
|
## Time Spent
|
|
|
|
- CHM extraction and documentation analysis: ~30 min
|
|
- SDK research and finding correct approach: ~45 min
|
|
- Implementation of AlarmQueryService: ~20 min
|
|
- Debugging compilation issues: ~15 min
|
|
- **Total: ~1h 50min**
|
|
|
|
## Status
|
|
|
|
🟡 **In Progress** - Core logic implemented, needs callback system fixes to compile
|