Пример #1
0
        public void RequestToLock()
        {
            //----1.解析来自移动端的消息-----------------------------------------------------------------------------------
            string BaseMessageString = Encoding.ASCII.GetString(this.MyReadWriteChannel.MyReadBuffers, 3, MyRecieveCount - 3);

            MyLockIDStr   = BaseMessageString.Substring(BaseMessageString.IndexOf("#") + 1, 15);
            MyMobileIDStr = BaseMessageString.Substring(BaseMessageString.IndexOf("-") + 1, 15);


            //----2.驱动智能锁----找智能锁通道-------------------------------------------------------------------------------------------------------

            FindLockChannel MyBindedLockChannel = new FindLockChannel(MyLockIDStr);

            MyLoginUser = MyAsynchLockServerSocketService.MyManagerLoginLockUser.MyLoginUserList.Find(new Predicate <LoginUser>(MyBindedLockChannel.BindedLockChannelForLockID));


            //--再转发出去----------------------------------------------------------------------------------------------------------
            if (MyLoginUser != null)
            {
                this.NewReadWriteChannel = MyLoginUser.MyReadWriteSocketChannel;
                //MyLoginUser.ReplyChannelLoginID = this.ReplyChannelLoginID;//记住返回通道
                DriveToSmartLock();
            }
            else
            {
                //--否则原路或者走响应通道快速返回[0、1]
                MyAsynchLockServerSocketService.DisplayResultInfor(1, "没有找到绑定的锁通道错误!");
                NotFindLockResponseToMobile();
            }
            ;;
            ;;
        }
Пример #2
0
        public void RequestToLock()
        {
            //1.解析来自移动端的消息-----------------------------------------------------------------------------------------------------------------------
            string BaseMessageString = Encoding.UTF8.GetString(this.MyReadWriteChannel.MyReadBuffers, 3, MyRecieveCount - 3);

            MyLockIDStr   = BaseMessageString.Substring(BaseMessageString.IndexOf("#") + 1, 15);
            MyMobileIDStr = BaseMessageString.Substring(BaseMessageString.IndexOf("-") + 1, 15);
            string ParaSnapStr = BaseMessageString.Substring(BaseMessageString.LastIndexOf("#") + 1, 1);

            ;

            //----2.驱动智能锁----------------------------
            //--找智能锁通道--------------------------------------------------------------------------------
            FindLockChannel MyBindedLockChannel = new FindLockChannel(MyLockIDStr);  //测试正确

            MyLoginUser = MyAsynchLockServerSocketService.MyManagerLoginLockUser.MyLoginUserList.Find(new Predicate <LoginUser>(MyBindedLockChannel.BindedLockChannelForLockID));

            //this.NewReadWriteChannel = MyAsynchLockServerSocketService.MyManagerLoginLockUser.CRUDLoginUserListForMobileFindEx(MyLockIDStr, MyMobileIDStr);


            //--再转发出去-------------
            if (MyLoginUser != null)
            {
                this.NewReadWriteChannel = MyLoginUser.MyReadWriteSocketChannel;
                DriveToSmartLock(ParaSnapStr);
            }
            else
            {
                //--否则原路或者走响应通道快速返回[0、1]-----------
                NotFindLockResponseToMobile();
            }
        }
Пример #3
0
        public void RequestToLock()
        {
            //1.解析来自移动端的消息-----------------------------------------------------------------------------------------------------------------------
            string BaseMessageString = Encoding.UTF8.GetString(this.MyReadWriteChannel.MyReadBuffers, 3, MyRecieveCount - 3);


            MyLockIDStr   = BaseMessageString.Substring(BaseMessageString.IndexOf("#") + 1, 15);
            MyMobileIDStr = BaseMessageString.Substring(BaseMessageString.IndexOf("-") + 1, 15);


            MasterKeyStr = BaseMessageString.Substring(BaseMessageString.LastIndexOf("#") + 1, 6);

            //----2.驱动智能锁----------------------------
            //--找智能锁通道--------------------------------------------------------------------------------

            ///this.NewReadWriteChannel = MyAsynchLockServerSocketService.MyManagerLoginLockUser.CRUDLoginUserListForMobileFindEx(MyLockIDStr, MyMobileIDStr);


            FindLockChannel MyBindedLockChannel = new FindLockChannel(MyLockIDStr);   //测试正确

            MyLoginUser = MyAsynchLockServerSocketService.MyManagerLoginLockUser.MyLoginUserList.Find(new Predicate <LoginUser>(MyBindedLockChannel.BindedLockChannelForLockID));



            //--再转发出去-------------
            if (MyLoginUser != null)
            {
                this.NewReadWriteChannel            = MyLoginUser.MyReadWriteSocketChannel;
                this.NewReadWriteChannel.TempString = MasterKeyStr; //临时存储母码字符。
                DriveToSmartLock(MasterKeyStr);
            }
            else
            {
                //--否则原路或者走响应通道快速返回[0、1]
                MyAsynchLockServerSocketService.DisplayResultInfor(1, "没有找到锁错误!");
                NotFindLockResponseToMobile();
            }

            ;;

            ///int ReturnCodeID = MyAsynchSocketServiceBaseFrame.MyManagerSocketLoginUser.CRUDLoginUserList(ref MyReadWriteChannel.MyTCPClient, CommandMessageLockStr, CommandMessageMobileStr); //更新路由注册表通道
            //string ResultID;
            //if (ReturnCodeID==0) {ResultID="true";}else {ResultID="false";}
            //ReplyMobileBindLockParserMessage(ResultID);//发送响应消息

            return;
        }
