/** * Determines whether a specific Net capability is supported by the device. * * @param type Type of feature to check. * @return true if supported, false otherwise. * @since v2.0 */ public bool HasNetSupport(ICapabilitiesNet type) { // 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 hasNetSupport..."); } bool result = false; if (this._delegate != null) { result = this._delegate.HasNetSupport(type); if (logger != null) { logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "CapabilitiesBridge executed 'hasNetSupport' in " + (TimerUtil.CurrentTimeMillis() - tIn) + "ms."); } } else { if (logger != null) { logger.Log(ILoggingLogLevel.Error, this.apiGroup.ToString(), "CapabilitiesBridge no delegate for 'hasNetSupport'."); } } return(result); }
/** * 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); }
/** * Constructor used by the implementation * * @param Network of the app * @param Timestamp Timestamp of the event * @since V2.2.1 */ public NetworkEvent(ICapabilitiesNet network, long timestamp) : base() { this.Network = Network; this.Timestamp = Timestamp; }
/** * Network setter * * @param Network New network switched * @since V2.2.1 */ public void SetNetwork(ICapabilitiesNet Network) { this.Network = Network; }