<Ui xmlns="http://www.blizzard.com/wow/ui/"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://www.blizzard.com/wow/ui/ ..\FrameXML\UI.xsd">
  <!--
    MidnightXmit – Pixel-Kanal für MidnightRGBBridge
    ==================================================
    11 Frames à 32×16 px, Standardanker UIParent BOTTOMLEFT (0,0), frameStrata="TOOLTIP"
    (damit sie immer oben liegen und nicht vom UI verdeckt werden).
    Position wird per MidnightXmit:ApplyPosition() zur Laufzeit gesetzt (v1.0).

    Layout (x-Positionen im WoW-Koordinatensystem):
      x=0   L1  – Guard-Anker, immer ON (statischer Marker für Sync-Prüfung)
      x=3   L2  – Guard-Toggle (AN = neue Message bereit, AUS = wird verarbeitet)
      x=6   D7  – Datenbit 6 (Wert 64)
      x=9   D6  – Datenbit 5 (Wert 32)
      x=12  D5  – Datenbit 4 (Wert 16)
      x=15  D4  – Datenbit 3 (Wert  8)
      x=18  D3  – Datenbit 2 (Wert  4)
      x=21  D2  – Datenbit 1 (Wert  2)
      x=24  D1  – Datenbit 0 (Wert  1)
      x=27  R1  – Guard-Anker, immer ON
      x=30  R2  – Guard-Toggle (spiegelt L2, für Redundanz-Check)

    Protokoll:
      1. Datenbits D1-D7 auf ASCII-Byte der Message setzen
      2. Guard L2/R2 auf OFF (schwarz) → App ignoriert
      3. ~150 ms warten
      4. Guard L2/R2 auf ON (weiß) → App liest D1-D7 aus
      5. ~150 ms warten → nächste Message
  -->

  <!-- Wiederverwendbares Template für jeden Pixel-Frame -->
  <Frame name="MXmtPixelTemplate" virtual="true"
         enableMouse="false" frameStrata="TOOLTIP">
    <Size x="32" y="16"/>
    <Layers>
      <Layer level="ARTWORK">
        <Texture name="$parentTex"
                 file="Interface\AddOns\MidnightHUD\Modules\MidnightXmit\mxmt_off"
                 setAllPoints="true"/>
      </Layer>
    </Layers>
  </Frame>

  <!-- Haupt-Frame: Container für alle Pixel-Frames + Script-Hooks.
       Größe: 62×16 px (11 Frames à 32px, je 3px versetzt: FrameX[10]=30, +32=62).
       Position wird durch Lua ApplyPosition() gesetzt (BOTTOMLEFT Standard).
       Als Edit-Mode-Element registriert via LibEditMode (v1.0). -->
  <Frame name="MXmtFrame" enableMouse="false" hidden="true" frameStrata="TOOLTIP">
    <Size x="62" y="16"/>
    <Anchors>
      <Anchor point="BOTTOMLEFT" relativePoint="BOTTOMLEFT" relativeTo="UIParent">
        <Offset x="0" y="0"/>
      </Anchor>
    </Anchors>
    <Scripts>
      <OnLoad>  MidnightXmit:OnLoad()           </OnLoad>
      <!-- Kein RegisterEvent: MidnightXmit pollt gedrosselt in OnUpdate. -->
      <OnUpdate>MidnightXmit:OnUpdate(elapsed)   </OnUpdate>
    </Scripts>

    <Frames>

      <!-- L1: Guard-Anker (immer weiß) — verankert an TOPLEFT von MXmtFrame -->
      <Frame name="MXmtL1" inherits="MXmtPixelTemplate">
        <Anchors>
          <Anchor point="TOPLEFT" relativePoint="TOPLEFT" relativeTo="MXmtFrame">
            <Offset x="0" y="0"/>
          </Anchor>
        </Anchors>
      </Frame>

      <!-- L2: Guard-Toggle -->
      <Frame name="MXmtL2" inherits="MXmtPixelTemplate">
        <Anchors>
          <Anchor point="TOPLEFT" relativePoint="TOPLEFT" relativeTo="MXmtL1">
            <Offset x="3" y="0"/>
          </Anchor>
        </Anchors>
      </Frame>

      <!-- D7 = Bit 6 -->
      <Frame name="MXmtD7" inherits="MXmtPixelTemplate">
        <Anchors>
          <Anchor point="TOPLEFT" relativePoint="TOPLEFT" relativeTo="MXmtL2">
            <Offset x="3" y="0"/>
          </Anchor>
        </Anchors>
      </Frame>

      <!-- D6 = Bit 5 -->
      <Frame name="MXmtD6" inherits="MXmtPixelTemplate">
        <Anchors>
          <Anchor point="TOPLEFT" relativePoint="TOPLEFT" relativeTo="MXmtD7">
            <Offset x="3" y="0"/>
          </Anchor>
        </Anchors>
      </Frame>

      <!-- D5 = Bit 4 -->
      <Frame name="MXmtD5" inherits="MXmtPixelTemplate">
        <Anchors>
          <Anchor point="TOPLEFT" relativePoint="TOPLEFT" relativeTo="MXmtD6">
            <Offset x="3" y="0"/>
          </Anchor>
        </Anchors>
      </Frame>

      <!-- D4 = Bit 3 -->
      <Frame name="MXmtD4" inherits="MXmtPixelTemplate">
        <Anchors>
          <Anchor point="TOPLEFT" relativePoint="TOPLEFT" relativeTo="MXmtD5">
            <Offset x="3" y="0"/>
          </Anchor>
        </Anchors>
      </Frame>

      <!-- D3 = Bit 2 -->
      <Frame name="MXmtD3" inherits="MXmtPixelTemplate">
        <Anchors>
          <Anchor point="TOPLEFT" relativePoint="TOPLEFT" relativeTo="MXmtD4">
            <Offset x="3" y="0"/>
          </Anchor>
        </Anchors>
      </Frame>

      <!-- D2 = Bit 1 -->
      <Frame name="MXmtD2" inherits="MXmtPixelTemplate">
        <Anchors>
          <Anchor point="TOPLEFT" relativePoint="TOPLEFT" relativeTo="MXmtD3">
            <Offset x="3" y="0"/>
          </Anchor>
        </Anchors>
      </Frame>

      <!-- D1 = Bit 0 (LSB) -->
      <Frame name="MXmtD1" inherits="MXmtPixelTemplate">
        <Anchors>
          <Anchor point="TOPLEFT" relativePoint="TOPLEFT" relativeTo="MXmtD2">
            <Offset x="3" y="0"/>
          </Anchor>
        </Anchors>
      </Frame>

      <!-- R1: Guard-Anker (immer weiß) -->
      <Frame name="MXmtR1" inherits="MXmtPixelTemplate">
        <Anchors>
          <Anchor point="TOPLEFT" relativePoint="TOPLEFT" relativeTo="MXmtD1">
            <Offset x="3" y="0"/>
          </Anchor>
        </Anchors>
      </Frame>

      <!-- R2: Guard-Toggle (spiegelt L2) -->
      <Frame name="MXmtR2" inherits="MXmtPixelTemplate">
        <Anchors>
          <Anchor point="TOPLEFT" relativePoint="TOPLEFT" relativeTo="MXmtR1">
            <Offset x="3" y="0"/>
          </Anchor>
        </Anchors>
      </Frame>

    </Frames>
  </Frame>

</Ui>
