Skip to content

Minimal Generated Adapter

This is a synthetic example showing the smallest modern adapter shape.

Files

  • Pq.Adapter.Demo.csproj
  • adapter-registration.yaml
  • Devices/DemoPanel.cs
  • Commands/DoorCommands.cs

Project File

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
    <EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
    <CompilerGeneratedFilesOutputPath>.\.GeneratedFiles</CompilerGeneratedFilesOutputPath>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.Extensions.Hosting" />
    <PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" />
  </ItemGroup>

  <ItemGroup>
    <ProjectReference Include="..\..\Pq.Adapters.Framework\Pq.Adapters.Framework.csproj" />
    <ProjectReference Include="..\..\Pq.Domain\Pq.Domain.csproj" />
    <ProjectReference Include="..\..\Pq.Adapters.Framework.SourceGenerator\Pq.Adapters.Framework.SourceGenerator.csproj"
                      OutputItemType="Analyzer"
                      ReferenceOutputAssembly="false" />
  </ItemGroup>

  <ItemGroup>
    <AdditionalFiles Include="adapter-registration.yaml" />
  </ItemGroup>
</Project>

YAML

adapter_id: "00000000-0000-0000-0000-000000000100"
name: "Demo Generated Adapter"
version: "1.0.0"
manufacturer: "Demo"
description: "Synthetic minimal adapter example"
adapter_type: "security"
security_domains: ["access"]

capabilities:
  auto_discovery: false
  time_sync: false
  firmware_update: false
  config_backup: false

transport:
  type: custom
  protocol:
    type: "None"

device_types:
  - type_id: "DemoPanel"
    name: "Demo Panel"
    description: "Synthetic root device"
    commands:
    functions:

  - type_id: "DemoDoor"
    name: "Demo Door"
    description: "Synthetic command target"
    category: door
    access_point: true
    commands:
      - pq.command.access.open
    functions:
      Door:
    parents:
      DemoPanel:
        max_siblings: 16
        required: true

Notes

  • startup is source-generated after build
  • no handwritten Program.cs is required
  • this shape is best for command and function behavior prototyping