Exemple #1
0
        private static string GetQuery(IntPtr handlePtr, SafeBundleHandle data, string where, OperationType type)
        {
            Interop.DataControl.SafeDataControlHandle handle = new Interop.DataControl.SafeDataControlHandle(handlePtr, false);
            string query = null;

            switch (type)
            {
            case OperationType.Select:
                break;

            case OperationType.Update:
                query = Interop.DataControl.CreateUpdateStatement(handle, data, where);
                break;

            case OperationType.Delete:
                query = Interop.DataControl.CreateDeleteStatement(handle, where);
                break;

            case OperationType.Insert:
                query = Interop.DataControl.CreateInsertStatement(handle, data);
                break;

            default:
                break;
            }
            handle.Dispose();

            return(query);
        }
Exemple #2
0
 internal static unsafe int AddItem(SafeBundleHandle handle, string key, byte[] value, int offset, int count)
 {
     fixed(byte *pointer = value)
     {
         return(AddByte(handle, key, pointer + offset, count));
     }
 }
Exemple #3
0
        private static void UpdateRequest(int requestId,
                                          IntPtr handlePtr, IntPtr updateData, string where, IntPtr userData)
        {
            Provider         provider;
            UpdateResult     result;
            SafeBundleHandle sbh   = new SafeBundleHandle(updateData, false);
            string           query = GetQuery(handlePtr, sbh, where, OperationType.Update);
            ResultType       ret;

            provider = GetProvider(handlePtr);
            if (provider == null)
            {
                Log.Error(LogTag, "Provider not exist ");
                return;
            }

            ret = UpdateCurrentClient(provider, requestId);
            if (ret != ResultType.Success)
            {
                return;
            }
            result = provider.OnUpdate(query, where, new Bundle(sbh));
            if (result != null)
            {
                if (result.Result)
                {
                    ret = Interop.DataControl.SendUpdateResult(requestId);
                    if (ret != ResultType.Success)
                    {
                        Log.Error(LogTag, "SendUpdateResult fail " + ret.ToString());
                    }
                }
                else
                {
                    ret = Interop.DataControl.SendError(requestId, result.Result.ToString());
                    if (ret != ResultType.Success)
                    {
                        Log.Error(LogTag, "SendError fail " + ret.ToString());
                    }
                }
            }
            else
            {
                Log.Info(LogTag, $"UpdateResult is null : {requestId.ToString()}");
            }
        }
Exemple #4
0
        /// <summary>
        /// Requests the sync manager to perform periodic sync operations.
        /// </summary>
        /// <since_tizen> 4 </since_tizen>
        /// <param name="request"> The sync job information of the sync job request. </param>
        /// <param name="period"> Determines the time interval of the periodic sync. The periodic sync operation can be triggered in that interval, but it does not guarantee the exact time. The minimum value is 30 minutes. </param>
        /// <param name="syncOptions"> Sync options determine a way to operate the sync job and can be used as ORing. </param>
        /// <privilege>http://tizen.org/privilege/alarm.set</privilege>
        /// <exception cref="UnauthorizedAccessException"> In case of a privilege not defined. </exception>
        /// <exception cref="ArgumentNullException"> Thrown when any of the arguments are null. </exception>
        /// <exception cref="InvalidOperationException"> Thrown when the application calling this API doesn't have a sync adapter. </exception>
        /// <returns> A unique value which can manage sync jobs. The number of sync job IDs is limited as it is less than hundred. </returns>
        public static int AddPeriodicSyncJob(SyncJobData request, SyncPeriod period, SyncOption syncOptions)
        {
            if (request == null || request.SyncJobName == null)
            {
                throw new ArgumentNullException();
            }

            SafeAccountHandle accountHandle = (request.Account != null) ? request.Account.SafeAccountHandle : new SafeAccountHandle();
            SafeBundleHandle  bundleHandle  = (request.UserData != null) ? request.UserData.SafeBundleHandle : new SafeBundleHandle();

            int id  = 0;
            int ret = Interop.Manager.AddPeriodicSyncJob(accountHandle, request.SyncJobName, (int)period, (int)syncOptions, bundleHandle, out id);

            if (ret != (int)SyncManagerErrorCode.None)
            {
                Log.Error(ErrorFactory.LogTag, "Failed to add periodic sync job");
                throw ErrorFactory.GetException(ret);
            }
            return(id);
        }