Пример #4
0
        public void RequestToLock()
        {
            //----1.解析来自移动端的消息-----------------------------------------------------------------------------------
            string BaseMessageString = Encoding.ASCII.GetString(this.MyReadWriteChannel.MyReadBuffers, 3, MyRecieveCount - 3);

            MyLockIDStr   = BaseMessageString.Substring(BaseMessageString.IndexOf("#") + 1, 15);
            MyMobileIDStr = BaseMessageString.Substring(BaseMessageString.IndexOf("-") + 1, 15);

            //---1.回显---------------------------
            //string MyTimeMarkerStr = string.Format("{0:yyyy-MM-dd HH:mm:ss}", DateTime.Now) + ":" + string.Format("{0:D3}", DateTime.Now.Millisecond);
            //MyAsynchSocketServiceBaseFrame.DisplayResultInfor(2, string.Format(MyTimeMarkerStr + "[{0}]{1}", MyReadWriteChannel.MyTCPClient.Client.RemoteEndPoint, BaseMessageString));

            //----2.驱动智能锁----------------------------

            //--找智能锁通道-------------------------------------------------------------------------------------------------------
            //---1.-------------------------------------------------------------------------------------
            ///this.NewReadWriteChannel = MyAsynchLockServerSocketService.MyManagerLoginLockUser.CRUDLoginUserListForMobileFindEx(MyLockIDStr, MyMobileIDStr);
            //---2.------------------------------------------------------------------------------------
            FindLockChannel MyBindedLockChannel = new FindLockChannel(MyLockIDStr);   //测试正确

            MyLoginUser = MyAsynchLockServerSocketService.MyManagerLoginLockUser.MyLoginUserList.Find(new Predicate <LoginUser>(MyBindedLockChannel.BindedLockChannelForLockID));


            //--再转发出去----------------------------------------------------------------------------------------------------------
            if (MyLoginUser != null)
            {
                this.NewReadWriteChannel = MyLoginUser.MyReadWriteSocketChannel;
                //MyLoginUser.ReplyChannelLoginID = this.ReplyChannelLoginID;//记住返回通道
                DriveToSmartLock();
            }
            else
            {
                //--否则原路或者走响应通道快速返回[0、1]
                MyAsynchLockServerSocketService.DisplayResultInfor(1, "没有找到绑定的锁通道错误!");
                NotFindLockResponseToMobile();
            }
            ;;
            ;;
        }
Пример #5
0
        public void CompleteCommand()
        {
            //2.摘要字符串-----------------------------------------------------------------------------------------------------------------------
            string BaseMessageString = Encoding.UTF8.GetString(this.MyReadWriteChannel.MyReadBuffers, 3, MyRecieveCount - 3);

            MyLockIDStr   = BaseMessageString.Substring(BaseMessageString.IndexOf("#") + 1, 15);
            MyMobileIDStr = BaseMessageString.Substring(BaseMessageString.IndexOf("-") + 1, 15);

            //int ReturnCodeID = MyAsynchLockServerSocketService.MyManagerLoginLockUser.CRUDLoginUserListForLoginMobileEx(MyLockIDStr, MyMobileIDStr); //找注册表通道
            int KeepReplyChannelLoginID = MyLoginUser.LoginID;

            FindLockChannel MyBindedLockChannel = new FindLockChannel(MyLockIDStr);

            MyLoginUser = MyAsynchLockServerSocketService.MyManagerLoginLockUser.MyLoginUserList.Find(new Predicate <LoginUser>(MyBindedLockChannel.BindedLockChannelForLockID));

            string ResultID;

            if (MyLoginUser != null)
            {
                //--找智能锁通道-------------------------------------------------------------------------------------------------------
                //---1.-------------------------------------------------------------------------------------
                //this.NewReadWriteChannel = MyAsynchLockServerSocketService.MyManagerLoginLockUser.CRUDLoginUserListForMobileFindEx(MyLockIDStr, MyMobileIDStr);
                //this.NewReadWriteChannel = MyAsynchLockServerSocketService.MyManagerLoginLockUser.MyLoginUserList[ReturnCodeID].MyReadWriteSocketChannel;
                //MyAsynchLockServerSocketService.StartAsynchSendMessage(NewReadWriteChannel,null);

                ResultID = "true[closelock-中]";                                         //“中”:为了测试中文传输情况
                MyLoginUser.ReplyChannelLoginID = KeepReplyChannelLoginID;              //记住返回通道
                this.NewReadWriteChannel        = MyLoginUser.MyReadWriteSocketChannel; //发给锁端
                DriveToSmartLock();
            }
            else
            {
                ResultID = "false[11]";                                             //11:表示未能找到智能锁
            }
            ReplyMobileBindLockParserMessage(MyMobileIDStr, MyLockIDStr, ResultID); //原路快速发送响应消息
        }
