+ neededsubs = clients.subs()
+ for imei in neededsubs - activesubs:
+ zsub.setsockopt(
+ zmq.SUBSCRIBE,
+ topic(GPS_POSITIONING.PROTO, True, imei),
+ )
+ zsub.setsockopt(
+ zmq.SUBSCRIBE,
+ topic(WIFI_POSITIONING.PROTO, False, imei),
+ )
+ zsub.setsockopt(
+ zmq.SUBSCRIBE,
+ topic(STATUS.PROTO, True, imei),
+ )
+ for imei in activesubs - neededsubs:
+ zsub.setsockopt(
+ zmq.UNSUBSCRIBE,
+ topic(GPS_POSITIONING.PROTO, True, imei),
+ )
+ zsub.setsockopt(
+ zmq.UNSUBSCRIBE,
+ topic(WIFI_POSITIONING.PROTO, False, imei),
+ )
+ zsub.setsockopt(
+ zmq.UNSUBSCRIBE,
+ topic(STATUS.PROTO, True, imei),
+ )
+ activesubs = neededsubs
+ log.debug("Subscribed to: %s", activesubs)