Changeset 1074:638d4c261307


Ignore:
Timestamp:
02/14/23 14:27:21 (23 months ago)
Author:
István Váradi <ivaradi@…>
Branch:
python3
Phase:
public
Message:

New RPC call to query the SimBrief results (re #362)

Location:
src/mlx
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/mlx/rpc.py

    r1069 r1074  
    752752                     for typeCode in reply.value["typeCodes"]]
    753753
    754             return (reply.value["name"], reply.value["rank"], types)
     754            return (reply.value["name"], reply.value["rank"], types,
     755                    self._sessionID)
    755756        else:
    756757            return None
     
    869870                                                            tailNumber))
    870871        return [BookedFlight(value) for value in values]
     872
     873    def getSimBriefResult(self, timestamp):
     874        """Get the SimBrief results for the given timestamp."""
     875        return self._performCall(lambda sessionID:
     876                                 self._server.getSimBriefResult(sessionID,
     877                                                                timestamp))
    871878
    872879    def _performCall(self, callFn, acceptResults = []):
  • src/mlx/web.py

    r1057 r1074  
    473473            result.rank = loginResult[1]
    474474            result.types = loginResult[2]
     475            result.sessionID = loginResult[3]
    475476            result.password = password
    476477            result.fleet = client.getFleet()
     
    876877#------------------------------------------------------------------------------
    877878
     879class GetSimBriefResult(RPCRequest):
     880    """Request the SimBrief result."""
     881    def __init__(self, client, callback, timestamp):
     882        """Construct the request with the given client and callback function."""
     883        super(GetSimBriefResult, self).__init__(client, callback)
     884        self._timestamp = timestamp
     885
     886    def run(self):
     887        """Perform the request."""
     888        result = Result()
     889
     890        result.result = self._client.getSimBriefResult(self._timestamp)
     891
     892        return result
     893
     894#------------------------------------------------------------------------------
     895
    878896class Handler(threading.Thread):
    879897    """The handler for the web services.
     
    970988        self._addRequest(BookFlights(self._rpcClient, callback,
    971989                                     flightIDs, date, tailNumber))
     990
     991    def getSimBriefResult(self, callback, timestamp):
     992        """Enqueue a request to get the SimBrief result."""
     993        self._addRequest(GetSimBriefResult(self._rpcClient, callback,
     994                                           timestamp))
    972995
    973996    def run(self):
Note: See TracChangeset for help on using the changeset viewer.