Files
TeslaSuite/Launcher/LaunchModels_Shared.cs
T
CydandClaude Opus 4.8 548550b312 Initial commit: TeslaSuite monorepo (TeslaConsole + TeslaLauncher)
Co-locate the two cockpit-pod projects into a single repository:

- Console/  : TeslaConsole, the net48 WinForms operator console (decompiled
              reconstruction) plus its differential + catalog test suite.
- Launcher/ : TeslaLauncher, the net6 pod-side Service + Agent rewrite.

Adds a combined TeslaSuite.sln, root README documenting the shared wire
contract (and its current duplication, the main follow-up), and a root
.gitignore. Histories were not preserved per request; this is a fresh start
from the current working state of both projects.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-29 14:43:28 -05:00

121 lines
3.8 KiB
C#

// =============================================================================
// TeslaLauncher — Shared Models
// =============================================================================
// Wire types (Tesla.Net): BinaryFormatter-compatible replicas of the original
// structs from TeslaConsoleLaunchLib.dll. Field names, types, and order must
// match exactly for serialization compatibility.
//
// IPC types (Tesla.Launcher.Shared): JSON messages between Service and Agent
// over Named Pipe. These never touch the Console TCP connection.
// =============================================================================
using System;
using System.Reflection;
using System.Runtime.Serialization;
namespace Tesla.Net
{
/// <summary>RPC command from TeslaConsole. Function is a MethodBase of ILauncherService.</summary>
[Serializable]
public struct InvokeCommand
{
public MethodBase Function;
public object[] Parameters;
}
/// <summary>RPC result returned to TeslaConsole.</summary>
[Serializable]
public struct InvokeResult
{
public object Result;
public Exception Exception;
public TimeSpan CallDuration;
}
/// <summary>App identifier + display name pair.</summary>
[Serializable]
public struct LaunchPair
{
public Guid LaunchKey;
public string DisplayName;
}
/// <summary>Describes one launchable simulation application.</summary>
[Serializable]
public struct LaunchData
{
public LaunchPair LaunchPair;
public string WorkingDirectory;
public string ExeFile;
public string Arguments;
public bool AutoRestart;
}
/// <summary>Tracks a currently running simulation process.</summary>
[Serializable]
public struct LaunchedAppData
{
public int ProcessId;
public Guid LaunchKey;
}
/// <summary>Complete pod state snapshot for FullUpdate RPC.</summary>
[Serializable]
public struct FullUpdateData
{
public LaunchData[] InstalledApps;
public LaunchedAppData[] LaunchedApps;
public float VolumeLevel;
}
/// <summary>Progress of an out-of-band product installation.</summary>
[Serializable]
public struct OutOfBandProgress
{
public int PercentComplete;
public string Status;
public bool IsCompleted;
}
/// <summary>Interface for BinaryFormatter MethodBase resolution. Signatures must match the original exactly.</summary>
public interface ILauncherService
{
float VolumeLevel { get; set; }
void ClearStore();
DateTime Ping(DateTime now);
Guid InitiateInstallProduct();
OutOfBandProgress GetOutOfBandProgress(Guid invokeCallId);
int LaunchApp(Guid launchKey);
LaunchPair[] GetLaunchableApps();
void KillApp(Guid launchKey, int processId);
void KillAllOfType(Guid launchKey);
void KillAllApps();
void Shutdown(bool restart);
LaunchedAppData[] GetLaunchedApps();
LaunchData[] GetInstalledApps();
void RemoveApp(Guid index);
void InstallApp(LaunchData data);
void UninstallApp(Guid launchKey);
FullUpdateData FullUpdate();
}
}
namespace Tesla.Launcher.Shared
{
/// <summary>Command forwarded from the Windows Service to the Userspace Agent.</summary>
public sealed class IpcMessage
{
public string Command { get; set; }
public string LaunchKey { get; set; }
public string PayloadJson { get; set; }
}
/// <summary>Response from the Userspace Agent back to the Windows Service.</summary>
public sealed class IpcResponse
{
public bool Success { get; set; }
public string Message { get; set; }
public object Data { get; set; }
}
}