smalltalk
/
osmo-st-mgcp
Archived
1
0
Fork 0

callagent: Add state transitions to the MGCPEndpoint

This commit is contained in:
Holger Hans Peter Freyther 2011-06-24 10:09:12 +02:00
parent a87b29e094
commit ab1e189087
1 changed files with 60 additions and 0 deletions

View File

@ -67,4 +67,64 @@ Object subclass: MGCPEndpoint [
<category: 'state'>
^ state = self class stateUsed.
]
reserve [
<category: 'allocation'>
state = self class stateUnused ifFalse: [
^ self error: 'MGCPEndpoint(%1) not unused.'
% {self endpointName} area: #mgcp.
].
state := self class stateReserved.
]
used [
<category: 'allocation'>
state = self class stateReserved ifFalse: [
^ self error: 'MGCPEndpoint(%1) not reserved.'
% {self endpointName} area: #mgcp.
].
state := self class stateUsed.
]
free [
<category: 'allocation'>
state = self class stateUsed ifFalse: [
^ self error: 'MGCPEndpoint(%1) not used.'
% {self endpointName} area: #mgcp.
].
state := self class stateUnused.
]
tryBlock [
<category: 'allocation'>
state = self class stateUnused ifTrue: [
state := self class stateBlocked.
^ true
].
^ false
]
unblock [
<category: 'allocation'>
state = self class stateBlocked ifFalse: [
^ self error: 'MGCPEndpoint(%1) not blocked.'
% {self endpointName} area: #mgcp.
].
state := self class stateUnused.
]
sdp [
<category: 'sdp'>
^ sdp
]
sdp: aSdp [
<category: 'sdp'>
sdp := aSdp.
]
]