예제 #1
0
        public ListResponse<NodeProbability> GetNodeProbabiltyForScan(LocationRequest request)
        {
            var result = new ListResponse<NodeProbability>();

            ExecuteMaps(entities => { result.List = FingerprintService.GetNodeProbabiltyForScan(entities, request); },
                        result);

            return result;
        }
예제 #2
0
        public static List<NodeProbability> GetNodeProbabiltyForScan(MapsEntities entities, LocationRequest request)
        {
            // Gesammelte WLAN-Fingerprints aus DB auswerten und Verteilung bestimmen
            // Jetzt: gecachet!
            FingerprintCacheObject cache = StudMapCache.Fingerprint(request.MapId);
            MapCacheObject mapCache = StudMapCache.Map(request.MapId);
            Node previousNode = mapCache.Nodes.ContainsKey(request.PreviousNodeId)
                                    ? mapCache.Nodes[request.PreviousNodeId]
                                    : new Node {Id = 0};

            // AccessPoint-Messung nach APs aufteilen
            Dictionary<int, int> apScans = AnalyseInputScan(request.Scans, cache.MACtoAP);

            // W'keit bestimmen, dass RSS-Werte an Knoten gemessen werden
            Func<int, double> getDistance;
            if (request.PreviousNodeId == 0)
                getDistance = nodeId => 1.0;
            else
                getDistance = nodeId =>
                    {
                        double distance;
                        if (mapCache.PathFinder.TryGetDistance(previousNode.Id, nodeId, out distance))
                            return distance;
                        else
                            return -1;
                    };

            List<NodeProbability> nodeProbs = CalculateNodeProbabilities(cache.NodeDistributions, apScans, getDistance);

            // Absteigend nach W'keit sortieren
            nodeProbs.Sort((m, n) => n.Probabilty.CompareTo(m.Probabilty));

            // Maximal die angeforderte Anzahl an Knoten zurückliefern
            int count = Math.Min(request.NodeCount, nodeProbs.Count);
            return nodeProbs.GetRange(0, count);
        }
예제 #3
0
 public ObjectResponse<Node> GetNodeForFingerprint(LocationRequest request)
 {
     return new ObjectResponse<Node>();
 }