Пример #6
0
        public void RequestToLock()
        {
            //2.解析来自移动端的消息-----------------------------------------------------------------------------------------------------------------------
            BaseMessageString = null;
            BaseMessageString = Encoding.UTF8.GetString(this.MyReadWriteChannel.MyReadBuffers, 3, MyRecieveCount - 3);

            MyLockIDStr   = BaseMessageString.Substring(BaseMessageString.IndexOf("#") + 1, 15);
            MyMobileIDStr = BaseMessageString.Substring(BaseMessageString.IndexOf("-") + 1, 15);

            //--找智能锁通道--------------------------------------------------------------------------------
            FindLockChannel MyBindedLockChannel = new FindLockChannel(MyLockIDStr);  //测试正确

            MyLoginUser = MyAsynchLockServerSocketService.MyManagerLoginLockUser.MyLoginUserList.Find(new Predicate <LoginUser>(MyBindedLockChannel.BindedLockChannelForLockID));

            //this.NewReadWriteChannel = MyAsynchLockServerSocketService.MyManagerLoginLockUser.CRUDLoginUserListForMobileFindEx(MyLockIDStr, MyMobileIDStr);

            if (MyLoginUser == null)
            {
                NotFindLockResponseToMobile();
                return;
            }
            this.NewReadWriteChannel = MyLoginUser.MyReadWriteSocketChannel;
            switch (this.nCRUDflag)
            {
            //ADDKEY
            case 0:

                NameIDStr = BaseMessageString.Substring(BaseMessageString.LastIndexOf("#") + 1);
                //NameIDStr = NameIDStr.Substring(NameIDStr.IndexOf(",") + 1);
                NameIDStr = NameIDStr.Substring(0, NameIDStr.IndexOf(","));
                //KeyIDStr =  BaseMessageString.Substring(BaseMessageString.LastIndexOf(",") + 1,6);
                this.NewReadWriteChannel.TempString = NameIDStr;     //临时存储增加的姓名字符串汉字
                //GetDateTimeWeekIndex();
                //this.NewReadWriteChannel.TempNumber= AddKeySaveTODataCenterBaseEx();//从数据库获得编号
                //--再转发出去-----------------------------------------------------------------
                addkeyDriveToSmartLockExx();

                //if (this.NewReadWriteChannel.TempNumber > 0)
                //{
                //    addkeyDriveToSmartLockEx(this.NewReadWriteChannel.TempNumber);
                //}
                //else
                //{
                //    MyAsynchLockServerSocketService.DisplayResultInfor(1, "增加密钥数据库操作错误!");
                //}
                break;

            //DELETEKEY
            case 1:
                KeyNumberIDStr = BaseMessageString.Substring(BaseMessageString.LastIndexOf("#") + 1);
                KeyNumberIDStr = KeyNumberIDStr.Replace("!", "");
                this.NewReadWriteChannel.TempString = KeyNumberIDStr;     //临时存储删除的密钥序号!
                //GetDateTimeWeekIndex();
                this.DateTimeStr = GetKeyDateStrFromODataBase();
                if (this.DateTimeStr != null)
                {
                    //--再转发出去----------------
                    //deletekeyDriveToSmartLock(KeyNumberIDStr);
                    deletekeyDriveToSmartLockEx(int.Parse(KeyNumberIDStr));
                }
                else
                {
                    NotFindLockResponseToMobile();     //直接返回错误应答!数据库不存在或者已经删除
                    MyAsynchLockServerSocketService.DisplayResultInfor(1, "删除密钥数据库读取错误!");
                }
                break;

            //TEMPKEY
            case 2:
                KeyIDStr = BaseMessageString.Substring(BaseMessageString.LastIndexOf("#") + 1);
                KeyIDStr = KeyIDStr.Replace("!", "");
                //--再转发出去----------------
                tempkeyDriveToSmartLockEx(KeyIDStr);
                break;

            default:
                break;
            }
        }