Transactions

The transactions (_tr.xml) file defines the transactions which are the logical flow of messages between the protocol adapter and the management server.

The contents of hue_light_tr.xml are shown here.



<?xml version="1.0"?>
<TransactionDescriptor xmlns="http://IoTProtocol"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://IoTProtocol ../../../Schemas/Soti.IoT.Schema.Definitions/content/transactions.xsd">

    <Transaction id="GetPAObject">
        <Blocks>
            <Block id="1">
                <SendMessage id="GetPSP" idref="GetPSP">
                </SendMessage>
                <ReceiveMessage idref="PSP">
                </ReceiveMessage>
                <BlockAction>
                    <Terminate success="true">
                    </Terminate>
                </BlockAction>
            </Block>
        </Blocks>
    </Transaction>

    <!--
    <Transaction id="DiscoverBridges">
        <Blocks>
            <Block id="1">
                <SendMessage id="GetBridges" idref="GetBridges"/>
                <Switch>
                    <OnMessageType>
                        <Case>
                            <ReceiveMessage idref="Bridges"/>
                            <BlockAction>
                                <TransactionSuccess/>
                            </BlockAction>
                        </Case>
                        <Case>
                            <ReceiveMessage idref="Error"/>
                            <BlockAction>
                                <TransactionError>
                                    <ErrorSegment>Resource</ErrorSegment>
                                </TransactionError>
                            </BlockAction>
                        </Case>
                    </OnMessageType>
                </Switch>
            </Block>
        </Blocks>
    </Transaction>
    -->

    <Transaction id="RegisterToBridge">
        <Blocks>
            <Block id="1">
                <SendMessage id="Register" idref="Register"/>
                <Switch>
                    <OnMessageType>
                        <Case>
                            <ReceiveMessage idref="Success">
                            </ReceiveMessage>
                            <BlockAction>
                                <Terminate success="true">
                                </Terminate>
                            </BlockAction>
                        </Case>
                        <Case>
                            <ReceiveMessage idref="Error">
                                <Variable id="Resource">Resource</Variable>
                            </ReceiveMessage>
                            <BlockAction>
                                <Terminate success="false">
                                    <Log idref="Resource"/>
                                </Terminate>
                            </BlockAction>
                        </Case>
                    </OnMessageType>
                </Switch>
            </Block>
        </Blocks>
    </Transaction>

    <Transaction id="DiscoverDevices">
        <Blocks>
            <Block id="1">
                <SendMessage id="GetDevices" idref="GetDevices"/>
                <Switch>
                    <OnMessageType>
                        <Case>
                            <ReceiveMessage idref="NewDevices"/>
                            <BlockAction>
                                <GoToBlock idref="2"/>
                            </BlockAction>
                        </Case>
                        <Case>
                                <ReceiveMessage idref="Error">
                                    <Variable id="Resource">Resource</Variable>
                                </ReceiveMessage>
                                <BlockAction>
                                    <Terminate success="false">
                                        <Log idref="Resource"/>
                                    </Terminate>
                                </BlockAction>
                        </Case>
                    </OnMessageType>
                </Switch>
            </Block>
            <Block id="2">
                <SendMessage id="GetLights" idref="GetLights"/>
                <BlockAction>
                    <Terminate success="true"></Terminate>
                </BlockAction>
            </Block>
        </Blocks>
    </Transaction>

    <Transaction id="RegisterToFirstDiscoveredBridgeAndDiscoverDevices">
        <Blocks>
            <Block id="1">
            <SendMessage id="RegisterToAny" idref="RegisterToAny"/>
                <Switch>
                    <OnMessageType>
                        <Case>
                            <ReceiveMessage idref="Success"/>
                            <BlockAction>
                                <GoToBlock idref="2"/>
                            </BlockAction>
                        </Case>
                        <Case>
                            <ReceiveMessage idref="Error">
                                <Variable id="Resource">Resource</Variable>
                            </ReceiveMessage>
                            <BlockAction>
                                <Terminate success="false">
                                    <Log idref="Resource"/>
                                </Terminate>
                            </BlockAction>
                        </Case>
                    </OnMessageType>
                </Switch>
            </Block>
            <Block id="2">
                <SendMessage id="GetDevices" idref="GetDevices"/>
                <Switch>
                    <OnMessageType>
                        <Case>
                            <ReceiveMessage idref="NewDevices"/>
                            <BlockAction>
                                <GoToBlock idref="3"/>
                            </BlockAction>
                        </Case>
                        <Case>
                            <ReceiveMessage idref="Error">
                                <Variable id="Resource2">Resource</Variable>
                            </ReceiveMessage>
                            <BlockAction>
                                <Terminate success="false">
                                    <Log idref="Resource2"/>
                                </Terminate>
                            </BlockAction>
                        </Case>
                    </OnMessageType>
                </Switch>
            </Block>
            <Block id="3">
                <SendMessage id="GetLights" idref="GetLights"/>
                <BlockAction>
                    <Terminate success="true"></Terminate>
                </BlockAction>
            </Block>
        </Blocks>
    </Transaction>

    <!--
    <Transaction id="GetLog">
        <Blocks>
            <Block id="1">
                <SendMessage id="GetLog" idref="GetLog"/>
                <Switch>
                    <OnMessageType>
                        <Case>
                            <ReceiveMessage idref="Log"/>
                            <BlockAction>
                                <Terminate success="true"></Terminate>
                            </BlockAction>
                        </Case>
                        <Case>
                            <ReceiveMessage idref="Error">
                                <Variable id="Resource">Resource</Variable>
                            </ReceiveMessage>
                            <BlockAction>
                                <Terminate success="false">
                                    <Log idref="Resource"/>
                                </Terminate>
                            </BlockAction>
                        </Case>
                    </OnMessageType>
                </Switch>
            </Block>
        </Blocks>
    </Transaction>
    -->

    <!--
    <Transaction id="SetLog">
        <Blocks>
            <Block id="1">
                <SendMessage id="SetLog" idref="SetLog"/>
                <Switch>
                    <OnMessageType>
                        <Case>
                            <ReceiveMessage    idref="Success"/>
                            <BlockAction>
                                <TransactionSuccess/>
                            </BlockAction>
                        </Case>
                        <Case>
                            <ReceiveMessage idref="Error"/>
                            <BlockAction>
                                <TransactionError>
                                    <ErrorSegment>Resource</ErrorSegment>
                                </TransactionError>
                            </BlockAction>
                        </Case>
                    </OnMessageType>
                </Switch>
            </Block>
        </Blocks>
    </Transaction>
    -->

    <Transaction id="FindAvailableLights">
        <Blocks>
            <Block id="1">
                <SendMessage id="SearchNewLights" idref="SearchNewLights"/>
                <Switch>
                    <OnMessageType    timeout="3000">
                        <Case>
                            <ReceiveMessage    idref="Success"/>
                            <BlockAction>
                                <GoToBlock idref="2"/>
                            </BlockAction>
                        </Case>
                        <Case>
                            <ReceiveMessage idref="Error">
                                <Variable id="Resource">Resource</Variable>
                            </ReceiveMessage>
                            <BlockAction>
                                <Terminate success="false">
                                    <Log idref="Resource"/>
                                </Terminate>
                            </BlockAction>
                        </Case>
                    </OnMessageType>
                </Switch>
            </Block>
            <Block id="2">
                <SendMessage id="GetNewLights" idref="GetNewLights"/>
                <Switch>
                    <OnMessageType>
                        <Case>
                            <ReceiveMessage idref="NewDevices"/>
                            <BlockAction>
                                <GoToBlock idref="3"/>
                            </BlockAction>
                        </Case>
                        <Case>
                            <ReceiveMessage idref="Error">
                                <Variable id="Resource2">Resource</Variable>
                            </ReceiveMessage>
                            <BlockAction>
                                <Terminate success="false">
                                    <Log idref="Resource2"/>
                                </Terminate>
                            </BlockAction>
                        </Case>
                    </OnMessageType>
                </Switch>
            </Block>
            <Block id="3">
                <SendMessage id="GetLights" idref="GetLights"/>
                <BlockAction>
                    <Terminate success="true"></Terminate>
                </BlockAction>
            </Block>
        </Blocks>
    </Transaction>

    <Transaction id="ColorDeviceState">
        <DeviceProfile idref="HueLight"/>
        <Blocks>
            <Block id="1">
                <ReceiveMessage idref="Light"/>
                <BlockAction>
                    <Terminate success="true"></Terminate>
                </BlockAction>
            </Block>
        </Blocks>
    </Transaction>

    <Transaction id="DeviceState">
        <DeviceProfile idref="HueBWLight"/>
        <Blocks>
            <Block id="1">
                <ReceiveMessage idref="BWLight"/>
                <BlockAction>
                    <Terminate success="true"></Terminate>
                </BlockAction>
            </Block>
        </Blocks>
    </Transaction>

    <!--
    <Transaction id="FactoryReset">
        <Blocks>
            <Block id="1">
                <SendMessage id="FactoryReset" idref="FactoryReset"/>
                <Switch>
                    <OnMessageType>
                        <Case>
                            <ReceiveMessage id="Success" idref="Success"/>
                            <BlockAction>
                                <TransactionSuccess/>
                            </BlockAction>
                        </Case>
                        <Case>
                            <ReceiveMessage id="Error" idref="Error"/>
                            <BlockAction>
                                <TransactionError>
                                    <ErrorSegment idref="Resource"/>
                                </TransactionError>
                            </BlockAction>
                        </Case>
                    </OnMessageType>
                </Switch>
            </Block>
        </Blocks>
    </Transaction>
    -->

    <Transaction id="CheckIn">
        <DeviceProfile idref="HueLight"/>
        <Blocks>
            <Block id="1">
                <SendMessage id="GetLight" idref="GetLight"/>
                <Switch>
                    <OnMessageType>
                        <Case>
                            <ReceiveMessage    idref="Light"/>
                            <BlockAction>
                                <Terminate success="true"></Terminate>
                            </BlockAction>
                        </Case>
                        <Case>
                            <ReceiveMessage idref="Error">
                                <Variable id="Resource">Resource</Variable>
                            </ReceiveMessage>
                            <BlockAction>
                                <Terminate success="false">
                                    <Log idref="Resource"/>
                                </Terminate>
                            </BlockAction>
                        </Case>
                    </OnMessageType>
                </Switch>
            </Block>
        </Blocks>
    </Transaction>

    <Transaction id="CheckIn(BW)">
        <DeviceProfile idref="HueBWLight"/>
        <Blocks>
            <Block id="1">
                <SendMessage id="GetLight" idref="GetLight"/>
                <Switch>
                    <OnMessageType>
                        <Case>
                            <ReceiveMessage    idref="BWLight"/>
                            <BlockAction>
                                <Terminate success="true"></Terminate>
                            </BlockAction>
                        </Case>
                        <Case>
                            <ReceiveMessage idref="Error">
                                <Variable id="Resource">Resource</Variable>
                            </ReceiveMessage>
                            <BlockAction>
                                <Terminate success="false">
                                    <Log idref="Resource"/>
                                </Terminate>
                            </BlockAction>
                        </Case>
                    </OnMessageType>
                </Switch>
            </Block>
        </Blocks>
    </Transaction>

    <Transaction id="RenameLight">
        <DeviceProfile idref="HueLight"/>
        <DeviceProfile idref="HueBWLight"/>
        <Blocks>
            <Block id="1">
                <SendMessage id="RenameLight" idref="RenameLight"/>
                <Switch>
                    <OnMessageType>
                        <Case>
                            <ReceiveMessage    idref="Success"/>
                            <BlockAction>
                                <Terminate success="true"></Terminate>
                            </BlockAction>
                        </Case>
                        <Case>
                            <ReceiveMessage idref="Error">
                                <Variable id="Resource">Resource</Variable>
                            </ReceiveMessage>
                            <BlockAction>
                                <Terminate success="false">
                                    <Log idref="Resource"/>
                                </Terminate>
                            </BlockAction>
                        </Case>
                    </OnMessageType>
                </Switch>
            </Block>
        </Blocks>
    </Transaction>

    <!--
    <Transaction id="RemoveLight">
        <DeviceProfile idref="HueLight"/>
        <Blocks>
            <Block id="1">
                <SendMessage id="DeleteLight" idref="DeleteLight"/>
                <Switch>
                    <OnMessageType>
                        <Case>
                            <ReceiveMessage idref="Success"/>
                            <BlockAction>
                                <TransactionSuccess/>
                            </BlockAction>
                        </Case>
                        <Case>
                            <ReceiveMessage    idref="Error"/>
                            <BlockAction>
                                <TransactionError>
                                    <ErrorSegment>Resource</ErrorSegment>
                                </TransactionError>
                            </BlockAction>
                        </Case>
                    </OnMessageType>
                </Switch>
            </Block>
        </Blocks>
    </Transaction>
    -->

    <Transaction id="TurnOn">
        <DeviceProfile idref="HueLight"/>
        <DeviceProfile idref="HueBWLight"/>
        <Blocks>
            <Block id="1">
                <SendMessage id="LightTurnOn" idref="LightTurnOn"/>
                <Switch>
                    <OnMessageType>
                        <Case>
                            <ReceiveMessage    idref="Success"/>
                            <BlockAction>
                                <Terminate success="true"></Terminate>
                            </BlockAction>
                        </Case>
                        <Case>
                            <ReceiveMessage idref="Error">
                                <Variable id="Resource">Resource</Variable>
                            </ReceiveMessage>
                            <BlockAction>
                                <Terminate success="false">
                                    <Log idref="Resource"/>
                                </Terminate>
                            </BlockAction>
                        </Case>
                    </OnMessageType>
                </Switch>
            </Block>
        </Blocks>
    </Transaction>

    <Transaction id="TurnOff">
        <DeviceProfile idref="HueLight"/>
        <DeviceProfile idref="HueBWLight"/>
        <Blocks>
            <Block id="1">
                <SendMessage id="LightTurnOff" idref="LightTurnOff"/>
                <Switch>
                    <OnMessageType>
                        <Case>
                            <ReceiveMessage    idref="Success"/>
                            <BlockAction>
                                <Terminate success="true"></Terminate>
                            </BlockAction>
                        </Case>
                        <Case>
                            <ReceiveMessage idref="Error">
                                <Variable id="Resource">Resource</Variable>
                            </ReceiveMessage>
                            <BlockAction>
                                <Terminate success="false">
                                    <Log idref="Resource"/>
                                </Terminate>
                            </BlockAction>
                        </Case>
                    </OnMessageType>
                </Switch>
            </Block>
        </Blocks>
    </Transaction>

    <!--
    <Transaction id="TurnOff(BW)">
        <DeviceProfile idref="BWLight"/>
        <Blocks>
            <Block id="1">
                <SendMessage id="LightTurnOff" idref="LightTurnOff"/>
                <Switch>
                    <OnMessageType>
                        <Case>
                            <ReceiveMessage idref="Success"/>
                            <BlockAction>
                                <TransactionSuccess/>
                            </BlockAction>
                        </Case>
                        <Case>
                            <ReceiveMessage    idref="Error"/>
                            <BlockAction>
                                <TransactionError>
                                    <ErrorSegment>Resource</ErrorSegment>
                                </TransactionError>
                            </BlockAction>
                        </Case>
                    </OnMessageType>
                </Switch>
            </Block>
        </Blocks>
    </Transaction>
    -->

    <!--
    <Transaction id="ChangeLightState">
        <DeviceProfile idref="HueLight"/>
        <Blocks>
            <Block id="1">
                <SendMessage id="ChangeLightState" idref="ChangeLightState"/>
                <Switch>
                    <OnMessageType>
                        <Case>
                            <ReceiveMessage idref="Success"/>
                            <BlockAction>
                                <TransactionSuccess/>
                            </BlockAction>
                        </Case>
                        <Case>
                            <ReceiveMessage    idref="Error"/>
                            <BlockAction>
                                <TransactionError>
                                    <ErrorSegment>Resource</ErrorSegment>
                                </TransactionError>
                            </BlockAction>
                        </Case>
                    </OnMessageType>
                </Switch>
            </Block>
        </Blocks>
    </Transaction>

    <Transaction id="ChangeBWLightState">
        <DeviceProfile idref="BWLight"/>
        <Blocks>
            <Block id="1">
                <SendMessage id="ChangeBWLightState" idref="ChangeBWLightState"/>
                <Switch>
                    <OnMessageType>
                        <Case>
                            <ReceiveMessage idref="Success"/>
                            <BlockAction>
                                <TransactionSuccess/>
                            </BlockAction>
                        </Case>
                        <Case>
                            <ReceiveMessage    idref="Error"/>
                            <BlockAction>
                                <TransactionError>
                                    <ErrorSegment>Resource</ErrorSegment>
                                </TransactionError>
                            </BlockAction>
                        </Case>
                    </OnMessageType>
                </Switch>
            </Block>
        </Blocks>
    </Transaction>
    -->

    <Transaction id="Brightness">
        <DeviceProfile idref="HueLight"/>
        <Blocks>
            <Block id="1">
                <SendMessage id="ChangeLightState" idref="ChangeLightState"/>
                <Switch>
                    <OnMessageType>
                        <Case>
                            <ReceiveMessage    idref="Success"/>
                            <BlockAction>
                                <Terminate success="true"></Terminate>
                            </BlockAction>
                        </Case>
                        <Case>
                            <ReceiveMessage idref="Error">
                                <Variable id="Resource">Resource</Variable>
                            </ReceiveMessage>
                            <BlockAction>
                                <Terminate success="false">
                                    <Log idref="Resource"/>
                                </Terminate>
                            </BlockAction>
                        </Case>
                    </OnMessageType>
                </Switch>
            </Block>
        </Blocks>
    </Transaction>

    <Transaction id="Brightness(BW)">
        <DeviceProfile idref="HueBWLight"/>
        <Blocks>
            <Block id="1">
                <SendMessage id="ChangeBWLightState" idref="ChangeBWLightState"/>
                <Switch>
                    <OnMessageType>
                        <Case>
                            <ReceiveMessage    idref="Success"/>
                            <BlockAction>
                                <Terminate success="true"></Terminate>
                            </BlockAction>
                        </Case>
                        <Case>
                            <ReceiveMessage idref="Error">
                                <Variable id="Resource">Resource</Variable>
                            </ReceiveMessage>
                            <BlockAction>
                                <Terminate success="false">
                                    <Log idref="Resource"/>
                                </Terminate>
                            </BlockAction>
                        </Case>
                    </OnMessageType>
                </Switch>
            </Block>
        </Blocks>
    </Transaction>

    <Transaction id="Color">
        <DeviceProfile idref="HueLight"/>
        <Blocks>
            <Block id="1">
                <SendMessage id="ChangeLightState" idref="ChangeLightState"/>
                <Switch>
                    <OnMessageType>
                        <Case>
                            <ReceiveMessage    idref="Success"/>
                            <BlockAction>
                                <Terminate success="true"></Terminate>
                            </BlockAction>
                        </Case>
                        <Case>
                            <ReceiveMessage idref="Error">
                                <Variable id="Resource">Resource</Variable>
                            </ReceiveMessage>
                            <BlockAction>
                                <Terminate success="false">
                                    <Log idref="Resource"/>
                                </Terminate>
                            </BlockAction>
                        </Case>
                    </OnMessageType>
                </Switch>
            </Block>
        </Blocks>
    </Transaction>

    <Transaction id="StartColorLoop">
        <DeviceProfile idref="HueLight"/>
        <Blocks>
            <Block id="1">
                <SendMessage id="ChangeLightState" idref="ChangeLightState"/>
                <Switch>
                    <OnMessageType>
                        <Case>
                            <ReceiveMessage    idref="Success"/>
                            <BlockAction>
                                <Terminate success="true"></Terminate>
                            </BlockAction>
                        </Case>
                        <Case>
                            <ReceiveMessage idref="Error">
                                <Variable id="Resource">Resource</Variable>
                            </ReceiveMessage>
                            <BlockAction>
                                <Terminate success="false">
                                    <Log idref="Resource"/>
                                </Terminate>
                            </BlockAction>
                        </Case>
                    </OnMessageType>
                </Switch>
            </Block>
        </Blocks>
    </Transaction>

    <Transaction id="StopColorLoop">
        <DeviceProfile idref="HueLight"/>
        <Blocks>
            <Block id="1">
                <SendMessage id="ChangeLightState" idref="ChangeLightState"/>
                <Switch>
                    <OnMessageType>
                        <Case>
                            <ReceiveMessage    idref="Success"/>
                            <BlockAction>
                                <Terminate success="true"></Terminate>
                            </BlockAction>
                        </Case>
                        <Case>
                            <ReceiveMessage idref="Error">
                                <Variable id="Resource">Resource</Variable>
                            </ReceiveMessage>
                            <BlockAction>
                                <Terminate success="false">
                                    <Log idref="Resource"/>
                                </Terminate>
                            </BlockAction>
                        </Case>
                    </OnMessageType>
                </Switch>
            </Block>
        </Blocks>
    </Transaction>

</TransactionDescriptor>