Ejemplo n.º 1
0
 /** @since Available in iOS 2.0 and later. */
 public static CFNetServiceMonitor create(CFNetService theService, ClientCallback clientCB) {
   long refconId = CFNetServiceMonitor.refconId.getAndIncrement();
   CFNetServiceClientContext context = new CFNetServiceClientContext();
   context.info(refconId);
   synchronized (callbacks) {
     callbacks.put(refconId, clientCB);
   }
   CFNetServiceMonitor service = create(null, theService, new FunctionPtr(cbInvoke), context);
   if (service != null) service.localRefconId = refconId;
   return service;
 }
Ejemplo n.º 2
0
 /*</members>*/
 @Callback
 private static void cbInvoke(
     CFNetServiceMonitor monitor,
     CFNetService service,
     CFNetServiceMonitorType infoType,
     CFData data,
     CFStreamError.CFStreamErrorPtr error,
     @Pointer long refcon) {
   ClientCallback callback = null;
   synchronized (callbacks) {
     callback = callbacks.get(refcon);
   }
   CFStreamError err = null;
   if (error != null) err = error.get();
   callback.invoke(monitor, service, infoType, data, err);
 }