Esempio n. 1
0
        /// <summary>
        /// Load sync content from the sync command buffer in Fcade.CommandsToSend.
        /// </summary>
        /// <param name="syncML"></param>
        private void LoadSyncContent(SyncMLSyncML syncML)
        {
            SyncMLSync syncContent = SyncMLSync.Create();

            syncContent.CmdID = syncML.NextCmdID;
            syncContent.Source.LocURI.Content = Facade.LocalDataSource.DataSourceName;
            syncContent.Target.LocURI.Content = Facade.ContactDataSourceAtServer;

            if (numberOfChanges > 0)
            {
                syncContent.NumberOfChanges.Content = numberOfChanges.ToString();
            }

            Facade.ExtractNextCommands(syncContent.Commands);

            foreach (SyncMLCommand command in syncContent.Commands)
            {
                command.CmdID = syncML.NextCmdID;  //commands from XmlToSyncMLSyncCommands does not contain CmdID
                CommandAndStatusRegister.Add(command);
            }

            syncML.Body.Commands.Add(syncContent);
            CommandAndStatusRegister.Add(syncContent);
            numberOfCommandsToSend = syncContent.Commands.Count;
        }
Esempio n. 2
0
        /// <summary>
        /// The derived class might need to call CleanUp in ProcessResponse.
        /// </summary>
        protected void CleanUp()
        {
            if ((!ServerSyncML.Body.HasFinal) &&          // server should has more
                (Facade.ResponseCommandPool.Count < 2) && //there's no command to send except the status for server's SyncHdr
                (ClientSyncML.Body.HasFinal))             // last client message has final
            {
                SyncMLAlert alert = SyncMLAlert.Create();
                alert.CmdID        = ClientSyncML.NextCmdID;
                alert.Data.Content = "222";
                SyncMLItem item = SyncMLItem.Create();
                item.Target.LocURI.Content = Facade.ContactDataSourceAtServer;
                item.Source.LocURI.Content = Facade.LocalDataSource.DataSourceName;
                alert.ItemCollection.Add(item);
                Facade.ResponseCommandPool.Add(alert);
                CommandAndStatusRegister.Add(alert);
                Facade.clientRequestMore = true;
            }

            //7:
            while (Facade.ResponseCommandPool.Count > 1)//if there's only one which is for Status with Hdr, no need to send back
            {
                CleaningUpStep mapStep = new CleaningUpStep(Facade);
                mapStep.Send();
            }
        }
Esempio n. 3
0
        private SyncMLSyncML CreateSyncRequestMessage(SyncType syncType)
        {
            SyncMLAlert alert = CreateSyncAlert(syncType);

            ClientSyncML.Body.Commands.Add(alert);

            CommandAndStatusRegister.Add(alert);

            return(ClientSyncML);
        }
Esempio n. 4
0
        /// <summary>
        /// Load sync content from the sync command buffer in Fcade.CommandsToSend.
        /// </summary>
        /// <param name="syncML"></param>
        protected void LoadSyncContent(SyncMLSyncML syncML)
        {
            SyncMLSync syncContent = SyncMLSync.Create();

            syncContent.CmdID = syncML.NextCmdID;
            syncContent.Source.LocURI.Content = Facade.LocalDataSource.DataSourceName;
            syncContent.Target.LocURI.Content = Facade.ContactDataSourceAtServer;

            syncML.Body.Commands.Add(syncContent);
            CommandAndStatusRegister.Add(syncContent);
        }
Esempio n. 5
0
        public override void Send()
        {
            CreateSyncRequestMessage(Facade.SyncType);
            CommandAndStatusRegister.Add(
                AddGetDeviceInfo(ClientSyncML));
            CommandAndStatusRegister.Add(
                AddPutDeviceInfo(ClientSyncML));
            ClientSyncML.Body.MarkFinal();
            Debug.WriteLine("Sending LogOn:" + ClientSyncML.Xml.ToString());

            string responseText = Facade.Connections.GetResponseText(ClientSyncML.Xml.ToString(SaveOptions.DisableFormatting));

            if (String.IsNullOrEmpty(responseText))
            {
                return;
            }

            Facade.CurrentMsgID++;
            ProcessResponse(responseText);
        }