/** * Determines whether the device/display supports a given orientation. * * @param orientation Orientation type. * @return True if the given orientation is supported, false otherwise. * @since v2.0.5 */ public bool HasOrientationSupport(ICapabilitiesOrientation orientation) { // Start logging elapsed time. long tIn = TimerUtil.CurrentTimeMillis(); ILogging logger = AppRegistryBridge.GetInstance().GetLoggingBridge(); if (logger != null) { logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "CapabilitiesBridge executing hasOrientationSupport..."); } bool result = false; if (this._delegate != null) { result = this._delegate.HasOrientationSupport(orientation); if (logger != null) { logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "CapabilitiesBridge executed 'hasOrientationSupport' in " + (TimerUtil.CurrentTimeMillis() - tIn) + "ms."); } } else { if (logger != null) { logger.Log(ILoggingLogLevel.Error, this.apiGroup.ToString(), "CapabilitiesBridge no delegate for 'hasOrientationSupport'."); } } return(result); }
/** * Returns the current orientation of the device. Please note that this may be different from the orientation * of the display. For display orientation, use the IDisplay APIs. * * @return The current orientation of the device. * @since v2.0.5 */ public ICapabilitiesOrientation GetOrientationCurrent() { // Start logging elapsed time. long tIn = TimerUtil.CurrentTimeMillis(); ILogging logger = AppRegistryBridge.GetInstance().GetLoggingBridge(); if (logger != null) { logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "DeviceBridge executing getOrientationCurrent..."); } ICapabilitiesOrientation result = ICapabilitiesOrientation.Unknown; if (this._delegate != null) { result = this._delegate.GetOrientationCurrent(); if (logger != null) { logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "DeviceBridge executed 'getOrientationCurrent' in " + (TimerUtil.CurrentTimeMillis() - tIn) + "ms."); } } else { if (logger != null) { logger.Log(ILoggingLogLevel.Error, this.apiGroup.ToString(), "DeviceBridge no delegate for 'getOrientationCurrent'."); } } return(result); }
/** * Convenience constructor. * * @param Origin Source orientation when the event was fired. * @param Destination Destination orientation when the event was fired. * @param State State of the event (WillBegin, DidFinish). * @param Timestamp Timestamp in milliseconds when the event was fired. * @since V2.0.5 */ public RotationEvent(ICapabilitiesOrientation origin, ICapabilitiesOrientation destination, RotationEventState state, long timestamp) : base() { this.Origin = Origin; this.Destination = Destination; this.State = State; this.Timestamp = Timestamp; }
/** * Invokes the given method specified in the API request object. * * @param request APIRequest object containing method name and parameters. * @return APIResponse with status code, message and JSON response or a JSON null string for void functions. Status code 200 is OK, all others are HTTP standard error conditions. */ public new APIResponse Invoke(APIRequest request) { APIResponse response = new APIResponse(); int responseCode = 200; String responseMessage = "OK"; String responseJSON = "null"; switch (request.GetMethodName()) { case "addDisplayOrientationListener": IDisplayOrientationListener listener0 = new DisplayOrientationListenerImpl(request.GetAsyncId()); this.AddDisplayOrientationListener(listener0); break; case "getOrientationCurrent": ICapabilitiesOrientation response1 = this.GetOrientationCurrent(); responseJSON = GetJSONProcessor().SerializeObject(response1); break; case "removeDisplayOrientationListener": IDisplayOrientationListener listener2 = new DisplayOrientationListenerImpl(request.GetAsyncId()); this.RemoveDisplayOrientationListener(listener2); break; case "removeDisplayOrientationListeners": this.RemoveDisplayOrientationListeners(); break; default: // 404 - response null. responseCode = 404; responseMessage = "DisplayBridge does not provide the function '" + request.GetMethodName() + "' Please check your client-side API version; should be API version >= v2.2.15."; break; } response.SetResponse(responseJSON); response.SetStatusCode(responseCode); response.SetStatusMessage(responseMessage); return(response); }
/** * Invokes the given method specified in the API request object. * * @param request APIRequest object containing method name and parameters. * @return APIResponse with status code, message and JSON response or a JSON null string for void functions. Status code 200 is OK, all others are HTTP standard error conditions. */ public new APIResponse Invoke(APIRequest request) { APIResponse response = new APIResponse(); int responseCode = 200; String responseMessage = "OK"; String responseJSON = "null"; switch (request.GetMethodName()) { case "addButtonListener": IButtonListener listener0 = new ButtonListenerImpl(request.GetAsyncId()); this.AddButtonListener(listener0); break; case "addDeviceOrientationListener": IDeviceOrientationListener listener1 = new DeviceOrientationListenerImpl(request.GetAsyncId()); this.AddDeviceOrientationListener(listener1); break; case "getDeviceInfo": DeviceInfo response2 = this.GetDeviceInfo(); if (response2 != null) { responseJSON = GetJSONProcessor().SerializeObject(response2); } break; case "getLocaleCurrent": Locale response3 = this.GetLocaleCurrent(); if (response3 != null) { responseJSON = GetJSONProcessor().SerializeObject(response3); } break; case "getOrientationCurrent": ICapabilitiesOrientation response4 = this.GetOrientationCurrent(); responseJSON = GetJSONProcessor().SerializeObject(response4); break; case "removeButtonListener": IButtonListener listener5 = new ButtonListenerImpl(request.GetAsyncId()); this.RemoveButtonListener(listener5); break; case "removeButtonListeners": this.RemoveButtonListeners(); break; case "removeDeviceOrientationListener": IDeviceOrientationListener listener7 = new DeviceOrientationListenerImpl(request.GetAsyncId()); this.RemoveDeviceOrientationListener(listener7); break; case "removeDeviceOrientationListeners": this.RemoveDeviceOrientationListeners(); break; default: // 404 - response null. responseCode = 404; responseMessage = "DeviceBridge does not provide the function '" + request.GetMethodName() + "' Please check your client-side API version; should be API version >= v2.2.15."; break; } response.SetResponse(responseJSON); response.SetStatusCode(responseCode); response.SetStatusMessage(responseMessage); return(response); }
/** * Invokes the given method specified in the API request object. * * @param request APIRequest object containing method name and parameters. * @return APIResponse with status code, message and JSON response or a JSON null string for void functions. Status code 200 is OK, all others are HTTP standard error conditions. */ public new APIResponse Invoke(APIRequest request) { APIResponse response = new APIResponse(); int responseCode = 200; String responseMessage = "OK"; String responseJSON = "null"; switch (request.GetMethodName()) { case "getOrientationDefault": ICapabilitiesOrientation response0 = this.GetOrientationDefault(); responseJSON = GetJSONProcessor().SerializeObject(response0); break; case "getOrientationsSupported": ICapabilitiesOrientation[] response1 = this.GetOrientationsSupported(); if (response1 != null) { responseJSON = GetJSONProcessor().SerializeObject(response1); } break; case "hasButtonSupport": ICapabilitiesButton type2 = GetJSONProcessor().DeserializeObject <ICapabilitiesButton>(request.GetParameters()[0]); bool response2 = this.HasButtonSupport(type2); responseJSON = GetJSONProcessor().SerializeObject(response2); break; case "hasCommunicationSupport": ICapabilitiesCommunication type3 = GetJSONProcessor().DeserializeObject <ICapabilitiesCommunication>(request.GetParameters()[0]); bool response3 = this.HasCommunicationSupport(type3); responseJSON = GetJSONProcessor().SerializeObject(response3); break; case "hasDataSupport": ICapabilitiesData type4 = GetJSONProcessor().DeserializeObject <ICapabilitiesData>(request.GetParameters()[0]); bool response4 = this.HasDataSupport(type4); responseJSON = GetJSONProcessor().SerializeObject(response4); break; case "hasMediaSupport": ICapabilitiesMedia type5 = GetJSONProcessor().DeserializeObject <ICapabilitiesMedia>(request.GetParameters()[0]); bool response5 = this.HasMediaSupport(type5); responseJSON = GetJSONProcessor().SerializeObject(response5); break; case "hasNetSupport": ICapabilitiesNet type6 = GetJSONProcessor().DeserializeObject <ICapabilitiesNet>(request.GetParameters()[0]); bool response6 = this.HasNetSupport(type6); responseJSON = GetJSONProcessor().SerializeObject(response6); break; case "hasNotificationSupport": ICapabilitiesNotification type7 = GetJSONProcessor().DeserializeObject <ICapabilitiesNotification>(request.GetParameters()[0]); bool response7 = this.HasNotificationSupport(type7); responseJSON = GetJSONProcessor().SerializeObject(response7); break; case "hasOrientationSupport": ICapabilitiesOrientation orientation8 = GetJSONProcessor().DeserializeObject <ICapabilitiesOrientation>(request.GetParameters()[0]); bool response8 = this.HasOrientationSupport(orientation8); responseJSON = GetJSONProcessor().SerializeObject(response8); break; case "hasSensorSupport": ICapabilitiesSensor type9 = GetJSONProcessor().DeserializeObject <ICapabilitiesSensor>(request.GetParameters()[0]); bool response9 = this.HasSensorSupport(type9); responseJSON = GetJSONProcessor().SerializeObject(response9); break; default: // 404 - response null. responseCode = 404; responseMessage = "CapabilitiesBridge does not provide the function '" + request.GetMethodName() + "' Please check your client-side API version; should be API version >= v2.2.15."; break; } response.SetResponse(responseJSON); response.SetStatusCode(responseCode); response.SetStatusMessage(responseMessage); return(response); }
/** * Set the origin orientation of the event. * * @param Origin Origin orientation * @since V2.0.5 */ public void SetOrigin(ICapabilitiesOrientation Origin) { this.Origin = Origin; }
/** * Sets the destination orientation of the event. * * @param Destination Destination orientation. * @since V2.0.5 */ public void SetDestination(ICapabilitiesOrientation Destination) { this.Destination = Destination; }