started adding server code for joining experiments
This commit is contained in:
parent
1a249fe1ec
commit
96af8a439c
1 changed files with 9 additions and 3 deletions
|
@ -363,19 +363,23 @@ class CoreApiBridge(object):
|
||||||
|
|
||||||
|
|
||||||
def processApi2SessionMsg(self, message, purpose):
|
def processApi2SessionMsg(self, message, purpose):
|
||||||
if self.handler.debug:
|
|
||||||
self.info('Received session request message')
|
|
||||||
if purpose == coreapi2.ADD:
|
if purpose == coreapi2.ADD:
|
||||||
|
if self.handler.debug:
|
||||||
|
self.info('Received ADD session request message')
|
||||||
|
|
||||||
legacymsgs = []
|
legacymsgs = []
|
||||||
legacymsgs.append(wrapper.RegMsg.instantiate(0, gui='true'))
|
legacymsgs.append(wrapper.RegMsg.instantiate(0, gui='true'))
|
||||||
return legacymsgs
|
return legacymsgs
|
||||||
# The response will be sent to the API2 client when a legacy session message is received from the daemon
|
# The response will be sent to the API2 client when a legacy session message is received from the daemon
|
||||||
elif purpose == coreapi2.MODIFY:
|
elif purpose == coreapi2.MODIFY:
|
||||||
|
if self.handler.debug:
|
||||||
|
self.info('Received MODIFY session request message')
|
||||||
|
|
||||||
legacymsgs = []
|
legacymsgs = []
|
||||||
if message.HasField("experiment"):
|
if message.HasField("experiment"):
|
||||||
exp = message.experiment
|
exp = message.experiment
|
||||||
if exp.HasField("experimentId"):
|
if exp.HasField("experimentId"):
|
||||||
expId = str(experiment.experimentId)
|
expId = str(exp.experimentId)
|
||||||
response = coreapi2.CoreMessage()
|
response = coreapi2.CoreMessage()
|
||||||
response.experiment.experimentId = exp.experimentId;
|
response.experiment.experimentId = exp.experimentId;
|
||||||
response.purpose = purpose
|
response.purpose = purpose
|
||||||
|
@ -385,6 +389,8 @@ class CoreApiBridge(object):
|
||||||
if expId.startswith('_'):
|
if expId.startswith('_'):
|
||||||
try:
|
try:
|
||||||
legacySessNo = int(expId[1:])
|
legacySessNo = int(expId[1:])
|
||||||
|
legacymsgs.append(wrapper.ConfMsg.instantiate("all",
|
||||||
|
coreapi.CONF_TYPE_FLAGS_RESET))
|
||||||
legacymsgs.append(wrapper.RegMsg.instantiate(0, gui='true'))
|
legacymsgs.append(wrapper.RegMsg.instantiate(0, gui='true'))
|
||||||
legacymsgs.append(wrapper.SessionMsg.instantiate(0, legacySessNo))
|
legacymsgs.append(wrapper.SessionMsg.instantiate(0, legacySessNo))
|
||||||
except:
|
except:
|
||||||
|
|
Loading…
Reference in a new issue