Intelligent mirror design based on Dragonboard 410c (3) - message retrieval display for different users

In the first two blogs, I have already introduced how to use the dragonbaord 410c to build a smart mirror. The overall design of the system and the database construction plan are analyzed and designed, and the detailed design framework and partial database implementation are given. Code, this section will introduce to you on this basis, how to achieve the function of playing different messages according to different users in the mirror.

/uploads/allimg/170210/825709-1F210100104151.jpg

According to the previous design, we have built the database, and built a pushInfo table in the database to manage the system's messages. The table is designed with the message ID, ownerID and pushID fields. We can easily query the ownerID. The sender of the message, at the same time through the pushID we can query the pusher of the message, so to retrieve the current user's message, we only need to retrieve the user ID in the pushInfo table according to the user ID found by the camera. All the messages of the user are displayed, and two fields of viewWight and isTop are also set in the table to mark the display order of the message. If isTop indicates that the message is to be displayed first, if the user has multiple isTops The message is sorted according to the time, the latest message is displayed at the top, and the message is also displayed according to viewWight. If the field is set to 0, the message has been displayed, no need to display again, according to this rule. , we can design a getTextMessageList in the MagicMirrorDB data management class The (self, userID) function retrieves the message of the specified user, and the results are sorted in the order in which they are displayed. The specific code is as follows:

Def getTextMessageList(self,userID):
Self.cu.execute("")
Format="select infoID,pushID,infoSubject,infoContent,pushTIme from pushInfo where ownerID==%u and isTop==1 and infoType==0 and viewWeight!=0 order by pushTIme desc"
Values=(userID)
querySQL1=format % values
Self.cu.execute(querySQL1)
Result1=self.cu.fetchone()
Print(querySQL1)
Print(result1)
#print result
Format="select infoID,pushID,infoSubject,infoContent,pushTIme from pushInfo where ownerID=%u and isTop==0 and infoType==0 order by pushTIme desc"
Values=(userID)
querySQL2=format % values
Print(querySQL2)
Self.cu.execute(querySQL2)
Result2=self.cu.fetchone()
Print(result2)
If result1!=None and result2 != None:
#result=result1+result2
Print(result1+result2)
Return result1+result2
Elif result1==None and result2!=None:
#result=result2
Return result2
Elif result1!=None and result2 == None:
#resutl=result1
Return result1
Else:
#result==None
Return None

This function will return a list of search results, each message's message ID infoID, pusher ID pushID, message subject: infoContent, message push time: pushTime five content, follow-up we can conveniently display the message according to these five contents And the messages returned here have been sorted according to our rules.

In this way, when the message is displayed, we only need to build a MagicMirrorDB class, and then call this method to get the text message of the specified user, and sort it. The specific display can be implemented by the following functions:

Def showPushInfo(self,userID):

MMDB=MMDB=MagicMirrorDB("./MagicMirrorDB.db")
#update welcome info by userID
userName=MMDB.getUserName(userID)
Format="

Hello %s Welcome...

"
Values=(userName)
Result=format % values
self.new.helloWelcome.setText(result)
#update pushInfo
#infoID,pushID,infoSubject,infoContent,pushTime
msgList=MMDB.getTextMessageList(userID)
Print("test0")
Print(msgList)
Print("hello")
i=0
pushName=""
Msg_info=""
pushTime=""
msgStr=""
If msgList!=None:
For msg in msgList:
Print(msgList)

If i==1:
Print("test1")
Print(msg)
pushName=MMDB.getUserName(msg)
If i==3:
Msg_info=msg
If i==4:
#pushTime=time.strftime("%Y-%m-%d %H:%M:%S", msg)
msgStr+=("

"+pushName+"to you:"+"

"+msg_info+"

")
i=i+1
If i==5:
i=0

self.new.webMessageText.setHtml(" "+msgStr+" ")
self.new.webMemorandum.setHtml(" "+msgStr+" ")
videoMsgList=MMDB.getUserVideoMessageList(self.current_userID)

Here we use the html support provided by qt, format the obtained message content into the defined message style template, and then call the qt control to display the completion message.

PET Ceramic Phone Film

Ceramic membrane, also called CT membrane, is a kind of solid membrane, which was first developed and introduced into the market in 1996 by Japan's Dainippon Printing Company and Toyo Ink Company. Ceramic membrane has high separation efficiency, stable effect, good chemical stability, acid and alkali resistance, organic solvent resistance, bacteria resistance, high temperature resistance, pollution resistance, high mechanical strength, good membrane regeneration performance, simple separation process, low energy consumption, and operation Many advantages such as easy maintenance and long membrane life.

Compared with similar plastic products, ceramic membrane is expensive, but it has many advantages. It is hard, strong, durable, not easy to block, and has stronger resistance to chemically aggressive liquids and high-temperature cleaning liquids.

High-quality Tempered Glass is one of the best screen protectors for a number of reasons-it has good light transmittance, making for a clear display. It's anti-reflective and glare reducing.

9H Ceramic Glass Phone Film,Privacy Premium Pet Ceramic Phone Protector,Iphone12 Pro Max Privacy Ceramic Film,Cell Phone Pet Ceramic Screen Protector

Shenzhen Customized Technology Co., Ltd. , https://www.protectionfilm6.com

Posted on