public void StartUp() { if (Instance == null) { Instance = GetInstance(); } _Startup = GetStatus(Instance.Startup()); }
public object Startup() { try { var AssestManager = new NabtoAndroidAssetManager(Application.Context); var objApi = new NabtoApi(AssestManager); NabtoStatus st = objApi.Startup(); return(objApi); } catch (Exception ex) { return(ex); } }
/// <summary> /// Creates an HResult from a NabtoStatus code. /// </summary> /// <param name="status">The NabtoStatus code to create an HResult from.</param> /// <returns>The HResult.</returns> int CreateHResult(NabtoStatus status) { return(CreateHResult(ErrorClass.ClientApi, (int)status)); }
/// <summary> /// Initializes a new instance of a NabtoClientException with the specified message. /// </summary> /// <param name="status">The internal Nabto status message related to the exception.</param> /// <param name="format">The format string for the message.</param> /// <param name="arguments">The arguments for the message.</param> internal NabtoClientException(NabtoStatus status, string format, params object[] arguments) : base(string.Format(format, arguments)) { HResult = CreateHResult(status); }
/// <summary> /// Initializes a new instance of a NabtoClientException with the specified message and internal Nabto status code. /// </summary> /// <param name="status">The internal Nabto status message related to the exception.</param> /// <param name="message">A message describing the exception.</param> internal NabtoClientException(NabtoStatus status, string message) : base(message) { HResult = CreateHResult(status); }
internal FileSystemIOException(NabtoStatus status) : base(status, "The Nabto client API was unable to access the file system.") { }
public NabtoStatus nabtoRpcSetInterface(IntPtr session, string host, string interfaceDefinition, out string errorMessage) { NabtoStatus status = concretePlatformAdapter.nabtoRpcSetInterface(session, host, interfaceDefinition, out errorMessage); return(NabtoStatusHandler(status, errorMessage)); }
public NabtoStatus nabtoRpcInvoke(IntPtr session, string nabtoUrl, out string resultJson) { NabtoStatus status = concretePlatformAdapter.nabtoRpcInvoke(session, nabtoUrl, out resultJson); return(NabtoStatusHandler(status, resultJson)); }
NabtoStatus NabtoStatusHandler(NabtoStatus status, string detail) { switch (status) { // This group of status codes indicate normal program flow i.e. ok or "acceptable" behaviour. case NabtoStatus.Ok: case NabtoStatus.DataPending: return(status); case NabtoStatus.BufferFull: throw new IOException("The write operation timed out."); case NabtoStatus.NoNetwork: throw new NoNetworkException(); case NabtoStatus.AddressInUse: throw new AddressInUseException(); case NabtoStatus.OpenCertificateOrPrivateKeyFailed: // could not open one of the certificate or private key files - probably because profile wasn't created (or user misspelled email address) throw new MissingProfileException(); case NabtoStatus.PortalLogInFailure: // email not found on current portal or invalid password. throw new PortalLoginException(); case NabtoStatus.UnlockPrivateKeyFailed: // invalid password. throw new InvalidPasswordException(); case NabtoStatus.InvalidAddress: // the given email address was invalid. throw new InvalidEmailException(); case NabtoStatus.StreamingUnsupported: // the device does not support streaming throw new StreamingNotSupportedException(); case NabtoStatus.ApiNotInitialized: throw new ApiNotStartedException(); case NabtoStatus.CertificateSavingFailure: case NabtoStatus.ErrorReadingConfig: throw new FileSystemIOException(status); case NabtoStatus.CertificateSigningError: // the local certificate has been tampered with. throw new CertificateSigningException(); case NabtoStatus.ConnectToHostFailed: throw new ConnectToHostException(); case NabtoStatus.InvalidStreamOption: case NabtoStatus.InvalidStreamOptionArgument: case NabtoStatus.IllegalParameter: throw new ArgumentException(); case NabtoStatus.Aborted: throw new ObjectDisposedException(this.ToString()); case NabtoStatus.StreamClosed: throw new StreamClosedException(); case NabtoStatus.FailedWithJsonMessage: throw new FailedWithJsonException(detail); case NabtoStatus.Failed: throw new NabtoClientException(status, "{0} returned {1}!", detail, status.ToString()); // This group of status codes should never be seen as the .NET client API manage handles (mostly due to the OO encapsulation provided by the .NET API). //case NabtoStatus.InvalidSession: //case NabtoStatus.InvalidStream: //case NabtoStatus.InvalidTunnel: //case NabtoStatus.InvalidResource: //case NabtoStatus.NoProfile: // only used by nabtoLookupExistingProfile() which has been deprecated in the native API and removed completely from the .NET API. default: throw new UnhandledInternalException(status); } }
internal UnhandledInternalException(NabtoStatus status) : base(status, "An internal error was not handled by the Nabto client API.") { }