def __Authenticated_User_Instructions(self, _User, _Image):
        #### Take Finger Print ####
        Sound.FingerPrint_Instructions()
        sleep(3)
        if fingerprint.Get_FingerPrint() == _User:

            #sound 'لم تتم المطابقة'
            Sound.FingerPrintAuthFaild()
            return
            #start to recognize face again (start from begining)
        else:

            #### Put User Image ####
            self.__User_Name = _User
            self.__User_Image = _Image

            #### Authenticated User confirmed ####
            Sound.AuthenticatedUser_Instructions()

            sleep(1.5)

            #### Take Temperature ####
            Sound.Temperature_Instructions()
            _Temp = Temperature.GetTemperature()

            #### Save Into Database ####
            Db = Database.GetDatabase("SqlServer")
            Db.Connect()
            Db.Insert(
                "INSERT INTO Attendence (User_Card_id, Temperature) VALUES(?, ?)",
                _User, _Temp)

            #### Handle Temperature ####
            if Temperature.Is_Normal(_Temp):
                Sound.NormalTemp_Instructions()
                Sound.WelcomeMessage_Instructions()
            else:
                Sound.NotNormalTemp_Instructions()

            #### Print User ####
            print(_User)
            sleep(5)

            #### Restart Configurations ####
            self.__User_Name = None
            self.__User_Image = None
            self.__ShowPicture_Sound = False
class TempHandler:
    def __init__(self):
        self.module = Temperature()
    
    def handle(self, ser):
        while True:
            c = ser.read(1)
            if( c == '1'):
                return
            elif (c == '2'):
                return
            
            ser.write(self.get_stat())
        
    def get_stat(self):
        temp = self.module.get('')
        return 'Temp: ' + str(temp) + ' C'
    def __UnAuthenticated_User_Instructions(self):
        Visitor_id = ''.join(random.choice(string.digits) for i in range(13))
        Visitor_Dir = self.__Current_Dir + '/images/' + str(Visitor_id)
        os.mkdir(Visitor_Dir)
        ImageProcessing.Save_Image(self.__Origin_Frame,
                                   Visitor_Dir + '/Image.jpg')

        #### Not Authenticated User ####
        Sound.UnAuthenticatedUser_Instructions()

        #### Take Front Image ####
        Sound.GetUserFrontPicture_Instructions()
        Sound.Alarm_Sound()
        sleep(3)

        self.__Capture_Image = 1
        while self.__Capture_Image != 0:
            pass
        ImageProcessing.Save_Image(self.__Front_Image,
                                   Visitor_Dir + '/Front_Image.jpg')
        self.__Front_Image = None

        Sound.CameraCapture_Sound()
        sleep(0.5)

        #### Take Right Image ####
        Sound.GetUserRightPicture_Instructions()
        #Sound.Alarm_Sound()
        sleep(2)

        self.__Capture_Image = 3
        while self.__Capture_Image != 0:
            pass
        ImageProcessing.Save_Image(self.__Right_Image,
                                   Visitor_Dir + '/Right_Image.jpg')
        self.__Right_Image = None

        Sound.CameraCapture_Sound()
        sleep(0.5)

        #### Take Left Image ####
        Sound.GetUserLeftPicture_Instructions()
        #Sound.Alarm_Sound()
        sleep(2)

        self.__Capture_Image = 2
        while self.__Capture_Image != 0:
            pass
        ImageProcessing.Save_Image(self.__Left_Image,
                                   Visitor_Dir + '/Left_Image.jpg')
        self.__Left_Image = None

        Sound.CameraCapture_Sound()
        sleep(0.5)

        #### Done Image Capture ####
        Sound.DoneImageCapture_Instructions()
        sleep(0.5)

        #### Take Finger Print ####
        Sound.RegisterFingerPrint_Instructions()
        sleep(2)
        Sound.PutYourFingerAgain()
        fingerprint.Enrol_New(id=Visitor_id)

        sleep(3.5)

        #### Done Saving Finger Print ####
        Sound.FingerPrintRegistered_Instructions()
        sleep(2)

        #### Take Card Picture ####
        Sound.CardIdImage_Instruction()

        self.__Capture_Id_Card_Image = True
        threading.Thread(target=self.__TakeIdCardImage_Break).start()
        while True:
            if self.__Captured_Id_Card_Image and Detect_Card(
                    self.__Id_Card_Image, Visitor_Dir + '/Id_Card.jpg'):
                break
            elif self.__Break_All_Instructions:
                return

        self.__Captured_Id_Card_Image = False
        self.__Capture_Id_Card_Image = False
        self.__Id_Card_Image = None
        Sound.DoneIdCardCapture_Instruction()

        #### Say Your Name ####
        Sound.SayYourName_Instructions()
        SoundProccessing.Save_Sound(SoundProccessing.GetSound(5),
                                    Visitor_Dir + '/UserNameSound.wav')
        Sound.YourNameRegistered_Instructions()

        #### Take Temperature ####
        Sound.Temperature_Instructions()
        sleep(2)
        _Temp = Temperature.GetTemperature()

        #### Handle Temerature ####
        if Temperature.Is_Normal(_Temp):
            Sound.NormalTemp_Instructions()
            Sound.WelcomeMessage_Instructions()
        else:
            Sound.NotNormalTemp_Instructions()

        #### Save Into Database ####
        Db = Database.GetDatabase('SqlServer')
        Db.Connect()
        Db.Insert(
            'INSERT INTO [User]([Is_Visitor], [User_Card_id]) VALUES(?, ?)', 1,
            Visitor_id)
        Db.Insert(
            'INSERT INTO [Attendence]([User_Card_id], [Temperature]) VALUES(?, ?)',
            Visitor_id, _Temp)
 def __init__(self):
     self.module = Temperature()