Files
geutebruck-api/GeViScopeConfigReader/QUICK_START.md
Geutebruck API Developer dd2278b39a Complete Phase 0 and Phase 1 design documentation
- Add comprehensive research.md with SDK integration decisions
- Add complete data-model.md with 7 entities and relationships
- Add OpenAPI 3.0 specification (contracts/openapi.yaml)
- Add developer quickstart.md guide
- Add comprehensive tasks.md with 215 tasks organized by user story
- Update plan.md with complete technical context
- Add SDK_INTEGRATION_LESSONS.md capturing critical knowledge
- Add .gitignore for Python and C# projects
- Include GeViScopeConfigReader and GeViSoftConfigReader tools

Phase 1 Design Complete:
 Architecture: Python FastAPI + C# gRPC Bridge + GeViScope SDK
 10 user stories mapped to tasks (MVP = US1-4)
 Complete API contract with 17 endpoints
 Data model with User, Camera, Stream, Event, Recording, Analytics
 TDD approach enforced with 80+ test tasks

Ready for Phase 2: Implementation

🤖 Generated with Claude Code (https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-09 07:39:55 +01:00

300 lines
7.7 KiB
Markdown

# Quick Start Guide - GeViScope Configuration Reader
## What Was Created
A complete C# solution that reads GeViScope configuration from the server and exports it to JSON - **no binary .set file parsing needed!**
### Files Created
```
C:\DEV\COPILOT\geutebruck-api\GeViScopeConfigReader\
├── GeViScopeConfigReader.csproj - Project file
├── Program.cs - Main application code
├── README.md - Detailed documentation
└── QUICK_START.md - This file
```
## How It Works
Instead of parsing the binary `.set` files, this tool:
1. **Connects** to the GeViScope server using the official SDK
2. **Reads** the configuration registry (like Windows Registry)
3. **Converts** the tree structure to JSON
4. **Exports** to a human-readable file
## Building the Project
### Prerequisites
Install one of these:
- **Option A**: Visual Studio 2019/2022 with .NET desktop development
- **Option B**: .NET SDK 6.0+ with .NET Framework 4.8 targeting pack
### Build Steps
**Using Visual Studio:**
1. Install Visual Studio if not already installed
2. Open solution: `C:\DEV\COPILOT\geutebruck-api\geutebruck-api.sln`
3. Right-click `GeViScopeConfigReader` project → Build
**Using Command Line:**
```bash
# Install .NET SDK first if needed
cd C:\DEV\COPILOT\geutebruck-api\GeViScopeConfigReader
dotnet build
```
Or use MSBuild:
```bash
"C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\MSBuild.exe" GeViScopeConfigReader.csproj
```
## Running the Tool
### Step 1: Start GeViScope Server
```bash
cd "C:\Program Files (x86)\GeViScopeSDK\BIN"
GSCServer.exe
```
Leave this running in the background.
### Step 2: Run the Configuration Reader
```bash
cd C:\DEV\COPILOT\geutebruck-api\GeViScopeConfigReader\bin\Debug\net48
GeViScopeConfigReader.exe
```
Or with custom settings:
```bash
GeViScopeConfigReader.exe <server> <user> <password> <output.json>
```
### Step 3: View the JSON Output
Open `geviScope_config.json` in any text editor. You'll see:
```json
{
"System": {
"MediaChannels": {
"0000": {
"Name": "Camera 1",
"Enabled": true,
"GlobalNumber": 1
}
},
"Users": {
"SysAdmin": {
"Name": "System Administrator",
"Password": "abe6db4c9f5484fae8d79f2e868a673c",
"Enabled": true
},
"aa": {
"Name": "aa",
"Password": "aabbccddeeffgghhaabbccddeeffgghh",
"Enabled": true
}
}
}
}
```
## Why This Is Better Than Parsing .set Files
| Aspect | .set File Parsing | SDK Approach |
|--------|------------------|--------------|
| **Complexity** | Very high (binary format) | Low (documented API) |
| **Reliability** | Fragile | Robust |
| **Documentation** | None (proprietary) | Full SDK docs |
| **Format** | Binary blob | Structured tree |
| **Output** | Partial data | Complete config |
| **Updates** | Easy to break | Version stable |
## Example: Reading Specific Configuration
Once you have the JSON, you can easily extract what you need:
```csharp
using Newtonsoft.Json.Linq;
// Load the exported configuration
var config = JObject.Parse(File.ReadAllText("geviScope_config.json"));
// Get all users
var users = config["System"]["Users"];
foreach (var user in users)
{
string username = user.Path.Split('.').Last();
string name = (string)user["Name"];
string password = (string)user["Password"];
bool enabled = (bool)user["Enabled"];
Console.WriteLine($"User: {username}");
Console.WriteLine($" Name: {name}");
Console.WriteLine($" Password Hash: {password}");
Console.WriteLine($" Enabled: {enabled}");
Console.WriteLine();
}
// Get all cameras
var cameras = config["System"]["MediaChannels"];
foreach (var camera in cameras)
{
string cameraId = camera.Path.Split('.').Last();
string name = (string)camera["Name"];
int globalNum = (int)camera["GlobalNumber"];
Console.WriteLine($"Camera [{globalNum}]: {name} (ID: {cameraId})");
}
```
## Modifying Configuration
To write changes back to the server, use the SDK:
```csharp
using Geutebruck.GeViScope.GscDBI;
// 1. Connect to server
GscServer server = new GscServer();
server.Connect("localhost", "sysadmin", "masterkey", null, null);
// 2. Create registry accessor
GscRegistry registry = server.CreateRegistry();
// 3. Read current config
GscRegistryReadRequest[] readReq = new GscRegistryReadRequest[1];
readReq[0] = new GscRegistryReadRequest("/System/Users/aa", 0);
registry.ReadNodes(readReq, null, null);
// 4. Modify a value
GscRegNode userNode = registry.FindNode("/System/Users/aa");
userNode.WriteBoolean("Enabled", false); // Disable user
// 5. Save to server
GscRegistryWriteRequest[] writeReq = new GscRegistryWriteRequest[1];
writeReq[0] = new GscRegistryWriteRequest("/System/Users/aa", 0);
registry.WriteNodes(writeReq, true); // true = permanent save
Console.WriteLine("User 'aa' has been disabled!");
// 6. Cleanup
registry.Destroy();
server.Destroy();
```
## Real-World Use Cases
### 1. Backup All Configuration
```bash
GeViScopeConfigReader.exe localhost sysadmin masterkey backup_$(date +%Y%m%d).json
```
### 2. Compare Configurations
```bash
# Export from two servers
GeViScopeConfigReader.exe server1 admin pass server1_config.json
GeViScopeConfigReader.exe server2 admin pass server2_config.json
# Use any JSON diff tool
code --diff server1_config.json server2_config.json
```
### 3. Bulk User Management
```csharp
// Read config
var config = ReadConfiguration();
// Disable all users except sysadmin
foreach (var userNode in GetUserNodes(registry))
{
if (userNode.Name != "SysAdmin")
{
userNode.WriteBoolean("Enabled", false);
}
}
// Save
SaveConfiguration();
```
### 4. Configuration as Code
```csharp
// Define desired configuration in code
var desiredConfig = new {
Users = new[] {
new { Name = "operator1", Enabled = true },
new { Name = "operator2", Enabled = true }
},
Cameras = new[] {
new { GlobalNumber = 1, Name = "Entrance" },
new { GlobalNumber = 2, Name = "Parking Lot" }
}
};
// Apply to server
ApplyConfiguration(desiredConfig);
```
## Next Steps
1. **Build the project** using Visual Studio or dotnet CLI
2. **Run against your server** to export configuration
3. **Examine the JSON** to understand the structure
4. **Modify the code** to add your specific features
## GeViSoft Alternative
For GeViSoft configuration, you can:
**Option A**: Access the database directly (it's Microsoft Access format)
```csharp
using System.Data.OleDb;
string connStr = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\GEVISOFT\DATABASE\GeViDB.mdb";
using (var conn = new OleDbConnection(connStr))
{
conn.Open();
var cmd = new OleDbCommand("SELECT * FROM [Users]", conn);
using (var reader = cmd.ExecuteReader())
{
while (reader.Read())
{
Console.WriteLine($"User: {reader["Username"]}");
}
}
}
```
**Option B**: Use the GeViAPI (similar to GeViScope)
```csharp
using GeViAPI_Namespace;
GeViAPIClient client = new GeViAPIClient(
"MyServer", "127.0.0.1", "sysadmin", password, null, null);
client.Connect(progressCallback, this);
// Use SendQuery methods to read/write configuration
```
## Support
For SDK documentation:
- Local: `C:\Program Files (x86)\GeViScopeSDK\Documentation\`
- Text: `C:\DEV\COPILOT\SOURCES\GeViScope_SDK_text\`
- Examples: `C:\Program Files (x86)\GeViScopeSDK\Examples\`
For issues with this tool:
- Check README.md for troubleshooting
- Review the SDK documentation
- Examine the example code in Program.cs
---
**Summary**: Instead of struggling with binary .set files, use the official SDK to read configuration in a clean, documented way. The SDK provides everything you need! 🎉