diff options
author | Juergen Haug | 2015-06-03 13:33:40 +0000 |
---|---|---|
committer | Juergen Haug | 2015-06-03 13:33:40 +0000 |
commit | 9ce9447c7f97818cdf2b1009b3c0930a4af5b766 (patch) | |
tree | f8a3ab3a922818a4abfcc3f0f258e2d1bb930dde /runtime | |
parent | c80edce745dd097625a050957f03f4be460b4045 (diff) | |
download | org.eclipse.etrice-9ce9447c7f97818cdf2b1009b3c0930a4af5b766.tar.gz org.eclipse.etrice-9ce9447c7f97818cdf2b1009b3c0930a4af5b766.tar.xz org.eclipse.etrice-9ce9447c7f97818cdf2b1009b3c0930a4af5b766.zip |
[modellib.c] fixes and changes for mingw tcp service
Diffstat (limited to 'runtime')
5 files changed, 802 insertions, 74 deletions
diff --git a/runtime/org.eclipse.etrice.modellib.c/model/TcpService.room b/runtime/org.eclipse.etrice.modellib.c/model/TcpService.room index 55601b76f..909ec7765 100644 --- a/runtime/org.eclipse.etrice.modellib.c/model/TcpService.room +++ b/runtime/org.eclipse.etrice.modellib.c/model/TcpService.room @@ -5,92 +5,129 @@ RoomModel room.basic.service.tcp { ActorClass ATcpServer { Interface { - Port ControlPort: PTcpControl - Port PayloadPort: PTcpPayload + Port controlPort: PTcpControl + Port payloadPort: PTcpPayload } Structure { usercode1 { "#include \"osal/etTcpSockets.h\"" } usercode3 { - "/* user code 3 */" + "static int8* bufferProvider(void* slf, int* size) {" + " ATcpServer* self = (ATcpServer*) slf;" + " *size = DTcpPayload_getMaxLength(&payloadRecvBuffer);" + " return payloadRecvBuffer.data;" + "}" + "" + "static int socketReceiver(void* slf, int channel, int size, const int8* data) {" + " ATcpServer* self = (ATcpServer*) slf;" + " DTcpPayload_setData(&payloadRecvBuffer, data, size);" + " payloadPort_dataPackage(&payloadRecvBuffer);" + " return ETSOCKET_OK;" + "}" } - external Port ControlPort - external Port PayloadPort + external Port controlPort + external Port payloadPort Attribute lastError: int32 - Attribute payloadPortReplocation: int32 + Attribute payloadRecvBuffer : DTcpPayload Attribute server: etSocketServerData ref } Behavior { Operation ATcpServer() { - "etInitSockets();" + "setErrorCode(etInitSockets());" "server = etCreateSocketServerData();" + "server->receiver = socketReceiver;" + "server->bufferProvider = bufferProvider;" + "server->userData = self;" } Operation ~ATcpServer() { "etCleanupSockets();" "etFreeSocketServerData(server);" } - Operation stopUser() { - "/* stop user: close socket */" +// Operation stopUser() { +// "/* stop user: close socket */" +// } + Operation hasError() : boolean { + "return lastError != ETSOCKET_OK;" + } + Operation setErrorCode(value : int32){ + "lastError = value;" } StateMachine { - Transition init: initial -> closed { - } - Transition tr0: closed -> cp cp0 { + Transition init: initial -> cp cp0 + Transition tr5: connected -> connected { triggers { - <open: ControlPort> + <dataPackage: payloadPort> } action { - "lastError=0;" - "/* start accept thread */" - "if (etStartListening(server, data->TcpPort)!=ETSOCKET_OK) lastError = 1;" + "/* send payload to connection */" + "setErrorCode(etWriteServerSocket(server, data->connectionId, data->length, data->data));" + "if(hasError())" + "\tcontrolPort.error();" } } - Transition tr1: opened -> closed { + Transition tr6: connected -> unconnected { triggers { - <close: ControlPort> + <disconnect: controlPort> } action { "/* close accept thread */" "etCloseAllServerSockets(server);" "etStopSocketServer(server);" + "" + "controlPort.disconnected();" } } - Transition tr2: cp cp0 -> opened { + Transition tr7: unconnected -> cp cp1 { + triggers { + <connect: controlPort> + } action { - "ControlPort.established();" + "/* start accept thread */" + "setErrorCode(etStartListening(server, data->TcpPort));" } } - Transition socketError: cp cp0 -> error { + Transition tr4: cp cp1 -> connected { + action { + "controlPort.connected();" + } + } + Transition tr8: cp cp1 -> unconnected { cond { - "lastError!=0" + "hasError()" } action { - "ControlPort.error();" - "/* handle not connected */" + "controlPort.error();" } } - Transition tr3: opened -> opened { - triggers { - <send: PayloadPort> + Transition tr0: cp cp0 -> unconnected + Transition tr1: cp cp0 -> initError { + cond { + "hasError()" } - action { - "/* send payload to connection */" - "etWriteServerSocket(server, data->connectionId, data->length, data->data);" + } + Transition tr2: initError -> initError { + triggers { + <connect: controlPort> } } + ChoicePoint cp1 ChoicePoint cp0 - State closed - State opened - State error + State connected + State unconnected + State initError { + entry { + "controlPort.error();" + } + } } } } ActorClass ATcpClient { Interface { - Port ControlPort: PTcpControl - Port PayloadPort: PTcpPayload + Port controlPort: PTcpControl + Port payloadPort: PTcpPayload } Structure { usercode1 { @@ -99,25 +136,26 @@ RoomModel room.basic.service.tcp { usercode3 { "static int8* bufferProvider(void* slf, int* size) {" " ATcpClient* self = (ATcpClient*) slf;" - " *size = 1000;" - " return payload.data;" + " *size = DTcpPayload_getMaxLength(&payloadRecvBuffer);" + " return payloadRecvBuffer.data;" "}" "" "static int socketReceiver(void* slf, int channel, int size, const int8* data) {" " ATcpClient* self = (ATcpClient*) slf;" - " payload.length = size;" - " PTcpPayloadPort_receive(&self->constData->PayloadPort, &payload);" + " DTcpPayload_setData(&payloadRecvBuffer, data, size);" + " payloadPort_dataPackage(&payloadRecvBuffer);" " return ETSOCKET_OK;" "}" } - external Port ControlPort - external Port PayloadPort + external Port controlPort + external Port payloadPort Attribute lastError: int32 - Attribute payload: DTcpPayload + Attribute payloadRecvBuffer: DTcpPayload Attribute client: etSocketConnectionData ref } Behavior { Operation ATcpClient() { + "setErrorCode(etInitSockets());" "client = etCreateSocketConnectionData();" "client->receiver = socketReceiver;" "client->bufferProvider = bufferProvider;" @@ -125,86 +163,109 @@ RoomModel room.basic.service.tcp { } Operation ~ATcpClient() { "etCloseSocket(client);" + "etCleanupSockets();" "etFreeSocketConnectionData(client);" } - Operation stopUser() { - "/* stop user: close socket */" +// Operation stopUser() { +// "/* stop user: close socket */" +// } + Operation hasError() : boolean { + "return lastError != ETSOCKET_OK;" + } + Operation setErrorCode(value : int32){ + "lastError = value;" } StateMachine { - Transition init: initial -> closed { + Transition init: initial -> cp cp1 { action { "printf(\"Client Init!\\n\");" } } - Transition tr0: closed -> cp cp0 { + Transition tr0: unconnected -> cp cp0 { triggers { - <open: ControlPort> + <connect: controlPort> } action { - "lastError=0;" "/* connect to server */" - "if (etConnectServer(client, data->IPAddr, data->TcpPort)!=ETSOCKET_OK) lastError = 1;" + "setErrorCode(etConnectServer(client, data->IPAddr, data->TcpPort));" } } - Transition tr1: opened -> closed { + Transition tr1: connected -> unconnected { triggers { - <close: ControlPort> + <disconnect: controlPort> } action { "/* close read thread */" "etCloseSocket(client);" + "" + "controlPort.disconnected();" } } - Transition tr2: cp cp0 -> opened { + Transition tr2: cp cp0 -> connected { action { - "ControlPort.established();" + "controlPort.connected();" } } - Transition socketError: cp cp0 -> error { + Transition tr7: cp cp0 -> unconnected { cond { - "lastError!=0" + "hasError()" } action { - "ControlPort.error();" - "/* handle error */" + "controlPort.error();" } } - Transition tr3: opened -> opened { + Transition tr3: connected -> connected { triggers { - <send: PayloadPort> + <dataPackage: payloadPort> } action { - "/* send payload" - "\tout.write(data.getData(),0,data.length);" - "*/" - "etWriteSocket(client, data->length, data->data);" + "setErrorCode(etWriteSocket(client, data->length, data->data));" + "if(hasError())" + "\tcontrolPort.error();" + } + } + Transition tr4: cp cp1 -> unconnected + Transition tr5: cp cp1 -> initError { + cond { + "hasError()" + } + } + Transition tr6: initError -> initError { + triggers { + <connect: controlPort> } } ChoicePoint cp0 - State closed - State opened - State error + ChoicePoint cp1 + State unconnected + State connected + State initError { + entry { + "controlPort.error();" + } + } } } } ProtocolClass PTcpControl { incoming { - Message open(data: DTcpControl) - Message close() + Message connect(data: DTcpControl) + Message disconnect() } outgoing { - Message established() + Message connected() + Message disconnected() Message error() } } ProtocolClass PTcpPayload { incoming { - Message send(data: DTcpPayload) + Message dataPackage(data: DTcpPayload) } outgoing { - Message receive(data: DTcpPayload) + Message dataPackage(data: DTcpPayload) } } @@ -216,7 +277,31 @@ RoomModel room.basic.service.tcp { DataClass DTcpPayload { Attribute connectionId: int32 Attribute length: int32 - Attribute data [ 128 ]: int8 + Attribute data [ 32 ]: int8 + + Operation getMaxLength() : int32 { + "return 32;" + } + + Operation setAsString(value : charPtr){ + "// used macros: data, length" + "int valLength = (strlen(value)+1 > 32)? 32 : strlen(value) + 1;" + "memcpy(data, value, valLength);" + "data[31] = '\\0';" + "length = valLength;" + } + + Operation setData(value : int8 ref, size : int32){ + "// used macros: data, length" + "strncpy(data, value, ((size>32)?32:size));" + "length = size;" + } + + Operation getAsString() : charPtr{ + "// used macros: data" + "data[31] = '\\0';" + "return data;" + } } ExternalType etSocketServerData -> "etSocketServerData" diff --git a/runtime/org.eclipse.etrice.modellib.c/model/diagrams/room.basic.service.tcp.ATcpClient.behavior b/runtime/org.eclipse.etrice.modellib.c/model/diagrams/room.basic.service.tcp.ATcpClient.behavior new file mode 100644 index 000000000..ed1e478c2 --- /dev/null +++ b/runtime/org.eclipse.etrice.modellib.c/model/diagrams/room.basic.service.tcp.ATcpClient.behavior @@ -0,0 +1,318 @@ +<?xml version="1.0" encoding="ASCII"?> +<pi:Diagram xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:al="http://eclipse.org/graphiti/mm/algorithms" xmlns:pi="http://eclipse.org/graphiti/mm/pictograms" visible="true" gridUnit="10" diagramTypeId="room.behavior" name="Behavior of ATcpClient" pictogramLinks="//@link //@children.0/@link //@children.0/@children.1/@link //@children.0/@children.2/@link //@children.0/@children.3/@link //@children.0/@children.4/@link //@connections.0/@link //@connections.1/@link //@connections.2/@link //@connections.3/@link //@connections.4/@link //@connections.5/@link //@children.0/@children.5/@link //@connections.6/@link //@children.0/@children.6/@link //@connections.7/@link //@connections.8/@link" verticalGridUnit="10" version="0.11.0"> + <graphicsAlgorithm xsi:type="al:Rectangle" background="//@colors.1" foreground="//@colors.0" lineWidth="1" transparency="0.0" width="1000" height="1000"/> + <link> + <businessObjects href="../TcpService.room#ActorClass:ATcpClient"/> + </link> + <children xsi:type="pi:ContainerShape" visible="true" active="true"> + <properties key="obj-type" value="sg"/> + <graphicsAlgorithm xsi:type="al:Rectangle" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" width="880" height="580" x="40" y="40"> + <graphicsAlgorithmChildren xsi:type="al:RoundedRectangle" background="//@colors.1" foreground="//@colors.2" lineWidth="4" transparency="0.5" width="800" height="500" x="40" y="40" cornerHeight="20" cornerWidth="20"/> + <graphicsAlgorithmChildren xsi:type="al:RoundedRectangle" foreground="//@colors.2" lineWidth="4" filled="false" transparency="0.0" width="800" height="500" x="40" y="40" cornerHeight="20" cornerWidth="20"/> + </graphicsAlgorithm> + <link> + <businessObjects href="../TcpService.room#StateGraph:ATcpClient$sg"/> + </link> + <children visible="true"> + <graphicsAlgorithm xsi:type="al:Text" background="//@colors.2" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0" width="800" height="80" y="40" font="//@fonts.1" horizontalAlignment="ALIGNMENT_RIGHT" verticalAlignment="ALIGNMENT_TOP" value="/"/> + </children> + <children xsi:type="pi:ContainerShape" visible="true" active="true"> + <properties key="obj-type" value="trp"/> + <graphicsAlgorithm xsi:type="al:Rectangle" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" width="40" height="40" x="100" y="100"> + <graphicsAlgorithmChildren xsi:type="al:Ellipse" background="//@colors.1" foreground="//@colors.2" lineWidth="2" transparency="0.0" width="20" height="20" x="10" y="10"/> + </graphicsAlgorithm> + <link> + <businessObjects href="../TcpService.room#StateGraph:ATcpClient$sg"/> + </link> + <anchors xsi:type="pi:ChopboxAnchor" outgoingConnections="//@connections.0" referencedGraphicsAlgorithm="//@children.0/@children.1/@graphicsAlgorithm/@graphicsAlgorithmChildren.0"/> + <children visible="true"> + <graphicsAlgorithm xsi:type="al:Text" background="//@colors.2" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0" width="40" height="20" y="10" font="//@fonts.0" horizontalAlignment="ALIGNMENT_CENTER" value="I"/> + </children> + </children> + <children xsi:type="pi:ContainerShape" visible="true" active="true"> + <properties key="obj-type" value="state"/> + <graphicsAlgorithm xsi:type="al:Rectangle" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" width="159" height="90" x="191" y="179"> + <graphicsAlgorithmChildren xsi:type="al:RoundedRectangle" background="//@colors.3" foreground="//@colors.2" lineWidth="1" transparency="0.0" width="99" height="30" x="30" y="30" cornerHeight="20" cornerWidth="20"> + <graphicsAlgorithmChildren xsi:type="al:RoundedRectangle" foreground="//@colors.2" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" width="15" height="8" x="74" y="3" cornerHeight="5" cornerWidth="5"/> + <graphicsAlgorithmChildren xsi:type="al:Polygon" foreground="//@colors.2" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" x="49" y="24"> + <points x="-3" y="-3"/> + <points x="-3" y="3"/> + <points x="-11" y="3"/> + </graphicsAlgorithmChildren> + <graphicsAlgorithmChildren xsi:type="al:Polygon" foreground="//@colors.2" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" x="49" y="24"> + <points x="3" y="-3"/> + <points x="3" y="3"/> + <points x="11" y="3"/> + </graphicsAlgorithmChildren> + <graphicsAlgorithmChildren xsi:type="al:Polygon" foreground="//@colors.2" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" x="49" y="24"> + <points x="-2" y="-3"/> + <points x="-2" y="3"/> + <points x="2" y="3"/> + <points x="2" y="-3"/> + </graphicsAlgorithmChildren> + </graphicsAlgorithmChildren> + </graphicsAlgorithm> + <link> + <businessObjects href="../TcpService.room#SimpleState:ATcpClient$unconnected"/> + </link> + <anchors xsi:type="pi:ChopboxAnchor" outgoingConnections="//@connections.1" incomingConnections="//@connections.2 //@connections.6 //@connections.4"/> + <children visible="true"> + <graphicsAlgorithm xsi:type="al:Text" background="//@colors.2" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0" width="99" height="30" x="30" y="30" font="//@fonts.0" horizontalAlignment="ALIGNMENT_CENTER" value="unconnected"/> + </children> + </children> + <children xsi:type="pi:ContainerShape" visible="true" active="true"> + <properties key="obj-type" value="state"/> + <graphicsAlgorithm xsi:type="al:Rectangle" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" width="158" height="90" x="493" y="179"> + <graphicsAlgorithmChildren xsi:type="al:RoundedRectangle" background="//@colors.3" foreground="//@colors.2" lineWidth="1" transparency="0.0" width="98" height="30" x="30" y="30" cornerHeight="20" cornerWidth="20"> + <graphicsAlgorithmChildren xsi:type="al:RoundedRectangle" foreground="//@colors.2" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" width="15" height="8" x="73" y="3" cornerHeight="5" cornerWidth="5"/> + <graphicsAlgorithmChildren xsi:type="al:Polygon" foreground="//@colors.2" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" x="49" y="24"> + <points x="-3" y="-3"/> + <points x="-3" y="3"/> + <points x="-11" y="3"/> + </graphicsAlgorithmChildren> + <graphicsAlgorithmChildren xsi:type="al:Polygon" foreground="//@colors.2" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" x="49" y="24"> + <points x="3" y="-3"/> + <points x="3" y="3"/> + <points x="11" y="3"/> + </graphicsAlgorithmChildren> + <graphicsAlgorithmChildren xsi:type="al:Polygon" foreground="//@colors.2" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" x="49" y="24"> + <points x="-2" y="-3"/> + <points x="-2" y="3"/> + <points x="2" y="3"/> + <points x="2" y="-3"/> + </graphicsAlgorithmChildren> + </graphicsAlgorithmChildren> + </graphicsAlgorithm> + <link> + <businessObjects href="../TcpService.room#SimpleState:ATcpClient$connected"/> + </link> + <anchors xsi:type="pi:ChopboxAnchor" outgoingConnections="//@connections.2 //@connections.5" incomingConnections="//@connections.5 //@connections.3"/> + <children visible="true"> + <graphicsAlgorithm xsi:type="al:Text" background="//@colors.2" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0" width="98" height="30" x="30" y="30" font="//@fonts.0" horizontalAlignment="ALIGNMENT_CENTER" value="connected"/> + </children> + </children> + <children xsi:type="pi:ContainerShape" visible="true" active="true"> + <properties key="obj-type" value="trp"/> + <graphicsAlgorithm xsi:type="al:Rectangle" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" width="50" height="50" x="428" y="376"> + <graphicsAlgorithmChildren xsi:type="al:Ellipse" background="//@colors.1" foreground="//@colors.2" lineWidth="2" transparency="0.0" width="25" height="25" x="12" y="12"/> + </graphicsAlgorithm> + <link> + <businessObjects href="../TcpService.room#ChoicePoint:ATcpClient$cp0"/> + </link> + <anchors xsi:type="pi:ChopboxAnchor" outgoingConnections="//@connections.3 //@connections.4" incomingConnections="//@connections.1"/> + <children visible="true"> + <graphicsAlgorithm xsi:type="al:Text" background="//@colors.2" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0" width="50" height="25" y="12" font="//@fonts.0" horizontalAlignment="ALIGNMENT_CENTER" value="C"/> + </children> + </children> + <children xsi:type="pi:ContainerShape" visible="true" active="true"> + <properties key="obj-type" value="trp"/> + <graphicsAlgorithm xsi:type="al:Rectangle" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" width="50" height="50" x="215" y="99"> + <graphicsAlgorithmChildren xsi:type="al:Ellipse" background="//@colors.1" foreground="//@colors.2" lineWidth="2" transparency="0.0" width="25" height="25" x="12" y="12"/> + </graphicsAlgorithm> + <link> + <businessObjects href="../TcpService.room#ChoicePoint:ATcpClient$cp1"/> + </link> + <anchors xsi:type="pi:ChopboxAnchor" outgoingConnections="//@connections.6 //@connections.7" incomingConnections="//@connections.0"/> + <children visible="true"> + <graphicsAlgorithm xsi:type="al:Text" background="//@colors.2" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0" width="50" height="25" y="12" font="//@fonts.0" horizontalAlignment="ALIGNMENT_CENTER" value="C"/> + </children> + </children> + <children xsi:type="pi:ContainerShape" visible="true" active="true"> + <properties key="obj-type" value="state"/> + <graphicsAlgorithm xsi:type="al:Rectangle" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" width="120" height="90" x="40" y="185"> + <graphicsAlgorithmChildren xsi:type="al:RoundedRectangle" background="//@colors.3" foreground="//@colors.2" lineWidth="1" transparency="0.0" width="60" height="30" x="30" y="30" cornerHeight="20" cornerWidth="20"> + <graphicsAlgorithmChildren xsi:type="al:RoundedRectangle" foreground="//@colors.2" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" width="15" height="8" x="35" y="3" cornerHeight="5" cornerWidth="5"/> + <graphicsAlgorithmChildren xsi:type="al:Polygon" foreground="//@colors.2" lineWidth="1" filled="false" lineVisible="true" transparency="0.0" x="30" y="24"> + <points x="-3" y="-3"/> + <points x="-3" y="3"/> + <points x="-11" y="3"/> + </graphicsAlgorithmChildren> + <graphicsAlgorithmChildren xsi:type="al:Polygon" foreground="//@colors.2" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" x="30" y="24"> + <points x="3" y="-3"/> + <points x="3" y="3"/> + <points x="11" y="3"/> + </graphicsAlgorithmChildren> + <graphicsAlgorithmChildren xsi:type="al:Polygon" foreground="//@colors.2" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" x="30" y="24"> + <points x="-2" y="-3"/> + <points x="-2" y="3"/> + <points x="2" y="3"/> + <points x="2" y="-3"/> + </graphicsAlgorithmChildren> + </graphicsAlgorithmChildren> + </graphicsAlgorithm> + <link> + <businessObjects href="../TcpService.room#SimpleState:ATcpClient$initError"/> + </link> + <anchors xsi:type="pi:ChopboxAnchor" outgoingConnections="//@connections.8" incomingConnections="//@connections.7 //@connections.8"/> + <children visible="true"> + <graphicsAlgorithm xsi:type="al:Text" background="//@colors.2" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0" width="60" height="30" x="30" y="30" font="//@fonts.0" horizontalAlignment="ALIGNMENT_CENTER" value="initError"/> + </children> + </children> + </children> + <connections xsi:type="pi:FreeFormConnection" visible="true" active="true" start="//@children.0/@children.1/@anchors.0" end="//@children.0/@children.5/@anchors.0"> + <properties key="obj-type" value="trans"/> + <graphicsAlgorithm xsi:type="al:Polyline" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0"/> + <link> + <businessObjects href="../TcpService.room#InitialTransition:ATcpClient$initial"/> + </link> + <connectionDecorators visible="true" locationRelative="true" location="1.0"> + <graphicsAlgorithm xsi:type="al:Polygon" background="//@colors.2" foreground="//@colors.2" lineWidth="1" filled="true" transparency="0.0"> + <points x="-15" y="5"/> + <points/> + <points x="-15" y="-5"/> + </graphicsAlgorithm> + </connectionDecorators> + <connectionDecorators visible="true" active="true" locationRelative="true" location="0.5"> + <graphicsAlgorithm xsi:type="al:Text" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0" x="10" font="//@fonts.0" value="init"/> + </connectionDecorators> + </connections> + <connections xsi:type="pi:FreeFormConnection" visible="true" active="true" start="//@children.0/@children.2/@anchors.0" end="//@children.0/@children.4/@anchors.0"> + <properties key="obj-type" value="trans"/> + <graphicsAlgorithm xsi:type="al:Polyline" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0"/> + <link> + <businessObjects href="../TcpService.room#TriggeredTransition:ATcpClient$tr0"/> + </link> + <connectionDecorators visible="true" locationRelative="true" location="1.0"> + <graphicsAlgorithm xsi:type="al:Polygon" background="//@colors.2" foreground="//@colors.2" lineWidth="1" filled="true" transparency="0.0"> + <points x="-15" y="5"/> + <points/> + <points x="-15" y="-5"/> + </graphicsAlgorithm> + </connectionDecorators> + <connectionDecorators visible="true" active="true" locationRelative="true" location="0.5"> + <graphicsAlgorithm xsi:type="al:Text" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0" x="10" font="//@fonts.0" value="tr0: <connect:contro..."/> + </connectionDecorators> + </connections> + <connections xsi:type="pi:FreeFormConnection" visible="true" active="true" start="//@children.0/@children.3/@anchors.0" end="//@children.0/@children.2/@anchors.0"> + <properties key="obj-type" value="trans"/> + <graphicsAlgorithm xsi:type="al:Polyline" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0"/> + <link> + <businessObjects href="../TcpService.room#TriggeredTransition:ATcpClient$tr1"/> + </link> + <connectionDecorators visible="true" locationRelative="true" location="1.0"> + <graphicsAlgorithm xsi:type="al:Polygon" background="//@colors.2" foreground="//@colors.2" lineWidth="1" filled="true" transparency="0.0"> + <points x="-15" y="5"/> + <points/> + <points x="-15" y="-5"/> + </graphicsAlgorithm> + </connectionDecorators> + <connectionDecorators visible="true" active="true" locationRelative="true" location="0.5"> + <graphicsAlgorithm xsi:type="al:Text" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0" x="10" font="//@fonts.0" value="tr1: <disconnect:con..."/> + </connectionDecorators> + </connections> + <connections xsi:type="pi:FreeFormConnection" visible="true" active="true" start="//@children.0/@children.4/@anchors.0" end="//@children.0/@children.3/@anchors.0"> + <properties key="obj-type" value="trans"/> + <graphicsAlgorithm xsi:type="al:Polyline" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0"/> + <link> + <businessObjects href="../TcpService.room#ContinuationTransition:ATcpClient$tr2"/> + </link> + <connectionDecorators visible="true" locationRelative="true" location="1.0"> + <graphicsAlgorithm xsi:type="al:Polygon" background="//@colors.2" foreground="//@colors.2" lineWidth="1" filled="true" transparency="0.0"> + <points x="-15" y="5"/> + <points/> + <points x="-15" y="-5"/> + </graphicsAlgorithm> + </connectionDecorators> + <connectionDecorators visible="true" active="true" locationRelative="true" location="0.5"> + <graphicsAlgorithm xsi:type="al:Text" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0" x="10" font="//@fonts.0" value="tr2: [else]"/> + </connectionDecorators> + <bendpoints x="612" y="440"/> + </connections> + <connections xsi:type="pi:FreeFormConnection" visible="true" active="true" start="//@children.0/@children.4/@anchors.0" end="//@children.0/@children.2/@anchors.0"> + <properties key="obj-type" value="trans"/> + <graphicsAlgorithm xsi:type="al:Polyline" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0"/> + <link> + <businessObjects href="../TcpService.room#CPBranchTransition:ATcpClient$tr7"/> + </link> + <connectionDecorators visible="true" locationRelative="true" location="1.0"> + <graphicsAlgorithm xsi:type="al:Polygon" background="//@colors.2" foreground="//@colors.2" lineWidth="1" filled="true" transparency="0.0"> + <points x="-15" y="5"/> + <points/> + <points x="-15" y="-5"/> + </graphicsAlgorithm> + </connectionDecorators> + <connectionDecorators visible="true" active="true" locationRelative="true" location="0.5"> + <graphicsAlgorithm xsi:type="al:Text" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0" x="10" font="//@fonts.0" value="tr7: [hasError()]"/> + </connectionDecorators> + <bendpoints x="310" y="440"/> + </connections> + <connections xsi:type="pi:FreeFormConnection" visible="true" active="true" start="//@children.0/@children.3/@anchors.0" end="//@children.0/@children.3/@anchors.0"> + <properties key="obj-type" value="trans"/> + <graphicsAlgorithm xsi:type="al:Polyline" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0"/> + <link> + <businessObjects href="../TcpService.room#TriggeredTransition:ATcpClient$tr3"/> + </link> + <connectionDecorators visible="true" locationRelative="true" location="1.0"> + <graphicsAlgorithm xsi:type="al:Polygon" background="//@colors.2" foreground="//@colors.2" lineWidth="1" filled="true" transparency="0.0"> + <points x="-15" y="5"/> + <points/> + <points x="-15" y="-5"/> + </graphicsAlgorithm> + </connectionDecorators> + <connectionDecorators visible="true" active="true" locationRelative="true" location="0.5"> + <graphicsAlgorithm xsi:type="al:Text" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0" x="10" font="//@fonts.0" value="tr3: <dataPackage:pa..."/> + </connectionDecorators> + <bendpoints x="713" y="378"/> + <bendpoints x="713" y="317"/> + </connections> + <connections xsi:type="pi:FreeFormConnection" visible="true" active="true" start="//@children.0/@children.5/@anchors.0" end="//@children.0/@children.2/@anchors.0"> + <properties key="obj-type" value="trans"/> + <graphicsAlgorithm xsi:type="al:Polyline" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0"/> + <link> + <businessObjects href="../TcpService.room#ContinuationTransition:ATcpClient$tr4"/> + </link> + <connectionDecorators visible="true" locationRelative="true" location="1.0"> + <graphicsAlgorithm xsi:type="al:Polygon" background="//@colors.1" foreground="//@colors.2" lineWidth="1" filled="true" transparency="0.0"> + <points x="-15" y="5"/> + <points/> + <points x="-15" y="-5"/> + </graphicsAlgorithm> + </connectionDecorators> + <connectionDecorators visible="true" active="true" locationRelative="true" location="0.5"> + <graphicsAlgorithm xsi:type="al:Text" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0" x="10" font="//@fonts.0" value="tr4: [else]"/> + </connectionDecorators> + </connections> + <connections xsi:type="pi:FreeFormConnection" visible="true" active="true" start="//@children.0/@children.5/@anchors.0" end="//@children.0/@children.6/@anchors.0"> + <properties key="obj-type" value="trans"/> + <graphicsAlgorithm xsi:type="al:Polyline" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0"/> + <link> + <businessObjects href="../TcpService.room#CPBranchTransition:ATcpClient$tr5"/> + </link> + <connectionDecorators visible="true" locationRelative="true" location="1.0"> + <graphicsAlgorithm xsi:type="al:Polygon" background="//@colors.1" foreground="//@colors.2" lineWidth="1" filled="true" transparency="0.0"> + <points x="-15" y="5"/> + <points/> + <points x="-15" y="-5"/> + </graphicsAlgorithm> + </connectionDecorators> + <connectionDecorators visible="true" active="true" locationRelative="true" location="0.5"> + <graphicsAlgorithm xsi:type="al:Text" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0" x="-98" y="-6" font="//@fonts.0" value="tr5: [hasError()]"/> + </connectionDecorators> + </connections> + <connections xsi:type="pi:FreeFormConnection" visible="true" active="true" start="//@children.0/@children.6/@anchors.0" end="//@children.0/@children.6/@anchors.0"> + <properties key="obj-type" value="trans"/> + <graphicsAlgorithm xsi:type="al:Polyline" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0"/> + <link> + <businessObjects href="../TcpService.room#TriggeredTransition:ATcpClient$tr6"/> + </link> + <connectionDecorators visible="true" locationRelative="true" location="1.0"> + <graphicsAlgorithm xsi:type="al:Polygon" background="//@colors.1" foreground="//@colors.2" lineWidth="1" filled="true" transparency="0.0"> + <points x="-15" y="5"/> + <points/> + <points x="-15" y="-5"/> + </graphicsAlgorithm> + </connectionDecorators> + <connectionDecorators visible="true" active="true" locationRelative="true" location="0.5"> + <graphicsAlgorithm xsi:type="al:Text" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0" x="10" font="//@fonts.0" value="tr6: <connect:contro..."/> + </connectionDecorators> + <bendpoints x="124" y="335"/> + <bendpoints x="140" y="390"/> + <bendpoints x="157" y="335"/> + </connections> + <colors red="227" green="238" blue="249"/> + <colors red="255" green="255" blue="255"/> + <colors/> + <colors red="200" green="200" blue="200"/> + <fonts name="Arial" size="8"/> + <fonts name="Arial" size="9" bold="true"/> +</pi:Diagram> diff --git a/runtime/org.eclipse.etrice.modellib.c/model/diagrams/room.basic.service.tcp.ATcpServer.behavior b/runtime/org.eclipse.etrice.modellib.c/model/diagrams/room.basic.service.tcp.ATcpServer.behavior new file mode 100644 index 000000000..c290c9075 --- /dev/null +++ b/runtime/org.eclipse.etrice.modellib.c/model/diagrams/room.basic.service.tcp.ATcpServer.behavior @@ -0,0 +1,318 @@ +<?xml version="1.0" encoding="ASCII"?> +<pi:Diagram xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:al="http://eclipse.org/graphiti/mm/algorithms" xmlns:pi="http://eclipse.org/graphiti/mm/pictograms" visible="true" gridUnit="10" diagramTypeId="room.behavior" name="Behavior of ATcpServer" pictogramLinks="//@link //@children.0/@link //@children.0/@children.1/@link //@children.0/@children.2/@link //@children.0/@children.3/@link //@connections.0/@link //@connections.1/@link //@connections.2/@link //@children.0/@children.4/@link //@connections.3/@link //@connections.4/@link //@connections.5/@link //@children.0/@children.5/@link //@children.0/@children.6/@link //@connections.6/@link //@connections.7/@link //@connections.8/@link" verticalGridUnit="10" version="0.11.0"> + <graphicsAlgorithm xsi:type="al:Rectangle" background="//@colors.1" foreground="//@colors.0" lineWidth="1" transparency="0.0" width="1000" height="1000"/> + <link> + <businessObjects href="../TcpService.room#ActorClass:ATcpServer"/> + </link> + <children xsi:type="pi:ContainerShape" visible="true" active="true"> + <properties key="obj-type" value="sg"/> + <graphicsAlgorithm xsi:type="al:Rectangle" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" width="880" height="580" x="44" y="35"> + <graphicsAlgorithmChildren xsi:type="al:RoundedRectangle" background="//@colors.1" foreground="//@colors.2" lineWidth="4" transparency="0.5" width="800" height="500" x="40" y="40" cornerHeight="20" cornerWidth="20"/> + <graphicsAlgorithmChildren xsi:type="al:RoundedRectangle" foreground="//@colors.2" lineWidth="4" filled="false" transparency="0.0" width="800" height="500" x="40" y="40" cornerHeight="20" cornerWidth="20"/> + </graphicsAlgorithm> + <link> + <businessObjects href="../TcpService.room#StateGraph:ATcpServer$sg"/> + </link> + <children visible="true"> + <graphicsAlgorithm xsi:type="al:Text" background="//@colors.2" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0" width="800" height="80" y="40" font="//@fonts.1" horizontalAlignment="ALIGNMENT_RIGHT" verticalAlignment="ALIGNMENT_TOP" value="/"/> + </children> + <children xsi:type="pi:ContainerShape" visible="true" active="true"> + <properties key="obj-type" value="trp"/> + <graphicsAlgorithm xsi:type="al:Rectangle" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" width="40" height="40" x="100" y="100"> + <graphicsAlgorithmChildren xsi:type="al:Ellipse" background="//@colors.1" foreground="//@colors.2" lineWidth="2" transparency="0.0" width="20" height="20" x="10" y="10"/> + </graphicsAlgorithm> + <link> + <businessObjects href="../TcpService.room#StateGraph:ATcpServer$sg"/> + </link> + <anchors xsi:type="pi:ChopboxAnchor" outgoingConnections="//@connections.0" referencedGraphicsAlgorithm="//@children.0/@children.1/@graphicsAlgorithm/@graphicsAlgorithmChildren.0"/> + <children visible="true"> + <graphicsAlgorithm xsi:type="al:Text" background="//@colors.2" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0" width="40" height="20" y="10" font="//@fonts.0" horizontalAlignment="ALIGNMENT_CENTER" value="I"/> + </children> + </children> + <children xsi:type="pi:ContainerShape" visible="true" active="true"> + <properties key="obj-type" value="state"/> + <graphicsAlgorithm xsi:type="al:Rectangle" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" width="130" height="90" x="532" y="155"> + <graphicsAlgorithmChildren xsi:type="al:RoundedRectangle" background="//@colors.3" foreground="//@colors.2" lineWidth="1" transparency="0.0" width="70" height="30" x="30" y="30" cornerHeight="20" cornerWidth="20"> + <graphicsAlgorithmChildren xsi:type="al:RoundedRectangle" foreground="//@colors.2" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" width="15" height="8" x="45" y="3" cornerHeight="5" cornerWidth="5"/> + <graphicsAlgorithmChildren xsi:type="al:Polygon" foreground="//@colors.2" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" x="35" y="24"> + <points x="-3" y="-3"/> + <points x="-3" y="3"/> + <points x="-11" y="3"/> + </graphicsAlgorithmChildren> + <graphicsAlgorithmChildren xsi:type="al:Polygon" foreground="//@colors.2" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" x="35" y="24"> + <points x="3" y="-3"/> + <points x="3" y="3"/> + <points x="11" y="3"/> + </graphicsAlgorithmChildren> + <graphicsAlgorithmChildren xsi:type="al:Polygon" foreground="//@colors.2" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" x="35" y="24"> + <points x="-2" y="-3"/> + <points x="-2" y="3"/> + <points x="2" y="3"/> + <points x="2" y="-3"/> + </graphicsAlgorithmChildren> + </graphicsAlgorithmChildren> + </graphicsAlgorithm> + <link> + <businessObjects href="../TcpService.room#SimpleState:ATcpServer$connected"/> + </link> + <anchors xsi:type="pi:ChopboxAnchor" outgoingConnections="//@connections.1 //@connections.2" incomingConnections="//@connections.1 //@connections.4"/> + <children visible="true"> + <graphicsAlgorithm xsi:type="al:Text" background="//@colors.2" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0" width="70" height="30" x="30" y="30" font="//@fonts.0" horizontalAlignment="ALIGNMENT_CENTER" value="connected"/> + </children> + </children> + <children xsi:type="pi:ContainerShape" visible="true" active="true"> + <properties key="obj-type" value="state"/> + <graphicsAlgorithm xsi:type="al:Rectangle" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" width="147" height="90" x="230" y="155"> + <graphicsAlgorithmChildren xsi:type="al:RoundedRectangle" background="//@colors.3" foreground="//@colors.2" lineWidth="1" transparency="0.0" width="87" height="30" x="30" y="30" cornerHeight="20" cornerWidth="20"> + <graphicsAlgorithmChildren xsi:type="al:RoundedRectangle" foreground="//@colors.2" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" width="15" height="8" x="62" y="3" cornerHeight="5" cornerWidth="5"/> + <graphicsAlgorithmChildren xsi:type="al:Polygon" foreground="//@colors.2" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" x="43" y="24"> + <points x="-3" y="-3"/> + <points x="-3" y="3"/> + <points x="-11" y="3"/> + </graphicsAlgorithmChildren> + <graphicsAlgorithmChildren xsi:type="al:Polygon" foreground="//@colors.2" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" x="43" y="24"> + <points x="3" y="-3"/> + <points x="3" y="3"/> + <points x="11" y="3"/> + </graphicsAlgorithmChildren> + <graphicsAlgorithmChildren xsi:type="al:Polygon" foreground="//@colors.2" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" x="43" y="24"> + <points x="-2" y="-3"/> + <points x="-2" y="3"/> + <points x="2" y="3"/> + <points x="2" y="-3"/> + </graphicsAlgorithmChildren> + </graphicsAlgorithmChildren> + </graphicsAlgorithm> + <link> + <businessObjects href="../TcpService.room#SimpleState:ATcpServer$unconnected"/> + </link> + <anchors xsi:type="pi:ChopboxAnchor" outgoingConnections="//@connections.3" incomingConnections="//@connections.2 //@connections.6 //@connections.5"/> + <children visible="true"> + <graphicsAlgorithm xsi:type="al:Text" background="//@colors.2" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0" width="87" height="30" x="30" y="30" font="//@fonts.0" horizontalAlignment="ALIGNMENT_CENTER" value="unconnected"/> + </children> + </children> + <children xsi:type="pi:ContainerShape" visible="true" active="true"> + <properties key="obj-type" value="trp"/> + <graphicsAlgorithm xsi:type="al:Rectangle" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" width="50" height="50" x="451" y="308"> + <graphicsAlgorithmChildren xsi:type="al:Ellipse" background="//@colors.1" foreground="//@colors.2" lineWidth="2" transparency="0.0" width="25" height="25" x="12" y="12"/> + </graphicsAlgorithm> + <link> + <businessObjects href="../TcpService.room#ChoicePoint:ATcpServer$cp1"/> + </link> + <anchors xsi:type="pi:ChopboxAnchor" outgoingConnections="//@connections.4 //@connections.5" incomingConnections="//@connections.3"/> + <children visible="true"> + <graphicsAlgorithm xsi:type="al:Text" background="//@colors.2" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0" width="50" height="25" y="12" font="//@fonts.0" horizontalAlignment="ALIGNMENT_CENTER" value="C"/> + </children> + </children> + <children xsi:type="pi:ContainerShape" visible="true" active="true"> + <properties key="obj-type" value="state"/> + <graphicsAlgorithm xsi:type="al:Rectangle" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" width="120" height="90" x="70" y="155"> + <graphicsAlgorithmChildren xsi:type="al:RoundedRectangle" background="//@colors.3" foreground="//@colors.2" lineWidth="1" transparency="0.0" width="60" height="30" x="30" y="30" cornerHeight="20" cornerWidth="20"> + <graphicsAlgorithmChildren xsi:type="al:RoundedRectangle" foreground="//@colors.2" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" width="15" height="8" x="35" y="3" cornerHeight="5" cornerWidth="5"/> + <graphicsAlgorithmChildren xsi:type="al:Polygon" foreground="//@colors.2" lineWidth="1" filled="false" lineVisible="true" transparency="0.0" x="30" y="24"> + <points x="-3" y="-3"/> + <points x="-3" y="3"/> + <points x="-11" y="3"/> + </graphicsAlgorithmChildren> + <graphicsAlgorithmChildren xsi:type="al:Polygon" foreground="//@colors.2" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" x="30" y="24"> + <points x="3" y="-3"/> + <points x="3" y="3"/> + <points x="11" y="3"/> + </graphicsAlgorithmChildren> + <graphicsAlgorithmChildren xsi:type="al:Polygon" foreground="//@colors.2" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" x="30" y="24"> + <points x="-2" y="-3"/> + <points x="-2" y="3"/> + <points x="2" y="3"/> + <points x="2" y="-3"/> + </graphicsAlgorithmChildren> + </graphicsAlgorithmChildren> + </graphicsAlgorithm> + <link> + <businessObjects href="../TcpService.room#SimpleState:ATcpServer$initError"/> + </link> + <anchors xsi:type="pi:ChopboxAnchor" outgoingConnections="//@connections.8" incomingConnections="//@connections.7 //@connections.8" referencedGraphicsAlgorithm="//@children.0/@children.5/@graphicsAlgorithm/@graphicsAlgorithmChildren.0"/> + <children visible="true"> + <graphicsAlgorithm xsi:type="al:Text" background="//@colors.2" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0" width="60" height="30" x="30" y="30" font="//@fonts.0" horizontalAlignment="ALIGNMENT_CENTER" value="initError"/> + </children> + </children> + <children xsi:type="pi:ContainerShape" visible="true" active="true"> + <properties key="obj-type" value="trp"/> + <graphicsAlgorithm xsi:type="al:Rectangle" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" width="50" height="50" x="248" y="95"> + <graphicsAlgorithmChildren xsi:type="al:Ellipse" background="//@colors.1" foreground="//@colors.2" lineWidth="2" transparency="0.0" width="25" height="25" x="12" y="12"/> + </graphicsAlgorithm> + <link> + <businessObjects href="../TcpService.room#ChoicePoint:ATcpServer$cp0"/> + </link> + <anchors xsi:type="pi:ChopboxAnchor" outgoingConnections="//@connections.6 //@connections.7" incomingConnections="//@connections.0"/> + <children visible="true"> + <graphicsAlgorithm xsi:type="al:Text" background="//@colors.2" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0" width="50" height="25" y="12" font="//@fonts.0" horizontalAlignment="ALIGNMENT_CENTER" value="C"/> + </children> + </children> + </children> + <connections xsi:type="pi:FreeFormConnection" visible="true" active="true" start="//@children.0/@children.1/@anchors.0" end="//@children.0/@children.6/@anchors.0"> + <properties key="obj-type" value="trans"/> + <graphicsAlgorithm xsi:type="al:Polyline" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0"/> + <link> + <businessObjects href="../TcpService.room#InitialTransition:ATcpServer$initial"/> + </link> + <connectionDecorators visible="true" locationRelative="true" location="1.0"> + <graphicsAlgorithm xsi:type="al:Polygon" background="//@colors.1" foreground="//@colors.2" lineWidth="1" filled="true" transparency="0.0"> + <points x="-15" y="5"/> + <points/> + <points x="-15" y="-5"/> + </graphicsAlgorithm> + </connectionDecorators> + <connectionDecorators visible="true" active="true" locationRelative="true" location="0.5"> + <graphicsAlgorithm xsi:type="al:Text" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0" x="10" font="//@fonts.0" value="init"/> + </connectionDecorators> + </connections> + <connections xsi:type="pi:FreeFormConnection" visible="true" active="true" start="//@children.0/@children.2/@anchors.0" end="//@children.0/@children.2/@anchors.0"> + <properties key="obj-type" value="trans"/> + <graphicsAlgorithm xsi:type="al:Polyline" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0"/> + <link> + <businessObjects href="../TcpService.room#TriggeredTransition:ATcpServer$tr5"/> + </link> + <connectionDecorators visible="true" locationRelative="true" location="1.0"> + <graphicsAlgorithm xsi:type="al:Polygon" background="//@colors.2" foreground="//@colors.2" lineWidth="1" filled="true" transparency="0.0"> + <points x="-15" y="5"/> + <points/> + <points x="-15" y="-5"/> + </graphicsAlgorithm> + </connectionDecorators> + <connectionDecorators visible="true" active="true" locationRelative="true" location="0.5"> + <graphicsAlgorithm xsi:type="al:Text" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0" x="10" font="//@fonts.0" value="tr5: <dataPackage:pa..."/> + </connectionDecorators> + <bendpoints x="726" y="278"/> + <bendpoints x="767" y="338"/> + <bendpoints x="697" y="316"/> + </connections> + <connections xsi:type="pi:FreeFormConnection" visible="true" active="true" start="//@children.0/@children.2/@anchors.0" end="//@children.0/@children.3/@anchors.0"> + <properties key="obj-type" value="trans"/> + <graphicsAlgorithm xsi:type="al:Polyline" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0"/> + <link> + <businessObjects href="../TcpService.room#TriggeredTransition:ATcpServer$tr6"/> + </link> + <connectionDecorators visible="true" locationRelative="true" location="1.0"> + <graphicsAlgorithm xsi:type="al:Polygon" background="//@colors.2" foreground="//@colors.2" lineWidth="1" filled="true" transparency="0.0"> + <points x="-15" y="5"/> + <points/> + <points x="-15" y="-5"/> + </graphicsAlgorithm> + </connectionDecorators> + <connectionDecorators visible="true" active="true" locationRelative="true" location="0.5"> + <graphicsAlgorithm xsi:type="al:Text" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0" x="10" font="//@fonts.0" value="tr6: <disconnect:con..."/> + </connectionDecorators> + </connections> + <connections xsi:type="pi:FreeFormConnection" visible="true" active="true" start="//@children.0/@children.3/@anchors.0" end="//@children.0/@children.4/@anchors.0"> + <properties key="obj-type" value="trans"/> + <graphicsAlgorithm xsi:type="al:Polyline" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0"/> + <link> + <businessObjects href="../TcpService.room#TriggeredTransition:ATcpServer$tr7"/> + </link> + <connectionDecorators visible="true" locationRelative="true" location="1.0"> + <graphicsAlgorithm xsi:type="al:Polygon" background="//@colors.2" foreground="//@colors.2" lineWidth="1" filled="true" transparency="0.0"> + <points x="-15" y="5"/> + <points/> + <points x="-15" y="-5"/> + </graphicsAlgorithm> + </connectionDecorators> + <connectionDecorators visible="true" active="true" locationRelative="true" location="0.5"> + <graphicsAlgorithm xsi:type="al:Text" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0" x="10" font="//@fonts.0" value="tr7: <connect:contro..."/> + </connectionDecorators> + </connections> + <connections xsi:type="pi:FreeFormConnection" visible="true" active="true" start="//@children.0/@children.4/@anchors.0" end="//@children.0/@children.2/@anchors.0"> + <properties key="obj-type" value="trans"/> + <graphicsAlgorithm xsi:type="al:Polyline" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0"/> + <link> + <businessObjects href="../TcpService.room#ContinuationTransition:ATcpServer$tr4"/> + </link> + <connectionDecorators visible="true" locationRelative="true" location="1.0"> + <graphicsAlgorithm xsi:type="al:Polygon" background="//@colors.2" foreground="//@colors.2" lineWidth="1" filled="true" transparency="0.0"> + <points x="-15" y="5"/> + <points/> + <points x="-15" y="-5"/> + </graphicsAlgorithm> + </connectionDecorators> + <connectionDecorators visible="true" active="true" locationRelative="true" location="0.5"> + <graphicsAlgorithm xsi:type="al:Text" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0" x="10" font="//@fonts.0" value="tr4: [else]"/> + </connectionDecorators> + <bendpoints x="641" y="368"/> + </connections> + <connections xsi:type="pi:FreeFormConnection" visible="true" active="true" start="//@children.0/@children.4/@anchors.0" end="//@children.0/@children.3/@anchors.0"> + <properties key="obj-type" value="trans"/> + <graphicsAlgorithm xsi:type="al:Polyline" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0"/> + <link> + <businessObjects href="../TcpService.room#CPBranchTransition:ATcpServer$tr8"/> + </link> + <connectionDecorators visible="true" locationRelative="true" location="1.0"> + <graphicsAlgorithm xsi:type="al:Polygon" background="//@colors.2" foreground="//@colors.2" lineWidth="1" filled="true" transparency="0.0"> + <points x="-15" y="5"/> + <points/> + <points x="-15" y="-5"/> + </graphicsAlgorithm> + </connectionDecorators> + <connectionDecorators visible="true" active="true" locationRelative="true" location="0.5"> + <graphicsAlgorithm xsi:type="al:Text" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0" x="29" y="14" font="//@fonts.0" value="tr8: [hasError()]"/> + </connectionDecorators> + <bendpoints x="347" y="368"/> + </connections> + <connections xsi:type="pi:FreeFormConnection" visible="true" active="true" start="//@children.0/@children.6/@anchors.0" end="//@children.0/@children.3/@anchors.0"> + <properties key="obj-type" value="trans"/> + <graphicsAlgorithm xsi:type="al:Polyline" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0"/> + <link> + <businessObjects href="../TcpService.room#ContinuationTransition:ATcpServer$tr0"/> + </link> + <connectionDecorators visible="true" locationRelative="true" location="1.0"> + <graphicsAlgorithm xsi:type="al:Polygon" background="//@colors.1" foreground="//@colors.2" lineWidth="1" filled="true" transparency="0.0"> + <points x="-15" y="5"/> + <points/> + <points x="-15" y="-5"/> + </graphicsAlgorithm> + </connectionDecorators> + <connectionDecorators visible="true" active="true" locationRelative="true" location="0.5"> + <graphicsAlgorithm xsi:type="al:Text" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0" x="10" font="//@fonts.0" value="tr0: [else]"/> + </connectionDecorators> + </connections> + <connections xsi:type="pi:FreeFormConnection" visible="true" active="true" start="//@children.0/@children.6/@anchors.0" end="//@children.0/@children.5/@anchors.0"> + <properties key="obj-type" value="trans"/> + <graphicsAlgorithm xsi:type="al:Polyline" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0"/> + <link> + <businessObjects href="../TcpService.room#CPBranchTransition:ATcpServer$tr1"/> + </link> + <connectionDecorators visible="true" locationRelative="true" location="1.0"> + <graphicsAlgorithm xsi:type="al:Polygon" background="//@colors.1" foreground="//@colors.2" lineWidth="1" filled="true" transparency="0.0"> + <points x="-15" y="5"/> + <points/> + <points x="-15" y="-5"/> + </graphicsAlgorithm> + </connectionDecorators> + <connectionDecorators visible="true" active="true" locationRelative="true" location="0.5"> + <graphicsAlgorithm xsi:type="al:Text" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0" x="-100" y="-2" font="//@fonts.0" value="tr1: [hasError()]"/> + </connectionDecorators> + </connections> + <connections xsi:type="pi:FreeFormConnection" visible="true" active="true" start="//@children.0/@children.5/@anchors.0" end="//@children.0/@children.5/@anchors.0"> + <properties key="obj-type" value="trans"/> + <graphicsAlgorithm xsi:type="al:Polyline" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0"/> + <link> + <businessObjects href="../TcpService.room#TriggeredTransition:ATcpServer$tr2"/> + </link> + <connectionDecorators visible="true" locationRelative="true" location="1.0"> + <graphicsAlgorithm xsi:type="al:Polygon" background="//@colors.1" foreground="//@colors.2" lineWidth="1" filled="true" transparency="0.0"> + <points x="-15" y="5"/> + <points/> + <points x="-15" y="-5"/> + </graphicsAlgorithm> + </connectionDecorators> + <connectionDecorators visible="true" active="true" locationRelative="true" location="0.5"> + <graphicsAlgorithm xsi:type="al:Text" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0" x="10" font="//@fonts.0" value="tr2: <connect:contro..."/> + </connectionDecorators> + <bendpoints x="174" y="355"/> + <bendpoints x="143" y="301"/> + </connections> + <colors red="227" green="238" blue="249"/> + <colors red="255" green="255" blue="255"/> + <colors/> + <colors red="200" green="200" blue="200"/> + <fonts name="Arial" size="8"/> + <fonts name="Arial" size="9" bold="true"/> +</pi:Diagram> diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etTcpSockets.h b/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etTcpSockets.h index ce332f31b..310ecc76a 100644 --- a/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etTcpSockets.h +++ b/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etTcpSockets.h @@ -69,7 +69,8 @@ etSocketError; */ /** - * to be called once before working with sockets + * to be called before working with sockets. + * can be called multiple times, but must be aligned with etCleanupSockets */ etSocketError etInitSockets(); diff --git a/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW/etTcpSockets.c b/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW/etTcpSockets.c index 79a2ec85e..e650175d1 100644 --- a/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW/etTcpSockets.c +++ b/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW/etTcpSockets.c @@ -110,6 +110,7 @@ static void listenerThreadFunc(void* threadData) { "etSocketServer", readThreadFunc, &self->connections[slot]); + etThread_start(&self->connections[slot].readThread); } /* TODO: if maxConnections is reached this thread terminates. @@ -141,6 +142,7 @@ etSocketError etCleanupSockets() { etSocketServerData* etCreateSocketServerData() { etSocketServerDataImpl* data = malloc(sizeof(etSocketServerDataImpl)); memset(data, 0, sizeof(etSocketServerDataImpl)); + data->data.maxConnections = MAX_CONNECTIONS; return &data->data; } @@ -189,6 +191,7 @@ etSocketError etStartListening(etSocketServerData* data, short port) { "etSocketServer", listenerThreadFunc, self); + etThread_start(&self->listenerThread); return ETSOCKET_OK; } @@ -215,6 +218,7 @@ etSocketError etWriteServerSocket(etSocketServerData* dat, int connection, int s while (size>0) { int sent = send(self->connections[connection].socket, ((int8*)data)+offset, size, 0); + if (sent<=0) return ETSOCKET_ERROR; @@ -286,7 +290,7 @@ etSocketError etConnectServer(etSocketConnectionData* data, const char* addr, sh self->address.sin_family = host->h_addrtype; self->address.sin_port = htons(port); - self->socket = socket(AF_INET, SOCK_STREAM, 0); + self->socket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); if (self->socket==INVALID_SOCKET) return ETSOCKET_ERROR; @@ -303,6 +307,7 @@ etSocketError etConnectServer(etSocketConnectionData* data, const char* addr, sh "etSocketConnection", readThreadFunc, self); + etThread_start(&self->readThread); return ETSOCKET_OK; } @@ -313,6 +318,7 @@ etSocketError etWriteSocket(etSocketConnectionData* dat, int size, const int8* d while (size>0) { int sent = send(self->socket, ((int8*)data)+offset, size, 0); + if (sent<=0) return ETSOCKET_ERROR; |