自定义工作流程编辑器到C#

时间:2018-10-16 10:02:56

标签: c# xml uml activity-diagram

我希望在业余时间使我的家庭自动化项目“轻松”自定义。这样我就可以向孩子们解释事情的进展。

项目的当前状态: 我得到了具有某种功能的设备(arduino的),例如控制LED或锁定和解锁门。

这些设备通过MQTT Broker与运行C#程序的桌面客户端进行通信。

每个设备都有唯一ID(MACAddress)和一组功能:LED亮,LED灭等。

我正在创建一个XML文件,该文件由网络中的每个设备组成。看起来像这样:

<?xml version="1.0"?>
<DeviceList>
    <Device>
        <FriendlyName>LockFrontdoor</FriendlyName>
        <Uid>D1-56-D4-93-94-EC</Uid>
        <ControllerType>Doorlock</ControllerType>
        <ControlList>
            <Control>
                <Name>LockOn</Name>
                <Command>/Lock/On</Command>
            </Control>
            <Control>
                <Name>LockOff</Name>
                <Command>/Lock/Off</Command>
            </Control>
            <Control>
                <Name>getLockState</Name>
                <Command>/Lock/getState</Command>
            </Control>
            <Control>
                <Name>getDoorState</Name>
                <Command>/Door/getState</Command>
            </Control>
            <Control>
                <Name>getDeviceState</Name>
                <Command>/getState</Command>
            </Control>
        </ControlList>
        <EventList>
            <Event>
                <Name>Disconnected</Name>
                <Command>/Disconnected</Command>
            </Event>
            <Event>
                <Name>Connected</Name>
                <Command>/Connected</Command>
            </Event>
            <Event>
                <Name>LockStateOn</Name>
                <Command>/Lockstate/On</Command>
            </Event>
            <Event>
                <Name>LockStateOff</Name>
                <Command>/Lockstate/Off</Command>
            </Event>
            <Event>
                <Name>DoorOpen</Name>
                <Command>/Doorstate/Open</Command>
            </Event>
            <Event>
                <Name>DoorClosed</Name>
                <Command>/Doorstate/Closed</Command>
            </Event>
        </EventList>
    </Device>
    <Device>
        <FriendlyName>LightFrontdoor</FriendlyName>
        <Uid>89-C9-7C-D8-B5-34</Uid>
        <ControllerType>Led</ControllerType>
        <ControlList>
            <Control>
                <Name>On</Name>
                <Command>/LED/On</Command>
            </Control>
            <Control>
                <Name>Off</Name>
                <Command>/LED/Off</Command>
            </Control>
            <Control>
                <Name>Blink</Name>
                <Command>/LED/Blink</Command>
            </Control>
            <Control>
                <Name>Color</Name>
                <Command>/LED/Color/1-255,1-255,1-255</Command>
            </Control>
            <Control>
                <Name>Intensity</Name>
                <Command>/LED/Intensity/1-255</Command>
            </Control>
            <Control>
                <Name>getState</Name>
                <Command>/LED/getState</Command>
            </Control>
            <Control>
                <Name>getDeviceState</Name>
                <Command>/getState</Command>
            </Control>
        </ControlList>
        <EventList>
            <Event>
                <Name>Disconnected</Name>
                <Command>/Disconnected</Command>
            </Event>
            <Event>
                <Name>Connected</Name>
                <Command>/Connected</Command>
            </Event>
            <Event>
                <Name>LedStateOn</Name>
                <Command>/LedState/On</Command>
            </Event>
            <Event>
                <Name>LedStateOff</Name>
                <Command>/LedState/Off</Command>
            </Event>
            <Event>
                <Name>LedStateBlink</Name>
                <Command>/LedState/Blink</Command>
            </Event>
        </EventList>
    </Device>
    <Device>
        <FriendlyName>SpeakerFrontDoor</FriendlyName>
        <Uid>F8-87-66-D3-81-E0</Uid>
        <ControllerType>Audio</ControllerType>
        <ControlList>
            <Control>
                <Name>PlaySound1</Name>
                <Command>/Audio/PlaySound1</Command>
            </Control>
            <Control>
                <Name>PlaySound2</Name>
                <Command>/Audio/PlaySound2</Command>
            </Control>
            <Control>
                <Name>getState</Name>
                <Command>/Audio/getState</Command>
            </Control>
            <Control>
                <Name>getDeviceState</Name>
                <Command>/getState</Command>
            </Control>
        </ControlList>
        <EventList>
            <Event>
                <Name>Disconnected</Name>
                <Command>/Disconnected</Command>
            </Event>
            <Event>
                <Name>Connected</Name>
                <Command>/Connected</Command>
            </Event>
            <Event>
                <Name>SoundStatePlaying</Name>
                <Command>/Audio/On</Command>
            </Event>
            <Event>
                <Name>SoundStateNotPlaying</Name>
                <Command>/Audio/Off</Command>
            </Event>
        </EventList>
    </Device>
</DeviceList>
    

我还创建了一个并行的序列(示例): UML Activity Diagram for the automation project

现在我要做的是创建一个编辑器,该编辑器可以导入我的XML,并可以在其中创建/编辑UML并以可以导入C#客户端以与设备一起使用的格式导出此UML。< / p>

我知道这可能真的很困难,但是我不确定从哪里开始。是否有任何软件可以正常价格执行此操作?还是有一种轻松做到这一点的方法?

我在Google上进行搜索,发现https://workflowengine.io似乎是一个完美的解决方案。但是,我需要支付我目前无法支付的$ 5,000。我确实有足够的空闲时间。

那么,什么是创建此目标的好方法?还是已经有框架或软件可以做到这一点?

0 个答案:

没有答案