Draw a sequence diagram

1.4k views Asked by At

It's the first time I draw an UML sequence diagram and I am not sure about few things.

enter image description here

I have a beacon which is a raspberry pi with bluetooth dongle. The server asks the beacon to start to change it's ID periodically(startIDRotation). The beacon broadcast and change them after each interval. When the smartphone wants to make a request, it includes the detected IDs, that the beacon is broadcasting in the request, with the requested file and send the request to the server. The server uses a logic represented in another activity diagram to decide if the user has access or not to the file and send back a response to the smartphone.

The first question is, is it correct to draw the line between the beacon and the smartphone? Because the beacon is not sending the IDs specifically to the beacon, it's just broadcasting them over bluetooth.

Is it possible to make a reference to another diagram type as the decision diagram is an activity diagram?

The server sends a post request to the beacon to start the rotation once, but it keep the state of the beacon and know that it's rotating its IDs. Shall this be represented as synchronous as I did or asynchronous?

If you have any other remark please feel free to correct me.

2

There are 2 answers

0
qwerty_so On

is it correct to draw the line between the beacon and the smartphone?

Yes. The line represents a message. And the life line represent an individual instance. When the phone receives the broadcast, this is the message sent. Since you did draw an open arrow, it indicates an asynchronous call. So that's perfect.

Is it possible to make a reference to another diagram type ? as the decision diagram is an activity diagram.

Yes. And you will do it the way you did, by adding a diagram reference. This represents details at the covered area. You can as well add arbitrary diagram references as shown below.

shall this be represented as synchronous as I did or asynchronous ?

It depends. Most likely you will have a synchronous communacation (closed triangle) here, because the server want's to know whether the message has arrived and the beacon acknowledges the start of the activity.

enter image description here

8
Ister On
  1. Yes, Beacon sends (broadcasts) an asynchronous signal to a Smartphone so there should be a message line depicting it.

  2. By Ref you reference another sequence diagram. If you want to represent some behaviour (activity that is described with some activity diagram), use a synchronous request that pings back to the same lifeline (from Server to Server) with the call to activity responsible to perform privileges check. You can also put name of executed action inside the execution specification (make the thin rectangle somewhat wider to squeeze it in - see 17.2.4.4 in UML specification).

  3. All your lines represent asynchronous messages. To show synchronous message use a solid line with a filled triangle as an arrowhead. To present response use dashed line with an open arrowhead. If your specific message should be synchronous or asynchronous depends on your needs. Broadcast is asynchronous all other can be either synchronous or asynchronous.