LINE Beacon device specification

文章推薦指數: 80 %
投票人數:10人

Unlike LINE Simple Beacon (opens new window) packets, LINE Beacon packets contain the secure message field as a mechanism for security. # Requirements for ... Back News Products Documentation FAQ Glossary More MessagingAPItop APIreference Developmentguidelines Quickstart Guides LINEBotDesigner FlexMessage Concepts Reference Resources HomeDocumentationMessagingAPILINEBeacondevicespecification#LINEBeacondevicespecificationThistopicexplainstheLINEBeaconspecificationforenterpriseuserswhowishtodeploybeacondevicestousetheLINEBeaconfeature.TousetheLINEBeaconfeature,youneedtopreparebeacondevicescompliantwiththisspecification.UnlikeLINESimpleBeacon(opensnewwindow)packets,LINEBeaconpacketscontainthesecuremessagefieldasamechanismforsecurity.#RequirementsfordevicescompliantwiththeLINEBeaconspecificationAbeacondevicecompliantwiththeLINEBeaconspecificationsupportsBluetooth®LowEnergyVersion4.0andApple'siBeacon(opensnewwindow)andcanadvertiseLINEBeaconpackets.Specifically,thedevicemustmeetthefollowingrequirements:AdvertiseLINEBeaconpackets.GeneratethesecuremessagefromdatahashedbySHA-256andXOR(exclusiveOR)operations.Updatethesecuremessageevery15seconds.HaveauniqueHWIDanddisplayitonthebody.#LINEBeaconpacketYouneedtocontrolbeacondevicesaccordingtothebroadcasterrole(BLUETOOTHSPECIFICATIONVersion4.0[Vol3],PartCSection2.2.2.1)specifiedinthegenericaccessprofilesothatLINEcandetectthebeacondevicesquickly.#FormatoftheadvertisingdataTheadvertisingdataofaLINEBeaconpacketconsistsofthreeADstructures.Theformatandvaluestospecifyareasfollows.OctetFieldValueDescription00Length0x02ThedatalengthofthefirstADstructure(2bytes)01ADtype0x01ThisvalueindicatesthatADtypeisFlags.02ADdata0x06ThisvalueindicatesthattheflagsareLEGeneralDiscoverableModeandBR/EDRNotSupported.03Length0x03ThedatalengthofthesecondADstructure(3bytes)04ADtype0x03ThisvalueindicatesthatADtypeisCompletelistof16-bitUUIDsavailable.0516-bitUUID0x6FTogetherwiththenextbyte,thisvalueindicatesthe16-bitUUIDofLINE(0xFE6F).0616-bitUUID0xFETogetherwiththepreviousbyte,thisvalueindicatesthe16-bitUUIDofLINE(0xFE6F).07Length0x11ThedatalengthofthethirdADstructure(17bytes)08ADtype0x16ThisvalueindicatesthatADtypeisServiceData-16-bitUUID.0916-bitUUID0x6FTogetherwiththenextbyte,thisvalueindicatesthe16-bitUUIDofLINE(0xFE6F).1016-bitUUID0xFETogetherwiththepreviousbyte,thisvalueindicatesthe16-bitUUIDofLINE(0xFE6F).11Frametype0x02ThisvalueindicatesthattheframetypeisLINEBeacon.12-16HWIDDevice-specificvalue5-byteuniqueIDofthebeacondevice.Formoreinformation,seeHWID.17MeasuredTxPowerDevice-specificvalueRSSI(ReceivedSignalStrengthIndicator)whenthedistancebetweenthedevicewithLINEinstalledandthebeacondeviceis1meter.SetthesamevalueasfortheiBeaconpacket.Formoreinformation,seetheiBeacondocumentation.Setthisfieldto0x7Fifyoudon'tuseRSSIdata.18-21MessageauthenticationcodeVariable4-bytecodeformessageauthentication.Formoreinformation,seeGeneratingasecuremessage.22-23MaskedtimestampVariable2-bytemaskedtimestamp.Formoreinformation,seeGeneratingasecuremessage.24BatterylevelVariableRemainingbatterycapacity.Formoreinformation,seeBatterylevel.25-30Non-significantpart0x00Unusedpart.Seteachbyteto0x00.#PackettransmissionintervalWestronglyrecommendsendingLINEBeaconpacketsat152.5-msintervals.#SecuremessageThesecuremessageis7-bytedatathatconsistsofthemessageauthenticationcode,maskedtimestamp,andbatterylevel.Itisusedtopreventpackettamperingandreplayattacks.SecuremessagestransmittedfrombeacondevicesaresenttotheLINEPlatformviaLINEandthenverified.Thissectionexplainshowtogenerateasecuremessage.#GeneratingasecuremessageAsecuremessageisgeneratedbyperformingtheXOR(exclusiveOR)operationthreetimesonahashvaluecomputedwithSHA-256.Thefollowingfigureshowsthegenerationflowofthesecuremessage.Fortherequiredparameters,seeRequiredparameters.Generateasecuremessagebyfollowingthestepsbelow.#1.GenerateamessageauthenticationcodeConcatenatethefollowingitemsintheorderlistedandgeneratea32-bytehashvaluewithSHA-256.TimestampHWIDVendorkeyLotkeyBatterylevelPerformtheXORoperationonthefirst16bytesandthesecond16bytesofthehashvalue.PerformtheXORoperationonthefirst8bytesandsecond8bytesofthevaluecomputedinthepreviousstep.PerformtheXORoperationonthefirst4bytesandsecond4bytesofthevaluecomputedinthepreviousstep.Nowyouhavegeneratedamessageauthenticationcode.#2.GenerateamaskedtimestampMask6bytesfromthebeginningofthetimestampandleavethelast2bytes.Thisisamaskedtimestamp.#3.ConcatenateitemsConcatenatethefollowingitemsintheorderlisted:Messageauthenticationcodegeneratedinstep1Maskedtimestampgeneratedinstep2BatterylevelNowyouhavegeneratedasecuremessage.SeeSamplecodeanddataforgeneratingsecuremessages.Thistopichelpsyoudevelopandtestafunctiontoembedinbeacondevicestogeneratesecuremessages.#RequiredparametersThefollowingparametersareusedtogenerateasecuremessage.BatterylevelHWIDLotkeyTimestampVendorkeyLINECorporationgeneratesandmanagestheHWID,lotkey,andvendorkey.Fordetailsabouthowtoobtainthem,contactyourLINErepresentative.Servicesusingthelotkeyandvendorkeyareavailableonlytoenterpriseusers.#BatterylevelThisisremainingbatterycapacity.Usethisparametertodeterminewhentoreplacethebattery.Thefollowingtableshowsthemeaningofeachvalue.DecimalvalueHexadecimalvalueDescription00x00Unknownorconnectedtoanexternalpowersupply.10x010%available.Thebatteryisfullydischarged.20x0210%available………100x0A90%available110x0B100%available.Thebatteryisfullycharged.(12-255)0x0C-0xFFReservedforfutureuse.Donotuse.#HWIDHWIDisusedastheIDofabeacondevice.HWIDissuedbyLINECorporationisa10-characterstringinhexadecimalnotation.Convertittoabytearrayandwriteitintothebeacondeviceas5-bytebinarydata.PrinttheHWIDonthebodyofthebeacondevice.#LotkeyAlotkeyisassignedtoeachlot.LotkeysissuedbyLINECorporationare16-characterstrings.Convertittoabytearrayandwriteittothebeacondeviceas8-bytebinarydatainthesamewayastheHWID.#TimestampAtimestampisanunsigned64-bitinteger.Startincrementingwhenthebeacondeviceisturnedonforthefirsttime.Startthetimestampwithzeroandincrementevery15seconds.Fouristhetimestamponeminuteafterpower-on.Donotresetthetimestamptozerowhenthebeacondeviceisturnedonagain.Continuetoincrementthetimestampvalueatpower-off.#VendorkeyAvendorkeyisassignedtoeachvendor.AvendorkeyissuedbyLINECorporationisan8-characterstringinhexadecimalnotation.Convertittoabytearrayandwriteitintothebeacondeviceas4-bytebinarydataasyouwouldtheHWID.#iBeaconpacketWerecommendsendingiBeaconpacketstonotifyiOSdevicesthattheLINEBeacondeviceisnearby.FortheADstructureandtransmissionintervaloftheiBeaconpacket,seeApple'sProximityBeaconSpecificationdocument.YoucandownloadthisdocumentfromtheiBeaconsectionoftheAppleDevelopersite(opensnewwindow).ThefollowingtableshowstheparametersspecifictotheLINEBeaconspecificationthatyouneedtoincludeintheiBeaconpacket.ParameterValueUUIDD0D2CE24-9EFC-11E5-82C4-1C6A7A17EF38Major0x4C49Minor0x4E45



請為這篇文章評分?