Exemple #5
0
        private static void InsertRequest(int requestId, IntPtr handlePtr, IntPtr insertData, IntPtr userData)
        {
            Provider         provider;
            InsertResult     result;
            SafeBundleHandle sbh   = new SafeBundleHandle(insertData, false);
            string           query = GetQuery(handlePtr, sbh, null, OperationType.Update);
            ResultType       ret;

            provider = GetProvider(handlePtr);
            if (provider == null)
            {
                Log.Error(LogTag, "Provider not exist ");
                return;
            }

            result = provider.OnInsert(query, new Bundle(sbh));
            if (result != null)
            {
                if (result.Result)
                {
                    ret = Interop.DataControl.SendInsertResult(requestId, result.RowID);
                    if (ret != ResultType.Success)
                    {
                        Log.Error(LogTag, "SendInsertResult fail " + ret.ToString());
                    }
                }
                else
                {
                    ret = Interop.DataControl.SendError(requestId, result.Result.ToString());
                    if (ret != ResultType.Success)
                    {
                        Log.Error(LogTag, "SendError fail " + ret.ToString());
                    }
                }
            }
            else
            {
                Log.Info(LogTag, $"InsertResult is null : {requestId.ToString()}");
            }
        }
Exemple #6
0
 internal static extern int AddPeriodicSyncJob(SafeAccountHandle account, string syncJobName, int syncPeriod, int syncOption, SafeBundleHandle syncJobUserData, out int syncJobId);
Exemple #7
0
 internal static extern int AddDataChangeSyncJob(SafeAccountHandle account, string syncCapability, int syncOption, SafeBundleHandle syncJobUserData, out int syncJobId);
 internal static extern ResultType SendDataChange(IntPtr handle, ChangeType type, SafeBundleHandle data);
 internal static extern ResultType BulkResultAdd(SafeBulkResultDataHandle handle, SafeBundleHandle data, int result);
 internal static extern ResultType Insert(SafeDataControlHandle provider, SafeBundleHandle insertData, out int requestId);
 internal static extern string CreateInsertStatement(SafeDataControlHandle provider, SafeBundleHandle insertData);
Exemple #12
0
 internal static extern ErrorCode EventPublishTrustedAppEvent(string eventName, SafeBundleHandle eventData);
Exemple #13
0
 internal static extern ErrorCode NotifyHideStatus(SafeFrameProviderHandle handle, SafeBundleHandle safeBundleHandle);
 internal static extern MediaControllerError SendCommandReplyBundle(IntPtr handle,
                                                                    string appId, string requestID, int result, SafeBundleHandle bundleHandle);
 internal static extern MediaControllerError SendCustomEventBundle(IntPtr handle, string appId, string customEvent,
                                                                   SafeBundleHandle bundle, out string requestId);
 internal static extern ResultType SendDataChange(string dataId, ChangeType type, SafeBundleHandle data);
Exemple #17
0
 internal static extern WebRTCErrorCode CreateSDPAnswerAsync(IntPtr handle, SafeBundleHandle bundle, SdpCreatedCallback callback, IntPtr userData);
Exemple #18
0
 internal static extern NotificationError GetExtensionData(NotificationSafeHandle handle, string key, out SafeBundleHandle bundleHandle);
Exemple #19
0
 internal static extern WebRTCErrorCode CreateSDPAnswer(IntPtr handle, SafeBundleHandle bundle, out string offer);
Exemple #20
0
 internal static extern ErrorCode SetContent(IntPtr handle, SafeBundleHandle content);
Exemple #21
0
 internal static extern ErrorCode UpdateContent(string widgetId, string instanceId, SafeBundleHandle bundle, int force);
 internal static extern ErrorCode GetExtraData(IntPtr handle, out SafeBundleHandle safeBundleHandle);
 internal static extern ResultType Update(SafeDataControlHandle provider, SafeBundleHandle updatetData, string where, out int requestID);
Exemple #24
0
 internal static extern int RequestOnDemandSyncJob(SafeAccountHandle account, string syncJobName, int syncOption, SafeBundleHandle syncJobUserData, out int syncJobId);
 internal static extern string CreateUpdateStatement(SafeDataControlHandle provider, SafeBundleHandle updateData, string where);
Exemple #26
0
 internal static extern MediaControllerError SendCustomEventReplyBundle(MediaControllerClientHandle handle,
                                                                        string serverName, string requestId, int result, SafeBundleHandle bundleHandle);
 internal static extern ResultType BulkAdd(SafeBulkDataHandle handle, SafeBundleHandle data);
Exemple #28
0
 internal static extern MediaControllerError SetSearchConditionBundle(IntPtr searchHandle,
                                                                      MediaControlContentType type, MediaControlSearchCategory category, string keyword, SafeBundleHandle bundle);
Exemple #29
0
 internal static extern MediaControllerError SendCustomCommandBundle(MediaControllerClientHandle handle,
                                                                     string serverName, string command, SafeBundleHandle bundleHandle, out string requestId);
Exemple #30
0
 internal static extern WebRTCErrorCode Create(IntPtr handle, string label, SafeBundleHandle bundle, out IntPtr dataChanndelHandle);