Bluetooth open-door system based on community management and methodTechnical field
The present invention relates to community's enabling technical field, be specifically related to a kind of bluetooth open-door system based on community management and sideMethod.
Background technology
Existing conventional little trivial mouth way to manage is generally divided into two kinds: one is district's mouth open type management, and owner visitor is certainlyBy coming in and going out;Another kind is closed management, and traditional gate control system needs owner to use badge to enter, and visitor passes through video intercomCalling owner remotely opens the door.
Above-mentioned first kind of way brings safely hidden danger, impracticable to unavoidably community;Gate control system described in the second way needsWant resident to carry with access card, entered by the mode of swiping the card, certain puzzlement can be caused to resident to a certain extent: such as forgetNote band badge enter do not go, badge is lost in the case of causing potential safety hazard, chip failure insensitive and is not opened door;Existing market pairSaying that brand is numerous, its input information comprises building number, separates key, unit key, floor, number, calling key etc., generally need to ensure evenContinuous 8 numbers above do not make mistake and just can breathe out, and each mode of operation disunity, and visitor is carried out after also needing first to learn explanation againOperation, owner answers simultaneously also needs certain response time.For solving above-mentioned drawback, Application No. [201610215587.7]The open a kind of control of bluetooth access card-reading system of patent of invention, including smart mobile phone, control of bluetooth access card reader and access controller, whenMobile phone is when gate, and Bluetooth AP P on smart mobile phone is actively searched for the bluetooth of control of bluetooth access card reader and set by Bluetooth of mobile phoneStandby, when being found to have gate inhibition's bluetooth module, Bluetooth AP P be mutually authenticated with read head by after just set up and be connected, with smart mobile phoneBluetooth function replaces gate inhibition's Card Reader, conveniently saves trouble.
But still suffering from the drawback that employing aforesaid way opens the door, safety is low, in household safety-protection and community managementAspect can bring inconvenience to property;Simultaneously when there being visitor to come to visit, visitor enters community and also needs to allow owner meet at the gateOr use video intercom remote call-in, it is the most inconvenient to use;And aforesaid way is not encrypted, operate numerous during useTrivial, security performance is low, be unfavorable for popularizing widely and popularization and application.
Summary of the invention
The technical problem to be solved is to enter when coming to visit for current community gate control system complex operation, visitorThe defects such as door is difficult, safety is low, propose a kind of bluetooth open-door system based on community management and method, to realize removing solid doorCardization, safety simple to operate, optimize resident and the lived experience of visitor, it is simple to Communities ' Integrated management and smart city are built.
The present invention is to use following technical scheme to realize:
The present invention proposes a kind of bluetooth open-door system based on community management, including:
Community management cloud platform: include the data base storing owner's information, according to the houseclearing of existing owner, automatically generate onlyOne and encryption word string and send the bluetooth door unit to mobile terminal;
It is arranged on the bluetooth door unit of mobile terminal: include data reception module, key module and data transmission blocks;DataReceiver module in order to obtain above-mentioned word string and by key module according to owner's houseclearing and bluetooth door unit PID, MAC,Name is encrypted configuration and generates enabling key, and enabling key is sent to control unit by data transmission blocks;
It is encrypted by described key module according to the word string obtained, and generates bluetooth key, simultaneously key generation moduleVisitor's Quick Response Code key can also be generated;Described bluetooth key uses during generating and mixes the cipher mode arranged: bluetoothWord string includes some groups of data, and often group data include flag, serial number, data bit and stop bits, and wherein data bit is 0-9'sNumeral, encrypts respectively to often organizing data, is i.e. randomly provided in data bit one and is encrypted configuration for check bit, otherThen for interference data;Use mixing arrangement mode, there is not so-called rule, can not find rule and be difficult to reappear, cipher round resultsGood, also comply with the application of community management simultaneously;
It is arranged on the control unit on community gate inhibition: include data judge module, data resolution module, by data judge moduleJudge key classification according to the enabling key data length received and message prefix, i.e. judge it is Quick Response Code key data or indigo plantTooth key data, selects corresponding door-opening mode, by data resolution module, key data is carried out resolve access control and controlsDevice opens the door.
Further, described visitor's Quick Response Code key includes user name, gate inhibition address, effect duration, communication data, during encryptionUse above-mentioned data are upset, the mode that recompiles is encrypted, and described key module includes sharing two dimensionCode key is to the key sharing module of visitor and the key inspection module of inspection key effectiveness.
Further, described data resolution module includes blue-teeth data parsing module and two-dimensional code data parsing module, controlUnit processed realizes the serial data identification of bluetooth and Quick Response Code, is resolved by blue-teeth data parsing module and two-dimensional code data respectivelyBluetooth key or Quick Response Code key are resolved by module;During to blue-teeth data identification, overcome data identification difficulty, openIdentify during the beginning and always occur identifying mistake, losing the phenomenons such as packet, in order to solve this problem, described blue-teeth data parsing moduleIncluding time delay module, time delay module is set in control unit part, draws delay time according to baud rate, when such as selecting time delayBetween 150ms, before data parsing step add delaying step, ensure that all serial datas resolve after receiving again, keep awayExempt to identify the drawbacks such as mistake, packet loss.
Further, described key module also includes that time module, described blue-teeth data parsing module also include time ratioTo module, during bluetooth key data parsing, when bluetooth door unit sends current by time module to control unitBetween signal, and by Time transfer receiver module, the time is compared.If the time, more than 3S, does not operates, feed back to bluetoothThe cues such as door unit " key is invalid, it is impossible to continue to open the door ", if time match, then control unit continues bluetooth keyData resolve, and encryption resolving is unique, and data safety is effectively ensured.
Further, described control unit includes STM32 processor and bluetooth module, and STM32 processor includes in twoDisconnected, respectively in order to accept blue-teeth data and two-dimensional code data, trigger and interrupt, main responsible key inspection and enabling signal amount are defeatedGoing out, bluetooth module is responsible for being connected with the mobile terminal bluetooth being provided with bluetooth door unit, and described bluetooth door unit controller setsFor including unique PID numbering, device name, equipment Bluetooth MAC address, facility information is preserved to community management cloud platform clothesBusiness device is easy to management.
The present invention the most also proposes a kind of bluetooth door opening method based on community management, comprises the following steps:
S1, register, generate word string: owner registers houseclearing, community management cloud platform cross-check information in community management cloud platformEffectiveness, generates the unique and word string of encryption;
S2, key generate: owner obtains above-mentioned word string in mobile terminal bluetooth door unit application, and described word string is passed through bluetoothDoor unit carries out configuring, generate the bluetooth key of encryption for opening the door;And can also add in the generation of described bluetooth door unitClose Quick Response Code key, and it is shared with visitor for visitor's enabling;
The encryption of described bluetooth key uses the mode of mixing arrangement, first send current time and with mobile terminal comparison, if superCross 3S, then return mobile phone terminal corresponding data, it is to avoid having people's malice to crack, then retransmit some data, every data usesDifferent cipher modes, such as, often group data include flag, serial number, data bit and stop bits etc., and wherein data bit is 0-The numeral of 9, is randomly provided a wherein mode being encrypted for check bit;Use mixing arrangement mode, do not exist so-calledRule, can not find rule and is difficult to reappear, and cipher round results is good, also complies with the application of community management simultaneously.
S3, enabling: after generating bluetooth key, the bluetooth key of acquisition is sent to the control list being arranged on gate inhibition by ownerUnit, control unit is opened the door by parsing data, comparison key effectiveness;After control unit obtains above-mentioned some groups of data,First store, then find out according to agreement and often organize the check bit of data setting and carry out parsing and crack and open the door;
Or the Quick Response Code key of acquisition is sent to the control unit being arranged on gate inhibition by visitor, control unit resolve data,Comparison key effectiveness, opens the door to visitor.
Further, in described step S3, when control unit receives enabling signal, first sentence according to serial data lengthDisconnected type of key, and select the door-opening mode of correspondence;Detected, first according to number by two interruptions of control unit processorJudging according to length, such as data length is two-dimensional code data more than 40, is otherwise blue-teeth data, the most again by the prefix of messageModes such as (such as Quick Response Code are 01, and bluetooth is 02) is identified.
Further, the encryption of Quick Response Code key described in described step S2 uses the mode of mixing arrangement, if two-dimentionalCode data, usually accept burst of data, including user name, gate inhibition address, effect duration, communication data etc., all data are unitedCome together to be encrypted, the mode above-mentioned data upset during encryption, recompiled, analytic expression carry out again according to agreement reducing intoRow deciphering, adopts and is difficult to find queueing discipline in this way, and Quick Response Code key is disposable, and arranges expiry date, addsClose mode safety.
Further, in described step S3, if the enabling signal received is Bluetooth signal, also wrapped before to data parsingIncluding delaying step, i.e. arranged delay time before resolving bluetooth key data, described delay time can be 150ms, it is ensured thatDescribed serial data just resolves after receiving, it is to avoid the generation of the phenomenons such as packet loss.
Further, in blue-teeth data resolving, whether first comparison time mates, i.e. bluetooth door unit is sent outSending current time to control unit, control unit is passed through comparison time, if more than 3s, is not operated, if time match, furtherResolve, prevented people's malice from cracking, reached preferable safe effect.
Compared with prior art, advantages of the present invention and having the active effect that
Bluetooth enabling scheme based on community management of the present invention, from the actually used angle of resident, closeness to life, hasSimple, convenient quick, feature that safety coefficient is high, and property human and material resources can be reduced and put into, improve community safetyProperty, deducting owner's trouble with card, owner, without band card, uses the mobile terminal being provided with bluetooth door unit just can enterDoor;Friend's visiting can generate visitor's Quick Response Code key in mobile terminals such as mobile phones and be sent to friend, and friend just can enter, simultaneously can rootAccording to the effective duration of needs configuration key, effective degree is arranged flexibly, and bluetooth and two-dimensional code data are used special cipher mode,Cipher round results is good, uses safety;This programme enabling key only has certification owner in community's just can use this function, and safety is guaranteed,Meet current economic social development and smart city construction demand, there is wide promotion prospect.
Accompanying drawing explanation
Fig. 1 is embodiment of the present invention system structure schematic diagram;
Fig. 2 is that embodiment of the present invention method flow is with reference to figure.
Detailed description of the invention
In order to be more clearly understood from the above-mentioned purpose of the present invention, feature and advantage, below in conjunction with the accompanying drawings and implementThe present invention will be further described for example.Elaborate a lot of detail in the following description so that fully understanding the present invention,But, the present invention can be different from other modes described here with employing and implement, and therefore, the present invention is not limited to following public affairsThe specific embodiment opened.
Embodiment one, reference Fig. 1, the present embodiment proposes a kind of bluetooth open-door system based on community management, including:
Community management cloud platform: include the data base storing owner's information, according to the houseclearing of existing owner, automatically generate onlyOne and encryption word string and send to mobile terminal bluetooth door unit;Described mobile terminal includes the mobile device such as mobile phone, Ipad, thisEmbodiment is as a example by smart mobile phone.
It is arranged on the bluetooth door unit of mobile phone terminal: include data reception module, key module and data transmission blocks;Data reception module in order to obtain above-mentioned word string and by key module according to owner's houseclearing and bluetooth door unit PID,MAC, name are encrypted configuration and generate enabling key, and enabling key is sent to control unit by data transmission blocks;Described keyIt is encrypted by spoon module according to the word string obtained, and generates bluetooth key, and key generation module can also generate simultaneouslyVisitor's Quick Response Code key;Described bluetooth key uses the cipher mode of mixing arrangement during generating: if bluetooth word string includesDry group data, such as first group data are the time, and other are often organized data and include flag, serial number, data bit and stop bits etc.,Wherein data bit is the numeral of 0-9, encrypts respectively often organizing data during encryption, and being i.e. randomly provided any one position in data bit is schoolTest position and be encrypted configuration;During deciphering, first whether comparison time mates, and then extracts, according to agreement, the school that often group data are arrangedTest position to crack, use mixing arrangement mode, there is not so-called rule, can not find rule and be difficult to reappear, cipher round resultsGood, also comply with the application of community management simultaneously;
The control unit being arranged on gate inhibition: include data judge module, data resolution module, by data judge module according toThe enabling key data length received and message prefix judge key classification, i.e. judge it is Quick Response Code key data or Bluetooth keySpoon data, select corresponding door-opening mode, by data resolution module, key data are carried out resolve access control controller and openDoor.
For visitor's Quick Response Code key, it includes user name, gate inhibition address, effect duration, communication data, will be all during encryptionData are united, and the mode above-mentioned data upset, recompiled is encrypted, and described key module include in order toShare key sharing module and the key inspection module of inspection key effectiveness of Quick Response Code key, when there being visitor to come to visit, toOwner's mobile phone terminal sends request, key module (described key module can generate bluetooth key, also may be used to generate Quick Response Code keyTo generate Quick Response Code key, Quick Response Code key can certainly generate in cloud platform), after Quick Response Code key generates, owner is permissibleArranging the authority such as effect duration, access times, be sent to visitor by key sharing module, visitor is opened by Quick Response Code keyDoor, simple to operate, reduce owner's labor intensity.
Owing to Quick Response Code and bluetooth are different attribute data, when opening the door, control unit end first has to judge data type,The present embodiment judges according to serial data length and message prefix, is examined by two interruptions of control unit processorSurvey, first judge according to data length, the present embodiment preference data length more than 40 for two-dimensional code data, be otherwise bluetooth numberAccording to, it is identified by modes such as the prefixes (such as Quick Response Code is 01, and bluetooth is 02) of message the most again.
Described data resolution module includes blue-teeth data parsing module and two-dimensional code data parsing module, and control unit realizesThe serial data identification of bluetooth and Quick Response Code, passes through blue-teeth data parsing module and two-dimensional code data parsing module respectively to bluetoothKey or Quick Response Code key resolve;During to blue-teeth data identification, overcome data identification difficulty, identify total during beginningBeing to occur identifying mistake, losing the phenomenons such as packet, in order to solve this problem, described blue-teeth data parsing module includes time delay mouldBlock, arranges time delay module in control unit part, draws delay time according to baud rate, the preferred delay time of the present embodiment150ms, adds delaying step before data parsing step, ensures that all serial datas resolve after receiving again, it is to avoidIdentify the drawbacks such as mistake, packet loss.
Encryption is that mobile phone terminal bluetooth door unit encrypts (bluetooth unit can be the application program being arranged on mobile phone terminal),Control unit deciphering on gate inhibition, if blue-teeth data, bluetooth door unit sends the data to control unit, and control unit is returnedBack to bluetooth door unit one data, correctly, then to data parsing, adding time delay before parsing, Quick Response Code is oneComplete word string, it is not necessary to time delay.In decrypting process, described key module also includes time module, and blue-teeth data resolves mouldBlock also includes Time transfer receiver module, and during bluetooth key data parsing, bluetooth door unit is given by time module and controlledUnit sends current time signal, and is compared the time by Time transfer receiver module.If the time, more than 3S, does not graspsMake, feed back to the cues such as bluetooth door unit " key is invalid, it is impossible to continue to open the door ", if time match, then control unitContinuing to resolve bluetooth key data, encryption resolving is unique, and data safety is effectively ensured.
Control unit described in the present embodiment includes STM32 processor and bluetooth module, and key is mainly responsible for by STM32 processorChecking and enabling signal amount exports, processor uses STM32 F103 series processors, uses other models of STM32 such as F401 systemIf row or other producer's processors can realize this bluetooth door opening function also in this programme protection domain.Bluetooth module be responsible forThe mobile terminal bluetooth being provided with bluetooth door unit connects, and described bluetooth door unit controller equiment includes that unique PID compilesNumber, device name, equipment Bluetooth MAC address, by facility information preserve to community management cloud platform server be easy to management.
The present embodiment has simple, convenient quick a, feature that safety coefficient is high, and can reduce property manpower,Material resources put into, and improve cell security, deduct owner's trouble with card, and owner is provided with bluetooth opens without band card, useThe mobile terminal of gate cell just can be entered.
Embodiment two, reference Fig. 2, the present embodiment proposes a kind of indigo plant based on community management based on system described in embodiment oneTooth door opening method, comprises the following steps: S1, registers, generate word string: owner registers houseclearing, society in community management cloud platformDistrict's management cloud platform cross-check information effectiveness, generates the unique and word string of encryption;S2, key generate: owner is obtained by mobile phone terminalTake above-mentioned word string (including active request mode), carry out configuring, generating encryption by mobile phone terminal bluetooth door unit correlation moduleBluetooth key be used for opening the door;And described bluetooth door unit can also generate the Quick Response Code key of encryption, and it is shared with visitorOpen the door for visitor;
The encryption of described bluetooth key uses the mode of mixing arrangement, bluetooth word string to include some groups of data, and often group data includeTime, interference data, flag, serial number, data bit and stop bits, wherein data bit is the numeral of 0-9, during encryption, to oftenGroup data are encrypted respectively, and i.e. arranging any one position in data bit is that check bit is encrypted;Use mixing arrangement mode, do not existSo-called rule, can not find rule and is difficult to reappear, and cipher round results is good, also complies with the application of community management simultaneously.
S3, enabling: the bluetooth key of acquisition is sent to the control unit being arranged on gate inhibition by owner, and control unit is passed throughResolve data, comparison key effectiveness opens the door;Or the Quick Response Code key of acquisition is sent to be arranged on gate inhibition by visitorControl unit, control unit resolve data, comparison key effectiveness, to visitor open the door.
In the present embodiment, in described step S3, when control unit receives enabling signal, first long according to serial dataDegree judges type of key, and selects the door-opening mode of correspondence;Owing to Quick Response Code and bluetooth are different attribute data, when opening the door,Control unit end first has to judge data type, and the present embodiment judges according to serial data length and message prefix, passes throughTwo interruptions of control unit processor detect, and first judge according to data length, and the present embodiment preference data length is more than40 for two-dimensional code data, be otherwise blue-teeth data, the most again by the prefix (such as Quick Response Code is 01, and bluetooth is 02) of messageIt is identified etc. mode;The encryption of Quick Response Code key described in described step S2 uses the mode of mixing arrangement, Quick Response Code keyIncluding user name, gate inhibition address, effect duration, communication data, during encryption, above-mentioned data are unified, upset, recompiled.Use thisThe mode of kind is difficult to find queueing discipline, and Quick Response Code key is disposable, and is provided with expiry date, cipher mode safety.
For avoiding the generation of the phenomenons such as packet loss, in described step S3, if the enabling signal received is Bluetooth signal, rightAlso include delaying step before data parsing, i.e. delay time, described delay time are set before resolving bluetooth key dataCan be 150ms, ensure that described serial data just resolves after receiving.
The present embodiment uses special encrypting and decrypting mode, and such as in blue-teeth data resolving, mobile phone terminal can be pastControl unit sends some groups of data, first sends current time signal, and whether comparison time mates, i.e. bluetooth door unit is sent outSending current time to control unit, control unit is passed through comparison time, if more than 3s, is not operated, if time match, furtherResolve, it is ensured that safety.
Bluetooth enabling scheme: add bluetooth controller equipment community gate inhibition, can be to use dry contact mode, it is not necessary to changeBecoming original gate control system directly to install additional, each equipment is numbered with unique PID, device name, equipment bluetooth MAC groundLocation, preserves facility information and is easy to manage to server.
Community owner downloads the application of bluetooth door unit at mobile phone terminal, opens this application, registration individual's account, has individualOwner's account of houseclearing and bluetooth controller module relation, and generate unique key, bluetooth door unit is opened by buttonOpening Bluetooth of mobile phone, and search bluetooth enabling module around automatically, filter other bluetooth equipments non-, the equipment that searches initiates line,Send key to bluetooth enabling module;Ageing and the correctness of bluetooth enabling module detection key, controls relay work, opensDoor, sends success message to bluetooth door unit, disconnection line;Otherwise send failure cause to connect to bluetooth door unit, disconnectionLine.Visitor wants to enter into community, needs owner to click at mobile phone terminal and generates visitor's Quick Response Code key, and disposable key is shared in clickTo visitor, it is effective that visitor enters community in stipulated time section, and other times key cancels.
Friend visitor's visiting generates visitor's Quick Response Code key at mobile terminals such as mobile phones and is sent to friend, and friend just can enterDoor, simultaneously can the effective duration of configuration key as required, effective degree is arranged flexibly;This programme enabling key only has community's certificationOwner just can use this function, owner's houseclearing detection module, and detection owner's houseclearing is the most authentic and valid, does not givesGenerate key, prevent other communities owner to be mixed into safety guaranteed, meet current economic social development and smart city construction needsAsk, there is wide promotion prospect.
The above, be only presently preferred embodiments of the present invention, is not the restriction that the present invention makees other form, appointsWhat those skilled in the art changed possibly also with the technology contents of the disclosure above or be modified as equivalent variations etc.Effect embodiment is applied to other field, but every without departing from technical solution of the present invention content, according to the technical spirit of the present inventionAny simple modification, equivalent variations and the remodeling being made above example, still falls within the protection domain of technical solution of the present invention.