Windows环境部署UDP服务器如何区分多个iBeacon信标实现定位?
iBeacon信标识别与定位实现方案
我目前不清楚如何区分多个信标,希望在Windows系统上搭建UDP服务器来识别不同的iBeacon信标,以完成定位项目。
位置计算代码
float xa = beacon1.locationX; float ya = beacon1.locationY; float xb = beacon2.locationX; float yb = beacon2.locationY; float xc = beacon3.locationX; float yc = beacon3.locationY; float ra = b1; float rb = b2; float rc = b3; float S = (pow(xc, 2.) - pow(xb, 2.) + pow(yc, 2.) - pow(yb, 2.) + pow(rb, 2.) - pow(rc, 2.)) / 2.0; float T = (pow(xa, 2.) - pow(xb, 2.) + pow(ya, 2.) - pow(yb, 2.) + pow(rb, 2.) - pow(ra, 2.)) / 2.0; float y = ((T * (xb - xc)) - (S * (xb - xa))) / (((ya - yb) * (xb - xc)) - ((yc - yb) * (xb - xa))); float x = ((y * (ya - yb)) - T) / (xb - xa); CGPoint point = CGPointMake(x, y); return point; }
UDP服务信标识别代码
bc, address = sock.recvfrom(4096) # buffer size adres, sygnal = bc.split(b'|') # split x = adres.decode(encoding="utf-8")
以上是该问题的解决方案,可通过上述方式识别信标。
内容的提问来源于stack exchange,提问作者MarekOS
相关产品推荐
相关产品推荐

