void UpdateUserPosition(int currRSSI) { if (currRSSI != 0) { //get user position as vector2 Vector2 userPos = new Vector2(user.position.x, user.position.z); //get mac addres of currently connected access point string currMac = wifiSignal.GetMacAddress(); //first get list of nodes with same mac address List <GridData> macNodes = nodeController.GetNodes().Where(x => x.mac == currMac).ToList(); //find closest nodes by RSSI List <GridData> closestNodesByRSSI = macNodes .OrderBy(item => Mathf.Abs(currRSSI - item.strength)) .ThenBy(item => Vector2.Distance(userPos, item.pos)).ToList(); //DONT KNOW WHAT THE F**K TO DO HERE ANYMORE,NOTHING WORKS!!! GridData closestNode = closestNodesByRSSI.First(); //F**K. //set user dot to move to this position desiredPosition = new Vector3(closestNode.pos.x, .2f, closestNode.pos.y); } }
void CreateNode() { numNodes++; Debug.Log("Node: " + numNodes); //get node info Vector2 pos = positionalTracker.GetPosition(); int rssi = wifiSignal.GetCurrSignal(); string mac = wifiSignal.GetMacAddress(); //add node info to json string jsonFileWriter.AddNode(mac, rssi, pos); //instantiate node Vector3 worldNodePos = new Vector3(pos.x, Camera.main.transform.position.y, pos.y); GameObject node = Instantiate(nodePrefab, worldNodePos, Quaternion.identity); node.transform.position -= new Vector3(0, .1f, 0); string nodeText = "Mac: " + mac + "\n" + "RSSI: " + rssi + "dB"; node.GetComponent <NodeBehavior>().Init(nodeText, numNodes); }
void set_value() { Mac = wifiSignal.GetMacAddress(); frequency = wifiSignal.GetFrequency(); link_speed = wifiSignal.GetLinkSpeed(); }