﻿<?xml version="1.0" encoding="utf-8"?>
<WorkflowBuilder Version="2.8.5"
                 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                 xmlns:rx="clr-namespace:Bonsai.Reactive;assembly=Bonsai.Core"
                 xmlns:harp="clr-namespace:Bonsai.Harp;assembly=Bonsai.Harp"
                 xmlns:p1="clr-namespace:Harp.FlyPAD;assembly=Harp.FlyPAD"
                 xmlns:io="clr-namespace:Bonsai.IO;assembly=Bonsai.System"
                 xmlns="https://bonsai-rx.org/2018/workflow">
  <Workflow>
    <Nodes>
      <Expression xsi:type="Annotation">
        <Name>1</Name>
        <Text><![CDATA[]]></Text>
      </Expression>
      <Expression xsi:type="rx:BehaviorSubject" TypeArguments="harp:HarpMessage">
        <rx:Name>Commands</rx:Name>
      </Expression>
      <Expression xsi:type="Combinator">
        <Combinator xsi:type="p1:Device">
          <harp:OperationMode>Active</harp:OperationMode>
          <harp:OperationLed>On</harp:OperationLed>
          <harp:DumpRegisters>true</harp:DumpRegisters>
          <harp:VisualIndicators>On</harp:VisualIndicators>
          <harp:Heartbeat>Disabled</harp:Heartbeat>
          <harp:IgnoreErrors>false</harp:IgnoreErrors>
          <harp:PortName>COM3</harp:PortName>
        </Combinator>
      </Expression>
      <Expression xsi:type="rx:PublishSubject">
        <Name>Messages</Name>
      </Expression>
      <Expression xsi:type="Annotation">
        <Name>1.1</Name>
        <Text><![CDATA[]]></Text>
      </Expression>
      <Expression xsi:type="p1:Parse">
        <harp:Register xsi:type="p1:CapacitanceValues" />
      </Expression>
      <Expression xsi:type="Annotation">
        <Name>2</Name>
        <Text><![CDATA[]]></Text>
      </Expression>
      <Expression xsi:type="p1:CreateMessage">
        <harp:MessageType>Write</harp:MessageType>
        <harp:Payload xsi:type="p1:CreateEnableAcquisitionPayload">
          <p1:EnableAcquisition>Enabled</p1:EnableAcquisition>
        </harp:Payload>
      </Expression>
      <Expression xsi:type="MulticastSubject">
        <Name>Commands</Name>
      </Expression>
      <Expression xsi:type="Annotation">
        <Name>3</Name>
        <Text><![CDATA[]]></Text>
      </Expression>
      <Expression xsi:type="SubscribeSubject">
        <Name>Messages</Name>
      </Expression>
      <Expression xsi:type="Combinator">
        <Combinator xsi:type="rx:SubscribeWhen" />
      </Expression>
      <Expression xsi:type="Annotation">
        <Name>4</Name>
        <Text><![CDATA[]]></Text>
      </Expression>
      <Expression xsi:type="SubscribeSubject">
        <Name>Messages</Name>
      </Expression>
      <Expression xsi:type="Combinator">
        <Combinator xsi:type="harp:GroupByRegister" />
      </Expression>
      <Expression xsi:type="Combinator">
        <Combinator xsi:type="harp:MessageWriter">
          <harp:FileName />
          <harp:Suffix>None</harp:Suffix>
          <harp:Buffered>true</harp:Buffered>
          <harp:Overwrite>false</harp:Overwrite>
          <harp:FilterType>Include</harp:FilterType>
          <harp:MessageType xsi:nil="true" />
        </Combinator>
      </Expression>
      <Expression xsi:type="Annotation">
        <Name>5</Name>
        <Text><![CDATA[]]></Text>
      </Expression>
      <Expression xsi:type="Combinator">
        <Combinator xsi:type="p1:GetDeviceMetadata" />
      </Expression>
      <Expression xsi:type="Combinator">
        <Combinator xsi:type="io:WriteAllText">
          <io:Path />
          <io:Overwrite>false</io:Overwrite>
          <io:Append>false</io:Append>
        </Combinator>
      </Expression>
    </Nodes>
    <Edges>
      <Edge From="0" To="1" Label="Source1" />
      <Edge From="1" To="2" Label="Source1" />
      <Edge From="2" To="3" Label="Source1" />
      <Edge From="3" To="5" Label="Source1" />
      <Edge From="4" To="5" Label="Source2" />
      <Edge From="6" To="7" Label="Source1" />
      <Edge From="7" To="8" Label="Source1" />
      <Edge From="8" To="11" Label="Source1" />
      <Edge From="9" To="10" Label="Source1" />
      <Edge From="10" To="11" Label="Source2" />
      <Edge From="12" To="13" Label="Source1" />
      <Edge From="13" To="14" Label="Source1" />
      <Edge From="14" To="15" Label="Source1" />
      <Edge From="16" To="17" Label="Source1" />
      <Edge From="17" To="18" Label="Source1" />
    </Edges>
  </Workflow>
</WorkflowBuilder>