protected InputStream httpPostQueryStream(final AbsURL url) throws DataSyncerException { final NetworkClient client = NetworkClient.getInstance(); if (url.isAuthNeeded()) { final String auth = ReaderAccountMgr.getInstance().blockingGetAuth(); client.setAuth(auth); } try { return NetworkClient.getInstance().doPostStream(url.getURL(), url.getParamsString()); } catch (final IOException exception) { throw new DataSyncerException(exception); } catch (final NetworkException exception) { throw new DataSyncerException(exception); } }
protected Object makeNetworkedCall(Catbert.FastStack stack) throws sage.jep.ParseException { Object[] args = new Object[curNumberOfParameters]; for (int i = args.length - 1; i >= 0; i--) args[i] = stack.pop(); SageTVConnection sn = NetworkClient.getSN(); if (sn != null) return sn.requestAction(methodName, args); else return null; }
protected byte[] httpGetQueryByte(final AbsURL url) throws DataSyncerException { final NetworkClient client = NetworkClient.getInstance(); if (url.isAuthNeeded()) { final String auth = ReaderAccountMgr.getInstance().blockingGetAuth(); client.setAuth(auth); } try { String rUrl = url.getURL(); final String param = url.getParamsString(); if (param.length() > 0) { rUrl += "?" + param; } return client.doGetByte(rUrl); } catch (final Exception e) { throw new DataSyncerException(e); } }
// This is an overload of redetectCaptureDevices. It is meant to only redetect devices for // one CaptureDeviceManager. For instance discover NetworkEncoder devices public void redetectCaptureDevices(CaptureDeviceManager mgr) { if (Sage.DBG) System.out.println("MMC is re-doing the capture device detection on " + mgr); mgr.detectCaptureDevices( (CaptureDevice[]) globalEncoderMap.values().toArray(new CaptureDevice[0])); CaptureDevice[] newDevs = mgr.getCaptureDevices(); if (Sage.DBG) System.out.println("devices detected=" + java.util.Arrays.asList(newDevs)); updateCaptureDeviceObjects(newDevs); if (Sage.DBG) System.out.println("EncoderMap=" + globalEncoderMap); NetworkClient.distributeRecursivePropertyChange("mmc/encoders"); Seeker.getInstance().kick(); Scheduler.getInstance().kick(true); }
public final void run(Catbert.FastStack stack) throws sage.jep.ParseException { if (networked && Sage.client) { Object[] args = new Object[curNumberOfParameters]; for (int i = args.length - 1; i >= 0; i--) args[i] = stack.pop(); SageTVConnection sn = NetworkClient.getSN(); if (sn != null) stack.push(sn.requestAction(methodName, args)); else stack.push(null); // to keep the stack pointer correct } else { if (API_PROFILING) numCalls++; try { stack.push(runSafely(stack)); } catch (sage.jep.ParseException pe) { throw pe; } catch (Exception e) { e.printStackTrace(); throw new sage.jep.ParseException( "Error in method reflection of " + methodName + " of " + e, e); } } }
/** Cancels the request if it is in progress, else does nothing. */ public void cancel() { if (uploadRequest != null) { client.cancelRequests(uploadRequest.getContext(), true); NetworkClient.getInstance().onUploadFinished(uploadRequest.getRequestId(), false); } }