feat: Geutebruck GeViScope/GeViSoft Action Mapping System - MVP
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>
This commit is contained in:
326
STRUCTURED_ACTIONS_GUIDE.md
Normal file
326
STRUCTURED_ACTIONS_GUIDE.md
Normal file
@@ -0,0 +1,326 @@
|
||||
# Structured Action Mappings - Edit Guide
|
||||
|
||||
## ✅ What's New
|
||||
|
||||
Actions are now parsed into **structured format** so you can easily edit action names AND parameters separately!
|
||||
|
||||
## Output Format
|
||||
|
||||
### Before (Simple strings):
|
||||
```json
|
||||
{
|
||||
"id": 1,
|
||||
"actions": ["VMD_Start(101050)", "CrossSwitch(101050, 3, 0)"]
|
||||
}
|
||||
```
|
||||
|
||||
### After (Structured with action + parameters):
|
||||
```json
|
||||
{
|
||||
"id": 1,
|
||||
"actions": [
|
||||
{
|
||||
"action": "VMD_Start",
|
||||
"parameters": ["101050"]
|
||||
},
|
||||
{
|
||||
"action": "CrossSwitch",
|
||||
"parameters": ["101050", "3", "0"]
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## How to Edit
|
||||
|
||||
### Example 1: Change Parameters
|
||||
|
||||
**Original:**
|
||||
```json
|
||||
{
|
||||
"id": 10,
|
||||
"actions": [
|
||||
{
|
||||
"action": "VMD_Start",
|
||||
"parameters": ["101050"]
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
**Edit camera ID from 101050 to 101027:**
|
||||
```json
|
||||
{
|
||||
"id": 10,
|
||||
"actions": [
|
||||
{
|
||||
"action": "VMD_Start",
|
||||
"parameters": ["101027"] ← Changed
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
### Example 2: Add Parameters to Action
|
||||
|
||||
**Original:**
|
||||
```json
|
||||
{
|
||||
"id": 5,
|
||||
"actions": [
|
||||
{
|
||||
"action": "GSC ViewerConnectLive V <- C",
|
||||
"parameters": []
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
**Add camera parameter:**
|
||||
```json
|
||||
{
|
||||
"id": 5,
|
||||
"actions": [
|
||||
{
|
||||
"action": "ViewerConnectLive",
|
||||
"parameters": ["101050", "1"] ← Added parameters
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
### Example 3: Add Multiple Actions to One Mapping
|
||||
|
||||
**Original:**
|
||||
```json
|
||||
{
|
||||
"id": 15,
|
||||
"actions": [
|
||||
{
|
||||
"action": "VMD_Start",
|
||||
"parameters": ["101050"]
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
**Add CrossSwitch action:**
|
||||
```json
|
||||
{
|
||||
"id": 15,
|
||||
"actions": [
|
||||
{
|
||||
"action": "VMD_Start",
|
||||
"parameters": ["101050"]
|
||||
},
|
||||
{
|
||||
"action": "CrossSwitch",
|
||||
"parameters": ["101050", "3", "0"] ← Added new action
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
### Example 4: Create New Action Mapping
|
||||
|
||||
**Add at end of action_mappings array:**
|
||||
```json
|
||||
{
|
||||
"id": 65,
|
||||
"actions": [
|
||||
{
|
||||
"action": "VMD_Start",
|
||||
"parameters": ["101051"]
|
||||
},
|
||||
{
|
||||
"action": "SendMail",
|
||||
"parameters": ["admin@example.com", "Motion detected"]
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## Common Action Types
|
||||
|
||||
### Video Motion Detection (VMD)
|
||||
```json
|
||||
{
|
||||
"action": "VMD_Start",
|
||||
"parameters": ["101050"] // Camera ID
|
||||
}
|
||||
```
|
||||
|
||||
### Cross Switch (Switch Video to Monitor)
|
||||
```json
|
||||
{
|
||||
"action": "CrossSwitch",
|
||||
"parameters": ["101050", "3", "0"] // Camera ID, Monitor, ???
|
||||
}
|
||||
```
|
||||
|
||||
### Send Email
|
||||
```json
|
||||
{
|
||||
"action": "SendMail",
|
||||
"parameters": ["user@example.com", "Alert message"]
|
||||
}
|
||||
```
|
||||
|
||||
### Viewer Connect Live
|
||||
```json
|
||||
{
|
||||
"action": "ViewerConnectLive",
|
||||
"parameters": ["101050"] // Camera ID
|
||||
}
|
||||
```
|
||||
|
||||
### Digital Output Control
|
||||
```json
|
||||
{
|
||||
"action": "SetDigitalOutput",
|
||||
"parameters": ["1", "close"] // Output number, state
|
||||
}
|
||||
```
|
||||
|
||||
### PTZ Camera Control
|
||||
```json
|
||||
{
|
||||
"action": "PanLeft",
|
||||
"parameters": [] // No parameters needed
|
||||
}
|
||||
```
|
||||
```json
|
||||
{
|
||||
"action": "GotoPreset",
|
||||
"parameters": ["5"] // Preset number
|
||||
}
|
||||
```
|
||||
|
||||
## Current File Actions
|
||||
|
||||
Your current `action_mappings_clean.json` contains mostly **system messages** and **simple commands** without parameters:
|
||||
|
||||
- System messages: `"GSC warning: demo mode for 10 min"`
|
||||
- Simple commands: `"GSC ViewerConnectLive V <- C"`
|
||||
- PTZ controls: `"GSC PanLeft"`, `"GSC TiltUp"`, etc.
|
||||
|
||||
These are stored as:
|
||||
```json
|
||||
{
|
||||
"action": "GSC warning: demo mode for 10 min",
|
||||
"parameters": []
|
||||
}
|
||||
```
|
||||
|
||||
## Editing Workflow
|
||||
|
||||
### 1. Export
|
||||
```bash
|
||||
cd C:\DEV\COPILOT
|
||||
python save_action_mappings.py
|
||||
```
|
||||
|
||||
This creates `action_mappings_clean.json`
|
||||
|
||||
### 2. Edit the JSON
|
||||
|
||||
Open in any text editor and modify:
|
||||
|
||||
```json
|
||||
{
|
||||
"action_mappings": [
|
||||
{
|
||||
"id": 1,
|
||||
"actions": [
|
||||
{
|
||||
"action": "VMD_Start",
|
||||
"parameters": ["101050"] ← Edit camera ID
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 65, ← Add new mapping
|
||||
"actions": [
|
||||
{
|
||||
"action": "CrossSwitch",
|
||||
"parameters": ["101050", "3", "0"]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
### 3. Import Back
|
||||
|
||||
**Via REST API:**
|
||||
```bash
|
||||
curl -X POST \
|
||||
-H "Authorization: Bearer YOUR_TOKEN" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d @action_mappings_clean.json \
|
||||
http://localhost:8000/api/v1/configuration/action-mappings/import
|
||||
```
|
||||
|
||||
**Request body format:**
|
||||
```json
|
||||
{
|
||||
"actionMappings": [
|
||||
{
|
||||
"name": "Rules",
|
||||
"actions": [
|
||||
{
|
||||
"action": "VMD_Start",
|
||||
"parameters": ["101050"]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## Format Conversion
|
||||
|
||||
The system automatically converts between formats:
|
||||
|
||||
**Structured → Action String:**
|
||||
- `{"action": "VMD_Start", "parameters": ["101050"]}` → `"VMD_Start(101050)"`
|
||||
- `{"action": "CrossSwitch", "parameters": ["101050", "3", "0"]}` → `"CrossSwitch(101050, 3, 0)"`
|
||||
- `{"action": "PanLeft", "parameters": []}` → `"PanLeft"`
|
||||
|
||||
**Action String → Structured:**
|
||||
- `"VMD_Start(101050)"` → `{"action": "VMD_Start", "parameters": ["101050"]}`
|
||||
- `"CrossSwitch(101050, 3, 0)"` → `{"action": "CrossSwitch", "parameters": ["101050", "3", "0"]}`
|
||||
- `"GSC PanLeft"` → `{"action": "GSC PanLeft", "parameters": []}`
|
||||
|
||||
## Tips
|
||||
|
||||
1. **IDs are sequential** - They're just for reference, not stored in GeViSoft
|
||||
2. **Parameters are strings** - Even numbers like "101050" are stored as strings
|
||||
3. **Spacing doesn't matter** - The system strips whitespace from parameters
|
||||
4. **Empty parameters** - Use `[]` for actions without parameters
|
||||
5. **Validation** - The import endpoint will validate before writing to GeViSoft
|
||||
|
||||
## Quick Reference
|
||||
|
||||
| Action | Format | Example |
|
||||
|--------|--------|---------|
|
||||
| Start VMD | `VMD_Start(CameraID)` | `{"action": "VMD_Start", "parameters": ["101050"]}` |
|
||||
| Cross Switch | `CrossSwitch(Camera, Monitor, Mode)` | `{"action": "CrossSwitch", "parameters": ["101050", "3", "0"]}` |
|
||||
| Send Email | `SendMail(Email, Message)` | `{"action": "SendMail", "parameters": ["user@mail.com", "Alert"]}` |
|
||||
| Set Output | `SetDigitalOutput(ID, State)` | `{"action": "SetDigitalOutput", "parameters": ["1", "close"]}` |
|
||||
| PTZ Control | `PanLeft()` | `{"action": "PanLeft", "parameters": []}` |
|
||||
|
||||
## Next Steps
|
||||
|
||||
1. ✅ Export your current mappings (done - `action_mappings_clean.json`)
|
||||
2. ⏭️ Study the format and plan your changes
|
||||
3. ⏭️ Edit the JSON file to add/modify actions
|
||||
4. ⏭️ Test import functionality
|
||||
5. ⏭️ Verify in GeViSoft
|
||||
|
||||
---
|
||||
|
||||
**Status**: ✅ Ready to use
|
||||
**File**: `action_mappings_clean.json`
|
||||
**Format**: Structured (action + parameters)
|
||||
Reference in New Issue
Block a user