Ai
46 Star 180 Fork 4.8K

OpenHarmony/interface_sdk-js
关闭

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
@ohos.sensor.d.ts 193.65 KB
一键复制 编辑 原始数据 按行查看 历史
shenpeixing 提交于 2025-08-27 17:13 +08:00 . 修改代码差异
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @file
* @kit SensorServiceKit
*/
import { AsyncCallback, Callback } from './@ohos.base';
/**
* This module provides the capability to subscribe to sensor data.
* @namespace sensor
* @syscap SystemCapability.Sensors.Sensor
* @since 8
*/
/**
* This module provides the capability to subscribe to sensor data.
* @namespace sensor
* @syscap SystemCapability.Sensors.Sensor
* @atomicservice
* @since arkts {'1.1':'11', '1.2':'20'}
* @arkts 1.1&1.2
*/
declare namespace sensor {
/**
* Enum for obtain the type of sensor.
* @enum { number }
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
/**
* Enum for obtain the type of sensor.
* @enum { number }
* @syscap SystemCapability.Sensors.Sensor
* @atomicservice
* @since 11
*/
enum SensorId {
/**
* Acceleration sensor.
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
/**
* Acceleration sensor.
* @syscap SystemCapability.Sensors.Sensor
* @atomicservice
* @since 11
*/
ACCELEROMETER = 1,
/**
* Gyroscope sensor.
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
/**
* Gyroscope sensor.
* @syscap SystemCapability.Sensors.Sensor
* @atomicservice
* @since 11
*/
GYROSCOPE = 2,
/**
* Ambient light sensor.
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
AMBIENT_LIGHT = 5,
/**
* Magnetic field sensor.
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
MAGNETIC_FIELD = 6,
/**
* Barometric pressure sensor.
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
BAROMETER = 8,
/**
* Hall effect sensor.
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
HALL = 10,
/**
* Proximity sensor.
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
PROXIMITY = 12,
/**
* Humidity sensor.
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
HUMIDITY = 13,
/**
* Color sensor.
* @syscap SystemCapability.Sensors.Sensor
* @systemapi
* @since 10
*/
COLOR = 14,
/**
* Sar sensor.
* @syscap SystemCapability.Sensors.Sensor
* @systemapi
* @since 10
*/
SAR = 15,
/**
* Orientation sensor.
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
/**
* Orientation sensor.
* @syscap SystemCapability.Sensors.Sensor
* @atomicservice
* @since 11
*/
ORIENTATION = 256,
/**
* Gravity sensor.
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
GRAVITY = 257,
/**
* Linear acceleration sensor.
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
LINEAR_ACCELEROMETER = 258,
/**
* Rotation vector sensor.
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
ROTATION_VECTOR = 259,
/**
* Ambient temperature sensor.
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
AMBIENT_TEMPERATURE = 260,
/**
* Uncalibrated magnetic field sensor.
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
MAGNETIC_FIELD_UNCALIBRATED = 261,
/**
* Uncalibrated gyroscope sensor.
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
GYROSCOPE_UNCALIBRATED = 263,
/**
* Significant motion sensor.
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
SIGNIFICANT_MOTION = 264,
/**
* Pedometer detection sensor.
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
PEDOMETER_DETECTION = 265,
/**
* Pedometer sensor.
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
PEDOMETER = 266,
/**
* Heart rate sensor.
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
HEART_RATE = 278,
/**
* Wear detection sensor.
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
WEAR_DETECTION = 280,
/**
* Uncalibrated acceleration sensor.
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
ACCELEROMETER_UNCALIBRATED = 281
}
/**
* Subscribe to color sensor data.
* @param { SensorId.COLOR } type - Indicate the sensor type to listen for, {@code SensorId.COLOR}.
* @param { Callback<ColorResponse> } callback - callback color data.
* @param { Options } [options] - Optional parameters specifying the interval at which sensor data is reported, {@code Options}.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br> 2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception;
* <br> 2. Sensor service ipc exception;3. Sensor data channel exception.
* @syscap SystemCapability.Sensors.Sensor
* @systemapi
* @since 10
*/
/**
* Subscribe to color sensor data.
* @param { SensorId.COLOR } type - Indicate the sensor type to listen for, {@code SensorId.COLOR}.
* @param { Callback<ColorResponse> } callback - callback color data.
* @param { Options } [options] - Optional parameters specifying the interval at which sensor data is reported, {@code Options}.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br> 2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception;
* <br> 2. Sensor service ipc exception;3. Sensor data channel exception.
* @throws { BusinessError } 202 - Permission check failed. A non-system application uses the system API.
* @syscap SystemCapability.Sensors.Sensor
* @systemapi
* @since 11
*/
function on(type: SensorId.COLOR, callback: Callback<ColorResponse>, options?: Options): void;
/**
* Subscribe to SAR sensor data.
* @param { SensorId.SAR } type - Indicate the sensor type to listen for, {@code SensorId.SAR}.
* @param { Callback<SarResponse> } callback - callback sar data.
* @param { Options } [options] - Optional parameters specifying the interval at which sensor data is reported, {@code Options}.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br> 2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception;
* <br> 2. Sensor service ipc exception;3. Sensor data channel exception.
* @syscap SystemCapability.Sensors.Sensor
* @systemapi
* @since 10
*/
/**
* Subscribe to SAR sensor data.
* @param { SensorId.SAR } type - Indicate the sensor type to listen for, {@code SensorId.SAR}.
* @param { Callback<SarResponse> } callback - callback sar data.
* @param { Options } [options] - Optional parameters specifying the interval at which sensor data is reported, {@code Options}.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br> 2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception;
* <br> 2. Sensor service ipc exception;3. Sensor data channel exception.
* @throws { BusinessError } 202 - Permission check failed. A non-system application uses the system API.
* @syscap SystemCapability.Sensors.Sensor
* @systemapi
* @since 11
*/
function on(type: SensorId.SAR, callback: Callback<SarResponse>, options?: Options): void;
/**
* Subscribe to accelerometer sensor data.
* @permission ohos.permission.ACCELEROMETER
* @param { SensorId.ACCELEROMETER } type - Indicate the sensor type to listen for, {@code SensorId.ACCELEROMETER}.
* @param { Callback<AccelerometerResponse> } callback - callback accelerometer data.
* @param { Options } [options] - Optional parameters specifying the interval at which sensor data is reported, {@code Options}.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br> 2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception;
* <br> 2. Sensor service ipc exception;3. Sensor data channel exception.
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
/**
* Subscribe to accelerometer sensor data.
* @permission ohos.permission.ACCELEROMETER
* @param { SensorId.ACCELEROMETER } type - Indicate the sensor type to listen for, {@code SensorId.ACCELEROMETER}.
* @param { Callback<AccelerometerResponse> } callback - callback accelerometer data.
* @param { Options } [options] - Optional parameters specifying the interval at which sensor data is reported, {@code Options}.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br> 2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception;
* <br> 2. Sensor service ipc exception;3. Sensor data channel exception.
* @syscap SystemCapability.Sensors.Sensor
* @atomicservice
* @since 11
*/
function on(type: SensorId.ACCELEROMETER, callback: Callback<AccelerometerResponse>,
options?: Options): void;
/**
* Subscribe to uncalibrated accelerometer sensor data.
* @permission ohos.permission.ACCELEROMETER
* @param { SensorId.ACCELEROMETER_UNCALIBRATED } type - Indicate the sensor type to listen for,{@code SensorId.ACCELEROMETER_UNCALIBRATED}.
* @param { Callback<AccelerometerUncalibratedResponse> } callback - callback uncalibrated accelerometer data.
* @param { Options } [options] - Optional parameters specifying the interval at which sensor data is reported, {@code Options}.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br> 2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception;
* <br> 2. Sensor service ipc exception;3. Sensor data channel exception.
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
function on(type: SensorId.ACCELEROMETER_UNCALIBRATED, callback: Callback<AccelerometerUncalibratedResponse>,
options?: Options): void;
/**
* Subscribe to ambient light sensor data.
* @param { SensorId.AMBIENT_LIGHT } type - Indicate the sensor type to listen for, {@code SensorId.AMBIENT_LIGHT}.
* @param { Callback<LightResponse> } callback - callback ambient data.
* @param { Options } [options] - Optional parameters specifying the interval at which sensor data is reported, {@code Options}.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br> 2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception;
* <br> 2. Sensor service ipc exception;3. Sensor data channel exception.
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
function on(type: SensorId.AMBIENT_LIGHT, callback: Callback<LightResponse>, options?: Options): void;
/**
* Subscribe to ambient temperature sensor data.
* @param { SensorId.AMBIENT_TEMPERATURE } type - Indicate the sensor type to listen for, {@code SensorId.AMBIENT_TEMPERATURE}.
* @param { Callback<AmbientTemperatureResponse> } callback - callback temperature data.
* @param { Options } [options] - Optional parameters specifying the interval at which sensor data is reported, {@code Options}.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br> 2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception;
* <br> 2. Sensor service ipc exception;3. Sensor data channel exception.
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
function on(type: SensorId.AMBIENT_TEMPERATURE, callback: Callback<AmbientTemperatureResponse>,
options?: Options): void;
/**
* Subscribe to barometer sensor data.
* @param { SensorId.BAROMETER } type - Indicate the sensor type to listen for, {@code SensorId.BAROMETER}.
* @param { Callback<BarometerResponse> } callback - callback barometer data.
* @param { Options } [options] - Optional parameters specifying the interval at which sensor data is reported, {@code Options}.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br> 2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception;
* <br> 2. Sensor service ipc exception;3. Sensor data channel exception.
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
function on(type: SensorId.BAROMETER, callback: Callback<BarometerResponse>, options?: Options): void;
/**
* Subscribe to gravity sensor data.
* @param { SensorId.GRAVITY } type - Indicate the sensor type to listen for, {@code SensorId.GRAVITY}.
* @param { Callback<GravityResponse> } callback - callback gravity data.
* @param { Options } [options] - Optional parameters specifying the interval at which sensor data is reported, {@code Options}.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br> 2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception;
* <br> 2. Sensor service ipc exception;3. Sensor data channel exception.
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
function on(type: SensorId.GRAVITY, callback: Callback<GravityResponse>,
options?: Options): void;
/**
* Subscribe to gyroscope sensor data.
* @permission ohos.permission.GYROSCOPE
* @param { SensorId.GYROSCOPE } type - Indicate the sensor type to listen for, {@code SensorId.GYROSCOPE}.
* @param { Callback<GyroscopeResponse> } callback - callback gyroscope data.
* @param { Options } [options] - Optional parameters specifying the interval at which sensor data is reported, {@code Options}.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br> 2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception;
* <br> 2. Sensor service ipc exception;3. Sensor data channel exception.
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
/**
* Subscribe to gyroscope sensor data.
* @permission ohos.permission.GYROSCOPE
* @param { SensorId.GYROSCOPE } type - Indicate the sensor type to listen for, {@code SensorId.GYROSCOPE}.
* @param { Callback<GyroscopeResponse> } callback - callback gyroscope data.
* @param { Options } [options] - Optional parameters specifying the interval at which sensor data is reported, {@code Options}.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br> 2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception;
* <br> 2. Sensor service ipc exception;3. Sensor data channel exception.
* @syscap SystemCapability.Sensors.Sensor
* @atomicservice
* @since 11
*/
function on(type: SensorId.GYROSCOPE, callback: Callback<GyroscopeResponse>,
options?: Options): void;
/**
* Subscribe to uncalibrated gyroscope sensor data.
* @permission ohos.permission.GYROSCOPE
* @param { SensorId.GYROSCOPE_UNCALIBRATED } type - Indicate the sensor type to listen for, {@code SensorId.GYROSCOPE_UNCALIBRATED}.
* @param { Callback<GyroscopeUncalibratedResponse> } callback - callback uncalibrated gyroscope data.
* @param { Options } [options] - Optional parameters specifying the interval at which sensor data is reported, {@code Options}.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br> 2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception;
* <br> 2. Sensor service ipc exception;3. Sensor data channel exception.
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
function on(type: SensorId.GYROSCOPE_UNCALIBRATED, callback: Callback<GyroscopeUncalibratedResponse>,
options?: Options): void;
/**
* Subscribe to hall sensor data.
* @param { SensorId.HALL } type - Indicate the sensor type to listen for, {@code SensorId.HALL}.
* @param { Callback<HallResponse> } callback - callback uncalibrated gyroscope data.
* @param { Options } [options] - Optional parameters specifying the interval at which sensor data is reported, {@code Options}.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br> 2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception;
* <br> 2. Sensor service ipc exception;3. Sensor data channel exception.
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
function on(type: SensorId.HALL, callback: Callback<HallResponse>, options?: Options): void;
/**
* Subscribe to heart rate sensor data.
* @permission ohos.permission.READ_HEALTH_DATA
* @param { SensorId.HEART_RATE } type - Indicate the sensor type to listen for, {@code SensorId.HEART_RATE}.
* @param { Callback<HeartRateResponse> } callback - callback heart rate data.
* @param { Options } [options] - Optional parameters specifying the interval at which sensor data is reported, {@code Options}.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br> 2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception;
* <br> 2. Sensor service ipc exception;3. Sensor data channel exception.
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
function on(type: SensorId.HEART_RATE, callback: Callback<HeartRateResponse>,
options?: Options): void;
/**
* Subscribe to humidity sensor data.
* @param { SensorId.HUMIDITY } type - Indicate the sensor type to listen for, {@code SensorId.HUMIDITY}.
* @param { Callback<HumidityResponse> } callback - callback humidity data.
* @param { Options } [options] - Optional parameters specifying the interval at which sensor data is reported, {@code Options}.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br> 2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception;
* <br> 2. Sensor service ipc exception;3. Sensor data channel exception.
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
function on(type: SensorId.HUMIDITY, callback: Callback<HumidityResponse>,
options?: Options): void;
/**
* Subscribe to linear acceleration sensor data.
* @permission ohos.permission.ACCELEROMETER
* @param { SensorId.LINEAR_ACCELEROMETER } type - Indicate the sensor type to listen for, {@code SensorId.LINEAR_ACCELEROMETER}.
* @param { Callback<LinearAccelerometerResponse> } callback - callback linear acceleration data.
* @param { Options } [options] - Optional parameters specifying the interval at which sensor data is reported, {@code Options}.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br> 2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception;
* <br> 2. Sensor service ipc exception;3. Sensor data channel exception.
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
function on(type: SensorId.LINEAR_ACCELEROMETER, callback: Callback<LinearAccelerometerResponse>,
options?: Options): void;
/**
* Subscribe to magnetic field sensor data.
* @param { SensorId.MAGNETIC_FIELD } type - Indicate the sensor type to listen for, {@code SensorId.MAGNETIC_FIELD}.
* @param { Callback<MagneticFieldResponse> } callback - callback magnetic field data.
* @param { Options } [options] - Optional parameters specifying the interval at which sensor data is reported, {@code Options}.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br> 2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception;
* <br> 2. Sensor service ipc exception;3. Sensor data channel exception.
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
function on(type: SensorId.MAGNETIC_FIELD, callback: Callback<MagneticFieldResponse>,
options?: Options): void;
/**
* Subscribe to uncalibrated magnetic field sensor data.
* @param { SensorId.MAGNETIC_FIELD_UNCALIBRATED } type - Indicate the sensor type to listen for,
* {@code SensorId.MAGNETIC_FIELD_UNCALIBRATED}.
* @param { Callback<MagneticFieldUncalibratedResponse> } callback - callback uncalibrated magnetic field data.
* @param { Options } [options] - Optional parameters specifying the interval at which sensor data is reported, {@code Options}.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br> 2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception;
* <br> 2. Sensor service ipc exception;3. Sensor data channel exception.
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
function on(type: SensorId.MAGNETIC_FIELD_UNCALIBRATED, callback: Callback<MagneticFieldUncalibratedResponse>,
options?: Options): void;
/**
* Subscribe to orientation sensor data.
* @param { SensorId.ORIENTATION } type - Indicate the sensor type to listen for, {@code SensorId.ORIENTATION}.
* @param { Callback<OrientationResponse> } callback - callback orientation data.
* @param { Options } [options] - Optional parameters specifying the interval at which sensor data is reported, {@code Options}.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br> 2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception;
* <br> 2. Sensor service ipc exception;3. Sensor data channel exception.
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
/**
* Subscribe to orientation sensor data.
* @param { SensorId.ORIENTATION } type - Indicate the sensor type to listen for, {@code SensorId.ORIENTATION}.
* @param { Callback<OrientationResponse> } callback - callback orientation data.
* @param { Options } [options] - Optional parameters specifying the interval at which sensor data is reported, {@code Options}.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br> 2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception;
* <br> 2. Sensor service ipc exception;3. Sensor data channel exception.
* @syscap SystemCapability.Sensors.Sensor
* @atomicservice
* @since 11
*/
function on(type: SensorId.ORIENTATION, callback: Callback<OrientationResponse>,
options?: Options): void;
/**
* Subscribe to orientation sensor data.
* @param { 'orientationChange' } type - Indicate the sensor type to listen for, {@code SensorId.ORIENTATION}.
* @param { Callback<OrientationResponse> } callback - callback orientation data.
* @param { Options } [options] - Optional parameters specifying the interval at which sensor data is reported,
* <br> {@code Options}.
* @throws { BusinessError } 801 - Capability not supported.
* @throws { BusinessError } 14500101 - Service exception.
* @syscap SystemCapability.Sensors.Sensor
* @since 20
* @arkts 1.2
*/
function on(type: 'orientationChange', callback: Callback<OrientationResponse>, options?: Options): void;
/**
* Subscribe to pedometer sensor data.
* @permission ohos.permission.ACTIVITY_MOTION
* @param { SensorId.PEDOMETER } type - Indicate the sensor type to listen for, {@code SensorId.PEDOMETER}.
* @param { Callback<PedometerResponse> } callback - callback pedometer data.
* @param { Options } [options] - Optional parameters specifying the interval at which sensor data is reported, {@code Options}.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br> 2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception;
* <br> 2. Sensor service ipc exception;3. Sensor data channel exception.
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
function on(type: SensorId.PEDOMETER, callback: Callback<PedometerResponse>, options?: Options): void;
/**
* Subscribe to pedometer detection sensor data.
* @permission ohos.permission.ACTIVITY_MOTION
* @param { SensorId.PEDOMETER_DETECTION } type - Indicate the sensor type to listen for, {@code SensorId.PEDOMETER_DETECTION}.
* @param { Callback<PedometerDetectionResponse> } callback - callback pedometer detection data.
* @param { Options } [options] - Optional parameters specifying the interval at which sensor data is reported, {@code Options}.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br> 2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception;
* <br> 2. Sensor service ipc exception;3. Sensor data channel exception.
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
function on(type: SensorId.PEDOMETER_DETECTION, callback: Callback<PedometerDetectionResponse>,
options?: Options): void;
/**
* Subscribe to proximity sensor data.
* @param { SensorId.PROXIMITY } type - Indicate the sensor type to listen for, {@code SensorId.PROXIMITY}.
* @param { Callback<ProximityResponse> } callback - callback proximity data.
* @param { Options } [options] - Optional parameters specifying the interval at which sensor data is reported, {@code Options}.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br> 2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception;
* <br> 2. Sensor service ipc exception;3. Sensor data channel exception.
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
function on(type: SensorId.PROXIMITY, callback: Callback<ProximityResponse>, options?: Options): void;
/**
* Subscribe to rotation vector sensor data.
* @param { SensorId.ROTATION_VECTOR } type - Indicate the sensor type to listen for, {@code SensorId.ROTATION_VECTOR}.
* @param { Callback<RotationVectorResponse> } callback - callback rotation vector data.
* @param { Options } [options] - Optional parameters specifying the interval at which sensor data is reported, {@code Options}.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br> 2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception;
* <br> 2. Sensor service ipc exception;3. Sensor data channel exception.
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
function on(type: SensorId.ROTATION_VECTOR, callback: Callback<RotationVectorResponse>,
options?: Options): void;
/**
* Subscribe to significant motion sensor data.
* @param { SensorId.SIGNIFICANT_MOTION } type - Indicate the sensor type to listen for, {@code SensorId.SIGNIFICANT_MOTION}.
* @param { Callback<SignificantMotionResponse> } callback - callback significant motion data.
* @param { Options } [options] - Optional parameters specifying the interval at which sensor data is reported, {@code Options}.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br> 2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception;
* <br> 2. Sensor service ipc exception;3. Sensor data channel exception.
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
function on(type: SensorId.SIGNIFICANT_MOTION, callback: Callback<SignificantMotionResponse>,
options?: Options): void;
/**
* Subscribe to wear detection sensor data.
* @param { SensorId.WEAR_DETECTION } type - Indicate the sensor type to listen for, {@code SensorId.WEAR_DETECTION}.
* @param { Callback<WearDetectionResponse> } callback - callback wear detection data.
* @param { Options } [options] - Optional parameters specifying the interval at which sensor data is reported, {@code Options}.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br> 2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception;
* <br> 2. Sensor service ipc exception;3. Sensor data channel exception.
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
function on(type: SensorId.WEAR_DETECTION, callback: Callback<WearDetectionResponse>,
options?: Options): void;
/**
* Subscribe to accelerometer sensor data once.
* @permission ohos.permission.ACCELEROMETER
* @param { SensorId.ACCELEROMETER } type - Indicate the sensor type to listen for, {@code SensorId.ACCELEROMETER}.
* @param { Callback<AccelerometerResponse> } callback - callback accelerometer data.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br> 2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception;
* <br> 2. Sensor service ipc exception;3. Sensor data channel exception.
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
function once(type: SensorId.ACCELEROMETER, callback: Callback<AccelerometerResponse>): void;
/**
* Subscribe to uncalibrated accelerometer sensor data once.
* @permission ohos.permission.ACCELEROMETER
* @param { SensorId.ACCELEROMETER_UNCALIBRATED } type - Indicate the sensor type to listen for,{@code SensorId.ACCELEROMETER_UNCALIBRATED}.
* @param { Callback<AccelerometerUncalibratedResponse> } callback - callback uncalibrated accelerometer data.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br> 2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception;
* <br> 2. Sensor service ipc exception;3. Sensor data channel exception.
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
function once(type: SensorId.ACCELEROMETER_UNCALIBRATED, callback: Callback<AccelerometerUncalibratedResponse>): void;
/**
* Subscribe to ambient light sensor data once.
* @param { SensorId.AMBIENT_LIGHT } type - Indicate the sensor type to listen for, {@code SensorId.AMBIENT_LIGHT}.
* @param { Callback<LightResponse> } callback - callback ambient data.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br> 2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception;
* <br> 2. Sensor service ipc exception;3. Sensor data channel exception.
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
function once(type: SensorId.AMBIENT_LIGHT, callback: Callback<LightResponse>): void;
/**
* Subscribe to ambient temperature sensor data once.
* @param { SensorId.AMBIENT_TEMPERATURE } type - Indicate the sensor type to listen for, {@code SensorId.AMBIENT_TEMPERATURE}.
* @param { Callback<AmbientTemperatureResponse> } callback - callback temperature data.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br> 2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception;
* <br> 2. Sensor service ipc exception;3. Sensor data channel exception.
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
function once(type: SensorId.AMBIENT_TEMPERATURE, callback: Callback<AmbientTemperatureResponse>): void;
/**
* Subscribe to barometer sensor data once.
* @param { SensorId.BAROMETER } type - Indicate the sensor type to listen for, {@code SensorId.BAROMETER}.
* @param { Callback<BarometerResponse> } callback - callback barometer data.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br> 2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception;
* <br> 2. Sensor service ipc exception;3. Sensor data channel exception.
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
function once(type: SensorId.BAROMETER, callback: Callback<BarometerResponse>): void;
/**
* Subscribe to gravity sensor data once.
* @param { SensorId.GRAVITY } type - Indicate the sensor type to listen for, {@code SensorId.GRAVITY}.
* @param { Callback<GravityResponse> } callback - callback gravity data.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br> 2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception;
* <br> 2. Sensor service ipc exception;3. Sensor data channel exception.
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
function once(type: SensorId.GRAVITY, callback: Callback<GravityResponse>): void;
/**
* Subscribe to gyroscope sensor data once.
* @permission ohos.permission.GYROSCOPE
* @param { SensorId.GYROSCOPE } type - Indicate the sensor type to listen for, {@code SensorId.GYROSCOPE}.
* @param { Callback<GyroscopeResponse> } callback - callback gyroscope data.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br> 2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception;
* <br> 2. Sensor service ipc exception;3. Sensor data channel exception.
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
function once(type: SensorId.GYROSCOPE, callback: Callback<GyroscopeResponse>): void;
/**
* Subscribe to uncalibrated gyroscope sensor data once.
* @permission ohos.permission.GYROSCOPE
* @param { SensorId.GYROSCOPE_UNCALIBRATED } type - Indicate the sensor type to listen for,{@code SensorId.GYROSCOPE_UNCALIBRATED}.
* @param { Callback<GyroscopeUncalibratedResponse> } callback - callback uncalibrated gyroscope data.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br> 2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception;
* <br> 2. Sensor service ipc exception;3. Sensor data channel exception.
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
function once(type: SensorId.GYROSCOPE_UNCALIBRATED, callback: Callback<GyroscopeUncalibratedResponse>): void;
/**
* Subscribe to hall sensor data once.
* @param { SensorId.HALL } type - Indicate the sensor type to listen for, {@code SensorId.HALL}.
* @param { Callback<HallResponse> } callback - callback uncalibrated gyroscope data.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br> 2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception;
* <br> 2. Sensor service ipc exception;3. Sensor data channel exception.
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
function once(type: SensorId.HALL, callback: Callback<HallResponse>): void;
/**
* Subscribe to heart rate sensor data once.
* @permission ohos.permission.READ_HEALTH_DATA
* @param { SensorId.HEART_RATE } type - Indicate the sensor type to listen for, {@code SensorId.HEART_RATE}.
* @param { Callback<HeartRateResponse> } callback - callback heart rate data.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br> 2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception;
* <br> 2. Sensor service ipc exception;3. Sensor data channel exception.
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
function once(type: SensorId.HEART_RATE, callback: Callback<HeartRateResponse>): void;
/**
* Subscribe to humidity sensor data once.
* @param { SensorId.HUMIDITY } type - Indicate the sensor type to listen for, {@code SensorId.HUMIDITY}.
* @param { Callback<HumidityResponse> } callback - callback humidity data.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br> 2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception;
* <br> 2. Sensor service ipc exception;3. Sensor data channel exception.
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
function once(type: SensorId.HUMIDITY, callback: Callback<HumidityResponse>): void;
/**
* Subscribe to linear acceleration sensor data once.
* @permission ohos.permission.ACCELEROMETER
* @param { SensorId.LINEAR_ACCELEROMETER } type - Indicate the sensor type to listen for, {@code SensorId.LINEAR_ACCELEROMETER}.
* @param { Callback<LinearAccelerometerResponse> } callback - callback linear acceleration data.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br> 2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception;
* <br> 2. Sensor service ipc exception;3. Sensor data channel exception.
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
function once(type: SensorId.LINEAR_ACCELEROMETER, callback: Callback<LinearAccelerometerResponse>): void;
/**
* Subscribe to magnetic field sensor data once.
* @param { SensorId.MAGNETIC_FIELD } type - Indicate the sensor type to listen for, {@code SensorId.MAGNETIC_FIELD}.
* @param { Callback<MagneticFieldResponse> } callback - callback magnetic field data.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br> 2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception;
* <br> 2. Sensor service ipc exception;3. Sensor data channel exception.
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
function once(type: SensorId.MAGNETIC_FIELD, callback: Callback<MagneticFieldResponse>): void;
/**
* Subscribe to uncalibrated magnetic field sensor data once.
* @param { SensorId.MAGNETIC_FIELD_UNCALIBRATED } type - Indicate the sensor type to listen for,
* {@code SensorId.MAGNETIC_FIELD_UNCALIBRATED}.
* @param { Callback<MagneticFieldUncalibratedResponse> } callback - callback uncalibrated magnetic field data.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br> 2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception;
* <br> 2. Sensor service ipc exception;3. Sensor data channel exception.
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
function once(type: SensorId.MAGNETIC_FIELD_UNCALIBRATED, callback: Callback<MagneticFieldUncalibratedResponse>): void;
/**
* Subscribe to orientation sensor data once.
* @param { SensorId.ORIENTATION } type - Indicate the sensor type to listen for, {@code SensorId.ORIENTATION}.
* @param { Callback<OrientationResponse> } callback - callback orientation data.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br> 2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception;
* <br> 2. Sensor service ipc exception;3. Sensor data channel exception.
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
function once(type: SensorId.ORIENTATION, callback: Callback<OrientationResponse>): void;
/**
* Subscribe to pedometer sensor data once.
* @permission ohos.permission.ACTIVITY_MOTION
* @param { SensorId.PEDOMETER } type - Indicate the sensor type to listen for, {@code SensorId.PEDOMETER}.
* @param { Callback<PedometerResponse> } callback - callback pedometer data.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br> 2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception;
* <br> 2. Sensor service ipc exception;3. Sensor data channel exception.
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
function once(type: SensorId.PEDOMETER, callback: Callback<PedometerResponse>): void;
/**
* Subscribe to pedometer detection sensor data once.
* @permission ohos.permission.ACTIVITY_MOTION
* @param { SensorId.PEDOMETER_DETECTION } type - Indicate the sensor type to listen for, {@code SensorId.PEDOMETER_DETECTION}.
* @param { Callback<PedometerDetectionResponse> } callback - callback pedometer detection data.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br> 2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception;
* <br> 2. Sensor service ipc exception;3. Sensor data channel exception.
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
function once(type: SensorId.PEDOMETER_DETECTION, callback: Callback<PedometerDetectionResponse>): void;
/**
* Subscribe to proximity sensor data once.
* @param { SensorId.PROXIMITY } type - Indicate the sensor type to listen for, {@code SensorId.PROXIMITY}.
* @param { Callback<ProximityResponse> } callback - callback proximity data.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br> 2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception;
* <br> 2. Sensor service ipc exception;3. Sensor data channel exception.
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
function once(type: SensorId.PROXIMITY, callback: Callback<ProximityResponse>): void;
/**
* Subscribe to rotation vector sensor data once.
* @param { SensorId.ROTATION_VECTOR } type - Indicate the sensor type to listen for, {@code SensorId.ROTATION_VECTOR}.
* @param { Callback<RotationVectorResponse> } callback - callback rotation vector data.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br> 2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception;
* <br> 2. Sensor service ipc exception;3. Sensor data channel exception.
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
function once(type: SensorId.ROTATION_VECTOR, callback: Callback<RotationVectorResponse>): void;
/**
* Subscribe to significant motion sensor data once.
* @param { SensorId.SIGNIFICANT_MOTION } type - Indicate the sensor type to listen for, {@code SensorId.SIGNIFICANT_MOTION}.
* @param { Callback<SignificantMotionResponse> } callback - callback significant motion data.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br> 2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception;
* <br> 2. Sensor service ipc exception;3. Sensor data channel exception.
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
function once(type: SensorId.SIGNIFICANT_MOTION, callback: Callback<SignificantMotionResponse>): void;
/**
* Subscribe to wear detection sensor data once.
* @param { SensorId.WEAR_DETECTION } type - Indicate the sensor type to listen for, {@code SensorId.WEAR_DETECTION}.
* @param { Callback<WearDetectionResponse> } callback - callback wear detection data.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br> 2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception;
* <br> 2. Sensor service ipc exception;3. Sensor data channel exception.
*
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
function once(type: SensorId.WEAR_DETECTION, callback: Callback<WearDetectionResponse>): void;
/**
* Unsubscribe to color sensor data.
* @param { SensorId.COLOR } type - Indicate the sensor type to listen for, {@code SensorId.COLOR}.
* @param { Callback<ColorResponse> } callback - callback color data.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br> 2. Incorrect parameter types; 3. Parameter verification failed.
* @syscap SystemCapability.Sensors.Sensor
* @systemapi
* @since 10
*/
/**
* Unsubscribe to color sensor data.
* @param { SensorId.COLOR } type - Indicate the sensor type to listen for, {@code SensorId.COLOR}.
* @param { Callback<ColorResponse> } callback - callback color data.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br> 2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 202 - Permission check failed. A non-system application uses the system API.
* @syscap SystemCapability.Sensors.Sensor
* @systemapi
* @since 11
*/
function off(type: SensorId.COLOR, callback?: Callback<ColorResponse>): void;
/**
* Unsubscribe to color sensor data.
* @param { SensorId.COLOR } type - Indicate the sensor type to listen for, {@code SensorId.COLOR}.
* @param { SensorInfoParam } [sensorInfoParam] - Parameters of sensor on the device.
* @param { Callback<ColorResponse> } [callback] - callback color data.
* @throws { BusinessError } 202 - Permission check failed. A non-system application uses the system API.
* @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception;
* <br> 2. Sensor service ipc exception;3. Sensor data channel exception.
* @syscap SystemCapability.Sensors.Sensor
* @systemapi
* @since 19
*/
function off(type: SensorId.COLOR, sensorInfoParam?: SensorInfoParam, callback?: Callback<ColorResponse>): void;
/**
* Unsubscribe to sar sensor data.
* @param { SensorId.SAR } type - Indicate the sensor type to listen for, {@code SensorId.SAR}.
* @param { Callback<SarResponse> } callback - callback sar data.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br> 2. Incorrect parameter types; 3. Parameter verification failed.
* @syscap SystemCapability.Sensors.Sensor
* @systemapi
* @since 10
*/
/**
* Unsubscribe to sar sensor data.
* @param { SensorId.SAR } type - Indicate the sensor type to listen for, {@code SensorId.SAR}.
* @param { Callback<SarResponse> } callback - callback sar data.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br> 2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 202 - Permission check failed. A non-system application uses the system API.
* @syscap SystemCapability.Sensors.Sensor
* @systemapi
* @since 11
*/
function off(type: SensorId.SAR, callback?: Callback<SarResponse>): void;
/**
* Unsubscribe to sar sensor data.
* @param { SensorId.SAR } type - Indicate the sensor type to listen for, {@code SensorId.SAR}.
* @param { SensorInfoParam } [sensorInfoParam] - Parameters of sensor on the device.
* @param { Callback<SarResponse> } [callback] - callback sar data.
* @throws { BusinessError } 202 - Permission check failed. A non-system application uses the system API.
* @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception;
* <br> 2. Sensor service ipc exception;3. Sensor data channel exception.
* @syscap SystemCapability.Sensors.Sensor
* @systemapi
* @since 19
*/
function off(type: SensorId.SAR, sensorInfoParam?: SensorInfoParam, callback?: Callback<SarResponse>): void;
/**
* Unsubscribe to accelerometer sensor data.
* @permission ohos.permission.ACCELEROMETER
* @param { SensorId.ACCELEROMETER } type - Indicate the sensor type to listen for, {@code SensorId.ACCELEROMETER}.
* @param { Callback<AccelerometerResponse> } callback - callback accelerometer data.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br> 2. Incorrect parameter types; 3. Parameter verification failed.
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
/**
* Unsubscribe to accelerometer sensor data.
* @permission ohos.permission.ACCELEROMETER
* @param { SensorId.ACCELEROMETER } type - Indicate the sensor type to listen for, {@code SensorId.ACCELEROMETER}.
* @param { Callback<AccelerometerResponse> } callback - callback accelerometer data.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br> 2. Incorrect parameter types; 3. Parameter verification failed.
* @syscap SystemCapability.Sensors.Sensor
* @atomicservice
* @since 11
*/
function off(type: SensorId.ACCELEROMETER, callback?: Callback<AccelerometerResponse>): void;
/**
* Unsubscribe to accelerometer sensor data.
* @permission ohos.permission.ACCELEROMETER
* @param { SensorId.ACCELEROMETER } type - Indicate the sensor type to listen for, {@code SensorId.ACCELEROMETER}.
* @param { SensorInfoParam } [sensorInfoParam] - Parameters of sensor on the device.
* @param { Callback<AccelerometerResponse> } [callback] - callback accelerometer data.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception;
* <br> 2. Sensor service ipc exception;3. Sensor data channel exception.
* @syscap SystemCapability.Sensors.Sensor
* @atomicservice
* @since 19
*/
function off(type: SensorId.ACCELEROMETER, sensorInfoParam?: SensorInfoParam, callback?: Callback<AccelerometerResponse>): void;
/**
* Unsubscribe to uncalibrated accelerometer sensor data.
* @permission ohos.permission.ACCELEROMETER
* @param { SensorId.ACCELEROMETER_UNCALIBRATED } type - Indicate the sensor type to listen for,
* {@code SensorId.ACCELEROMETER_UNCALIBRATED}.
* @param { Callback<AccelerometerUncalibratedResponse> } callback - callback uncalibrated accelerometer data.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br> 2. Incorrect parameter types; 3. Parameter verification failed.
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
function off(type: SensorId.ACCELEROMETER_UNCALIBRATED, callback?: Callback<AccelerometerUncalibratedResponse>): void;
/**
* Unsubscribe to uncalibrated accelerometer sensor data.
* @permission ohos.permission.ACCELEROMETER
* @param { SensorId.ACCELEROMETER_UNCALIBRATED } type - Indicate the sensor type to listen for,
* {@code SensorId.ACCELEROMETER_UNCALIBRATED}.
* @param { SensorInfoParam } [sensorInfoParam] - Parameters of sensor on the device.
* @param { Callback<AccelerometerUncalibratedResponse> } [callback] - callback uncalibrated accelerometer data.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception;
* <br> 2. Sensor service ipc exception;3. Sensor data channel exception.
* @syscap SystemCapability.Sensors.Sensor
* @since 19
*/
function off(type: SensorId.ACCELEROMETER_UNCALIBRATED, sensorInfoParam?: SensorInfoParam, callback?: Callback<AccelerometerUncalibratedResponse>): void;
/**
* Unsubscribe to ambient light sensor data.
* @param { SensorId.AMBIENT_LIGHT } type - Indicate the sensor type to listen for, {@code SensorId.AMBIENT_LIGHT}.
* @param { Callback<LightResponse> } callback - callback ambient data.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br> 2. Incorrect parameter types; 3. Parameter verification failed.
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
function off(type: SensorId.AMBIENT_LIGHT, callback?: Callback<LightResponse>): void;
/**
* Unsubscribe to ambient light sensor data.
* @param { SensorId.AMBIENT_LIGHT } type - Indicate the sensor type to listen for, {@code SensorId.AMBIENT_LIGHT}.
* @param { SensorInfoParam } [sensorInfoParam] - Parameters of sensor on the device.
* @param { Callback<LightResponse> } [callback] - callback ambient data.
* @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception;
* <br> 2. Sensor service ipc exception;3. Sensor data channel exception.
* @syscap SystemCapability.Sensors.Sensor
* @since 19
*/
function off(type: SensorId.AMBIENT_LIGHT, sensorInfoParam?: SensorInfoParam, callback?: Callback<LightResponse>): void;
/**
* Unsubscribe to ambient temperature sensor data.
* @param { SensorId.AMBIENT_TEMPERATURE } type - Indicate the sensor type to listen for, {@code SensorId.AMBIENT_TEMPERATURE}.
* @param { Callback<AmbientTemperatureResponse> } callback - callback temperature data.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br> 2. Incorrect parameter types; 3. Parameter verification failed.
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
function off(type: SensorId.AMBIENT_TEMPERATURE, callback?: Callback<AmbientTemperatureResponse>): void;
/**
* Unsubscribe to ambient temperature sensor data.
* @param { SensorId.AMBIENT_TEMPERATURE } type - Indicate the sensor type to listen for, {@code SensorId.AMBIENT_TEMPERATURE}.
* @param { SensorInfoParam } [sensorInfoParam] - Parameters of sensor on the device.
* @param { Callback<AmbientTemperatureResponse> } [callback] - callback temperature data.
* @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception;
* <br> 2. Sensor service ipc exception;3. Sensor data channel exception.
* @syscap SystemCapability.Sensors.Sensor
* @since 19
*/
function off(type: SensorId.AMBIENT_TEMPERATURE, sensorInfoParam?: SensorInfoParam, callback?: Callback<AmbientTemperatureResponse>): void;
/**
* Unsubscribe to barometer sensor data.
* @param { SensorId.BAROMETER } type - Indicate the sensor type to listen for, {@code SensorId.BAROMETER}.
* @param { Callback<BarometerResponse> } callback - callback barometer data.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br> 2. Incorrect parameter types; 3. Parameter verification failed.
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
function off(type: SensorId.BAROMETER, callback?: Callback<BarometerResponse>): void;
/**
* Unsubscribe to barometer sensor data.
* @param { SensorId.BAROMETER } type - Indicate the sensor type to listen for, {@code SensorId.BAROMETER}.
* @param { SensorInfoParam } [sensorInfoParam] - Parameters of sensor on the device.
* @param { Callback<BarometerResponse> } [callback] - callback barometer data.
* @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception;
* <br> 2. Sensor service ipc exception;3. Sensor data channel exception.
* @syscap SystemCapability.Sensors.Sensor
* @since 19
*/
function off(type: SensorId.BAROMETER, sensorInfoParam?: SensorInfoParam, callback?: Callback<BarometerResponse>): void;
/**
* Unsubscribe to gravity sensor data.
* @param { SensorId.GRAVITY } type - Indicate the sensor type to listen for, {@code SensorId.GRAVITY}.
* @param { Callback<GravityResponse> } callback - callback gravity data.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br> 2. Incorrect parameter types; 3. Parameter verification failed.
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
function off(type: SensorId.GRAVITY, callback?: Callback<GravityResponse>): void;
/**
* Unsubscribe to gravity sensor data.
* @param { SensorId.GRAVITY } type - Indicate the sensor type to listen for, {@code SensorId.GRAVITY}.
* @param { SensorInfoParam } [sensorInfoParam] - Parameters of sensor on the device.
* @param { Callback<GravityResponse> } [callback] - callback gravity data.
* @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception;
* <br> 2. Sensor service ipc exception;3. Sensor data channel exception.
* @syscap SystemCapability.Sensors.Sensor
* @since 19
*/
function off(type: SensorId.GRAVITY, sensorInfoParam?: SensorInfoParam, callback?: Callback<GravityResponse>): void;
/**
* Unsubscribe to gyroscope sensor data.
* @permission ohos.permission.GYROSCOPE
* @param { SensorId.GYROSCOPE } type - Indicate the sensor type to listen for, {@code SensorId.GYROSCOPE}.
* @param { Callback<GyroscopeResponse> } callback - callback gyroscope data.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br> 2. Incorrect parameter types; 3. Parameter verification failed.
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
/**
* Unsubscribe to gyroscope sensor data.
* @permission ohos.permission.GYROSCOPE
* @param { SensorId.GYROSCOPE } type - Indicate the sensor type to listen for, {@code SensorId.GYROSCOPE}.
* @param { Callback<GyroscopeResponse> } callback - callback gyroscope data.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br> 2. Incorrect parameter types; 3. Parameter verification failed.
* @syscap SystemCapability.Sensors.Sensor
* @atomicservice
* @since 11
*/
function off(type: SensorId.GYROSCOPE, callback?: Callback<GyroscopeResponse>): void;
/**
* Unsubscribe to gyroscope sensor data.
* @permission ohos.permission.GYROSCOPE
* @param { SensorId.GYROSCOPE } type - Indicate the sensor type to listen for, {@code SensorId.GYROSCOPE}.
* @param { SensorInfoParam } [sensorInfoParam] - Parameters of sensor on the device.
* @param { Callback<GyroscopeResponse> } [callback] - callback gyroscope data.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception;
* <br> 2. Sensor service ipc exception;3. Sensor data channel exception.
* @syscap SystemCapability.Sensors.Sensor
* @atomicservice
* @since 19
*/
function off(type: SensorId.GYROSCOPE, sensorInfoParam?: SensorInfoParam, callback?: Callback<GyroscopeResponse>): void;
/**
* Unsubscribe to uncalibrated gyroscope sensor data.
* @permission ohos.permission.GYROSCOPE
* @param { SensorId.GYROSCOPE_UNCALIBRATED } type - Indicate the sensor type to listen for, {@code SensorId.GYROSCOPE_UNCALIBRATED}.
* @param { Callback<GyroscopeUncalibratedResponse> } callback - callback uncalibrated gyroscope data.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br> 2. Incorrect parameter types; 3. Parameter verification failed.
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
function off(type: SensorId.GYROSCOPE_UNCALIBRATED, callback?: Callback<GyroscopeUncalibratedResponse>): void;
/**
* Unsubscribe to uncalibrated gyroscope sensor data.
* @permission ohos.permission.GYROSCOPE
* @param { SensorId.GYROSCOPE_UNCALIBRATED } type - Indicate the sensor type to listen for, {@code SensorId.GYROSCOPE_UNCALIBRATED}.
* @param { SensorInfoParam } [sensorInfoParam] - Parameters of sensor on the device.
* @param { Callback<GyroscopeUncalibratedResponse> } [callback] - callback uncalibrated gyroscope data.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception;
* <br> 2. Sensor service ipc exception;3. Sensor data channel exception.
* @syscap SystemCapability.Sensors.Sensor
* @since 19
*/
function off(type: SensorId.GYROSCOPE_UNCALIBRATED, sensorInfoParam?: SensorInfoParam, callback?: Callback<GyroscopeUncalibratedResponse>): void;
/**
* Unsubscribe to hall sensor data.
* @param { SensorId.HALL } type - Indicate the sensor type to listen for, {@code SensorId.HALL}.
* @param { Callback<HallResponse> } callback - callback uncalibrated gyroscope data.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br> 2. Incorrect parameter types; 3. Parameter verification failed.
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
function off(type: SensorId.HALL, callback?: Callback<HallResponse>): void;
/**
* Unsubscribe to hall sensor data.
* @param { SensorId.HALL } type - Indicate the sensor type to listen for, {@code SensorId.HALL}.
* @param { SensorInfoParam } [sensorInfoParam] - Parameters of sensor on the device.
* @param { Callback<HallResponse> } [callback] - callback uncalibrated gyroscope data.
* @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception;
* <br> 2. Sensor service ipc exception;3. Sensor data channel exception.
* @syscap SystemCapability.Sensors.Sensor
* @since 19
*/
function off(type: SensorId.HALL, sensorInfoParam?: SensorInfoParam, callback?: Callback<HallResponse>): void;
/**
* Unsubscribe to heart rate sensor data.
* @permission ohos.permission.READ_HEALTH_DATA
* @param { SensorId.HEART_RATE } type - Indicate the sensor type to listen for, {@code SensorId.HEART_RATE}.
* @param { Callback<HeartRateResponse> } callback - callback heart rate data.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br> 2. Incorrect parameter types; 3. Parameter verification failed.
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
function off(type: SensorId.HEART_RATE, callback?: Callback<HeartRateResponse>): void;
/**
* Unsubscribe to heart rate sensor data.
* @permission ohos.permission.READ_HEALTH_DATA
* @param { SensorId.HEART_RATE } type - Indicate the sensor type to listen for, {@code SensorId.HEART_RATE}.
* @param { SensorInfoParam } [sensorInfoParam] - Parameters of sensor on the device.
* @param { Callback<HeartRateResponse> } [callback] - callback heart rate data.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception;
* <br> 2. Sensor service ipc exception;3. Sensor data channel exception.
* @syscap SystemCapability.Sensors.Sensor
* @since 19
*/
function off(type: SensorId.HEART_RATE, sensorInfoParam?: SensorInfoParam, callback?: Callback<HeartRateResponse>): void;
/**
* Unsubscribe to humidity sensor data.
* @param { SensorId.HUMIDITY } type - Indicate the sensor type to listen for, {@code SensorId.HUMIDITY}.
* @param { Callback<HumidityResponse> } callback - callback humidity data.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br> 2. Incorrect parameter types; 3. Parameter verification failed.
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
function off(type: SensorId.HUMIDITY, callback?: Callback<HumidityResponse>): void;
/**
* Unsubscribe to humidity sensor data.
* @param { SensorId.HUMIDITY } type - Indicate the sensor type to listen for, {@code SensorId.HUMIDITY}.
* @param { SensorInfoParam } [sensorInfoParam] - Parameters of sensor on the device.
* @param { Callback<HumidityResponse> } [callback] - callback humidity data.
* @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception;
* <br> 2. Sensor service ipc exception;3. Sensor data channel exception.
* @syscap SystemCapability.Sensors.Sensor
* @since 19
*/
function off(type: SensorId.HUMIDITY, sensorInfoParam?: SensorInfoParam, callback?: Callback<HumidityResponse>): void;
/**
* Unsubscribe to linear acceleration sensor data.
* @permission ohos.permission.ACCELEROMETER
* @param { SensorId.LINEAR_ACCELEROMETER } type - Indicate the sensor type to listen for, {@code SensorId.LINEAR_ACCELEROMETER}.
* @param { Callback<LinearAccelerometerResponse> } callback - callback linear acceleration data.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br> 2. Incorrect parameter types; 3. Parameter verification failed.
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
function off(type: SensorId.LINEAR_ACCELEROMETER, callback?: Callback<LinearAccelerometerResponse>): void;
/**
* Unsubscribe to linear acceleration sensor data.
* @permission ohos.permission.ACCELEROMETER
* @param { SensorId.LINEAR_ACCELEROMETER } type - Indicate the sensor type to listen for, {@code SensorId.LINEAR_ACCELEROMETER}.
* @param { SensorInfoParam } [sensorInfoParam] - Parameters of sensor on the device.
* @param { Callback<LinearAccelerometerResponse> } [callback] - callback linear acceleration data.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception;
* <br> 2. Sensor service ipc exception;3. Sensor data channel exception.
* @syscap SystemCapability.Sensors.Sensor
* @since 19
*/
function off(type: SensorId.LINEAR_ACCELEROMETER, sensorInfoParam?: SensorInfoParam, callback?: Callback<LinearAccelerometerResponse>): void;
/**
* Unsubscribe to magnetic field sensor data.
* @param { SensorId.MAGNETIC_FIELD } type - Indicate the sensor type to listen for, {@code SensorId.MAGNETIC_FIELD}.
* @param { Callback<MagneticFieldResponse> } callback - callback magnetic field data.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br> 2. Incorrect parameter types; 3. Parameter verification failed.
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
function off(type: SensorId.MAGNETIC_FIELD, callback?: Callback<MagneticFieldResponse>): void;
/**
* Unsubscribe to magnetic field sensor data.
* @param { SensorId.MAGNETIC_FIELD } type - Indicate the sensor type to listen for, {@code SensorId.MAGNETIC_FIELD}.
* @param { SensorInfoParam } [sensorInfoParam] - Parameters of sensor on the device.
* @param { Callback<MagneticFieldResponse> } [callback] - callback magnetic field data.
* @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception;
* <br> 2. Sensor service ipc exception;3. Sensor data channel exception.
* @syscap SystemCapability.Sensors.Sensor
* @since 19
*/
function off(type: SensorId.MAGNETIC_FIELD, sensorInfoParam?: SensorInfoParam, callback?: Callback<MagneticFieldResponse>): void;
/**
* Unsubscribe to uncalibrated magnetic field sensor data.
* @param { SensorId.MAGNETIC_FIELD_UNCALIBRATED } type - Indicate the sensor type to listen for,
* {@code SensorId.MAGNETIC_FIELD_UNCALIBRATED}.
* @param { Callback<MagneticFieldUncalibratedResponse> } callback - callback uncalibrated magnetic field data.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br> 2. Incorrect parameter types; 3. Parameter verification failed.
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
function off(type: SensorId.MAGNETIC_FIELD_UNCALIBRATED, callback?: Callback<MagneticFieldUncalibratedResponse>): void;
/**
* Unsubscribe to uncalibrated magnetic field sensor data.
* @param { SensorId.MAGNETIC_FIELD_UNCALIBRATED } type - Indicate the sensor type to listen for,
* {@code SensorId.MAGNETIC_FIELD_UNCALIBRATED}.
* @param { SensorInfoParam } [sensorInfoParam] - Parameters of sensor on the device.
* @param { Callback<MagneticFieldUncalibratedResponse> } [callback] - callback uncalibrated magnetic field data.
* @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception;
* <br> 2. Sensor service ipc exception;3. Sensor data channel exception.
* @syscap SystemCapability.Sensors.Sensor
* @since 19
*/
function off(type: SensorId.MAGNETIC_FIELD_UNCALIBRATED, sensorInfoParam?: SensorInfoParam, callback?: Callback<MagneticFieldUncalibratedResponse>): void;
/**
* Unsubscribe to orientation sensor data.
* @param { SensorId.ORIENTATION } type - Indicate the sensor type to listen for, {@code SensorId.ORIENTATION}.
* @param { Callback<OrientationResponse> } callback - callback orientation data.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br> 2. Incorrect parameter types; 3. Parameter verification failed.
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
/**
* Unsubscribe to orientation sensor data.
* @param { SensorId.ORIENTATION } type - Indicate the sensor type to listen for, {@code SensorId.ORIENTATION}.
* @param { Callback<OrientationResponse> } callback - callback orientation data.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br> 2. Incorrect parameter types; 3. Parameter verification failed.
* @syscap SystemCapability.Sensors.Sensor
* @atomicservice
* @since 11
*/
function off(type: SensorId.ORIENTATION, callback?: Callback<OrientationResponse>): void;
/**
* Unsubscribe to orientation sensor data.
* @param { SensorId.ORIENTATION } type - Indicate the sensor type to listen for, {@code SensorId.ORIENTATION}.
* @param { SensorInfoParam } [sensorInfoParam] - Parameters of sensor on the device.
* @param { Callback<OrientationResponse> } [callback] - callback orientation data.
* @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception;
* <br> 2. Sensor service ipc exception;3. Sensor data channel exception.
* @syscap SystemCapability.Sensors.Sensor
* @atomicservice
* @since 19
*/
function off(type: SensorId.ORIENTATION, sensorInfoParam?: SensorInfoParam, callback?: Callback<OrientationResponse>): void;
/**
* Unsubscribe to orientation sensor data.
* @param { 'orientationChange' } type - Indicate the sensor type to listen for, {@code SensorId.ORIENTATION}.
* @param { Callback<OrientationResponse> } [callback] - callback orientation data.
* @throws { BusinessError } 801 - Capability not supported.
* @syscap SystemCapability.Sensors.Sensor
* @since 20
* @arkts 1.2
*/
function off(type: 'orientationChange', callback?: Callback<OrientationResponse>): void;
/**
* Unsubscribe to pedometer sensor data.
* @permission ohos.permission.ACTIVITY_MOTION
* @param { SensorId.PEDOMETER } type - Indicate the sensor type to listen for, {@code SensorId.PEDOMETER}.
* @param { Callback<PedometerResponse> } callback - callback pedometer data.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br> 2. Incorrect parameter types; 3. Parameter verification failed.
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
function off(type: SensorId.PEDOMETER, callback?: Callback<PedometerResponse>): void;
/**
* Unsubscribe to pedometer sensor data.
* @permission ohos.permission.ACTIVITY_MOTION
* @param { SensorId.PEDOMETER } type - Indicate the sensor type to listen for, {@code SensorId.PEDOMETER}.
* @param { SensorInfoParam } [sensorInfoParam] - Parameters of sensor on the device.
* @param { Callback<PedometerResponse> } [callback] - callback pedometer data.
* @throws { BusinessError } 201 - Permission denied
* @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception;
* <br> 2. Sensor service ipc exception;3. Sensor data channel exception.
* @syscap SystemCapability.Sensors.Sensor
* @since 19
*/
function off(type: SensorId.PEDOMETER, sensorInfoParam?: SensorInfoParam, callback?: Callback<PedometerResponse>): void;
/**
* Unsubscribe to pedometer detection sensor data.
* @permission ohos.permission.ACTIVITY_MOTION
* @param { SensorId.PEDOMETER_DETECTION } type - Indicate the sensor type to listen for, {@code SensorId.PEDOMETER_DETECTION}.
* @param { Callback<PedometerDetectionResponse> } callback - callback pedometer detection data.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br> 2. Incorrect parameter types; 3. Parameter verification failed.
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
function off(type: SensorId.PEDOMETER_DETECTION, callback?: Callback<PedometerDetectionResponse>): void;
/**
* Unsubscribe to pedometer detection sensor data.
* @permission ohos.permission.ACTIVITY_MOTION
* @param { SensorId.PEDOMETER_DETECTION } type - Indicate the sensor type to listen for, {@code SensorId.PEDOMETER_DETECTION}.
* @param { SensorInfoParam } [sensorInfoParam] - Parameters of sensor on the device.
* @param { Callback<PedometerDetectionResponse> } [callback] - callback pedometer detection data.
* @throws { BusinessError } 201 - Permission denied.
* @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception;
* <br> 2. Sensor service ipc exception;3. Sensor data channel exception.
* @syscap SystemCapability.Sensors.Sensor
* @since 19
*/
function off(type: SensorId.PEDOMETER_DETECTION, sensorInfoParam?: SensorInfoParam, callback?: Callback<PedometerDetectionResponse>): void;
/**
* Unsubscribe to proximity sensor data.
* @param { SensorId.PROXIMITY } type - Indicate the sensor type to listen for, {@code SensorId.PROXIMITY}.
* @param { Callback<ProximityResponse> } callback - callback proximity data.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br> 2. Incorrect parameter types; 3. Parameter verification failed.
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
function off(type: SensorId.PROXIMITY, callback?: Callback<ProximityResponse>): void;
/**
* Unsubscribe to proximity sensor data.
* @param { SensorId.PROXIMITY } type - Indicate the sensor type to listen for, {@code SensorId.PROXIMITY}.
* @param { SensorInfoParam } [sensorInfoParam] - Parameters of sensor on the device.
* @param { Callback<ProximityResponse> } [callback] - callback proximity data.
* @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception;
* <br> 2. Sensor service ipc exception;3. Sensor data channel exception.
* @syscap SystemCapability.Sensors.Sensor
* @since 19
*/
function off(type: SensorId.PROXIMITY, sensorInfoParam?: SensorInfoParam, callback?: Callback<ProximityResponse>): void;
/**
* Unsubscribe to rotation vector sensor data.
* @param { SensorId.ROTATION_VECTOR } type - Indicate the sensor type to listen for, {@code SensorId.ROTATION_VECTOR}.
* @param { Callback<RotationVectorResponse> } callback - callback rotation vector data.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br> 2. Incorrect parameter types; 3. Parameter verification failed.
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
function off(type: SensorId.ROTATION_VECTOR, callback?: Callback<RotationVectorResponse>): void;
/**
* Unsubscribe to rotation vector sensor data.
* @param { SensorId.ROTATION_VECTOR } type - Indicate the sensor type to listen for, {@code SensorId.ROTATION_VECTOR}.
* @param { SensorInfoParam } [sensorInfoParam] - Parameters of sensor on the device.
* @param { Callback<RotationVectorResponse> } [callback] - callback rotation vector data.
* @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception;
* <br> 2. Sensor service ipc exception;3. Sensor data channel exception.
* @syscap SystemCapability.Sensors.Sensor
* @since 19
*/
function off(type: SensorId.ROTATION_VECTOR, sensorInfoParam?: SensorInfoParam, callback?: Callback<RotationVectorResponse>): void;
/**
* Unsubscribe to significant motion sensor data.
* @param { SensorId.SIGNIFICANT_MOTION } type - Indicate the sensor type to listen for, {@code SensorId.SIGNIFICANT_MOTION}.
* @param { Callback<SignificantMotionResponse> } callback - callback significant motion data.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br> 2. Incorrect parameter types; 3. Parameter verification failed.
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
function off(type: SensorId.SIGNIFICANT_MOTION, callback?: Callback<SignificantMotionResponse>): void;
/**
* Unsubscribe to significant motion sensor data.
* @param { SensorId.SIGNIFICANT_MOTION } type - Indicate the sensor type to listen for, {@code SensorId.SIGNIFICANT_MOTION}.
* @param { SensorInfoParam } [sensorInfoParam] - Parameters of sensor on the device.
* @param { Callback<SignificantMotionResponse> } [callback] - callback significant motion data.
* @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception;
* <br> 2. Sensor service ipc exception;3. Sensor data channel exception.
* @syscap SystemCapability.Sensors.Sensor
* @since 19
*/
function off(type: SensorId.SIGNIFICANT_MOTION, sensorInfoParam?: SensorInfoParam, callback?: Callback<SignificantMotionResponse>): void;
/**
* Unsubscribe to wear detection sensor data.
* @param { SensorId.WEAR_DETECTION } type - Indicate the sensor type to listen for, {@code SensorId.WEAR_DETECTION}.
* @param { Callback<WearDetectionResponse> } callback - callback wear detection data.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br> 2. Incorrect parameter types; 3. Parameter verification failed.
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
function off(type: SensorId.WEAR_DETECTION, callback?: Callback<WearDetectionResponse>): void;
/**
* Unsubscribe to wear detection sensor data.
* @param { SensorId.WEAR_DETECTION } type - Indicate the sensor type to listen for, {@code SensorId.WEAR_DETECTION}.
* @param { SensorInfoParam } [sensorInfoParam] - Parameters of sensor on the device.
* @param { Callback<WearDetectionResponse> } [callback] - callback wear detection data.
* @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception;
* <br> 2. Sensor service ipc exception;3. Sensor data channel exception.
* @syscap SystemCapability.Sensors.Sensor
* @since 19
*/
function off(type: SensorId.WEAR_DETECTION, sensorInfoParam?: SensorInfoParam, callback?: Callback<WearDetectionResponse>): void;
/**
* Subscribe to sensor data, If the API is called multiple times, the last call takes effect.
* @permission ohos.permission.ACCELEROMETER
* @param { SensorType.SENSOR_TYPE_ID_ACCELEROMETER } type - Indicate the sensor type to listen for,
* {@code SensorType.SENSOR_TYPE_ID_ACCELEROMETER}.
* @param { Callback<AccelerometerResponse> } callback - callback accelerometer data.
* @param { Options } options - Optional parameters specifying the interval at which sensor data is reported, {@code Options}.
* @syscap SystemCapability.Sensors.Sensor
* @since 8
* @deprecated since 9
* @useinstead sensor.SensorId#ACCELEROMETER
*/
function on(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback: Callback<AccelerometerResponse>,
options?: Options): void;
/**
* Subscribe to sensor data, If the API is called multiple times, the last call takes effect.
* @permission ohos.permission.ACCELEROMETER
* @param { SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED } type - Indicate the sensor type to listen for,
* {@code SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED}.
* @param { Callback<AccelerometerUncalibratedResponse> } callback - callback accelerometer uncalibrated data.
* @param { Options } options - Optional parameters specifying the interval at which sensor data is reported, {@code Options}.
* @syscap SystemCapability.Sensors.Sensor
* @since 8
* @deprecated since 9
* @useinstead sensor.SensorId#ACCELEROMETER_UNCALIBRATED
*/
function on(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED, callback: Callback<AccelerometerUncalibratedResponse>,
options?: Options): void;
/**
* Subscribe to sensor data, If the API is called multiple times, the last call takes effect.
* @param { SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT } type - type Indicate the sensor type to listen for,
* {@code SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT}.
* @param { Callback<LightResponse> } callback - callback light data.
* @param { Options } options - options Optional parameters specifying the interval at which sensor data is reported, {@code Options}.
* @syscap SystemCapability.Sensors.Sensor
* @since 8
* @deprecated since 9
* @useinstead sensor.SensorId#AMBIENT_LIGHT
*/
function on(type: SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback: Callback<LightResponse>,
options?: Options): void;
/**
* Subscribe to sensor data, If the API is called multiple times, the last call takes effect.
* @param { SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE } type - type Indicate the sensor type to listen for,
* {@code SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE}.
* @param { Callback<AmbientTemperatureResponse> } callback - callback ambient temperature data.
* @param { Options } options - options Optional parameters specifying the interval at which sensor data is reported, {@code Options}.
* @syscap SystemCapability.Sensors.Sensor
* @since 8
* @deprecated since 9
* @useinstead sensor.SensorId#AMBIENT_TEMPERATURE
*/
function on(type: SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE, callback: Callback<AmbientTemperatureResponse>,
options?: Options): void;
/**
* Subscribe to sensor data, If the API is called multiple times, the last call takes effect.
* @param { SensorType.SENSOR_TYPE_ID_BAROMETER } type - type Indicate the sensor type to listen for,
* {@code SensorType.SENSOR_TYPE_ID_BAROMETER}.
* @param { Callback<BarometerResponse> } callback - callback barometer data.
* @param { Options } options - options Optional parameters specifying the interval at which sensor data is reported, {@code Options}.
* @syscap SystemCapability.Sensors.Sensor
* @since 8
* @deprecated since 9
* @useinstead sensor.SensorId#BAROMETER
*/
function on(type: SensorType.SENSOR_TYPE_ID_BAROMETER, callback: Callback<BarometerResponse>,
options?: Options): void;
/**
* Subscribe to sensor data, If the API is called multiple times, the last call takes effect.
* @param { SensorType.SENSOR_TYPE_ID_GRAVITY } type - type Indicate the sensor type to listen for,
* {@code SensorType.SENSOR_TYPE_ID_GRAVITY}.
* @param { Callback<GravityResponse> } callback - callback gravity data.
* @param { Options } options - options Optional parameters specifying the interval at which sensor data is reported, {@code Options}.
* @syscap SystemCapability.Sensors.Sensor
* @since 8
* @deprecated since 9
* @useinstead sensor.SensorId#GRAVITY
*/
function on(type: SensorType.SENSOR_TYPE_ID_GRAVITY, callback: Callback<GravityResponse>,
options?: Options): void;
/**
* Subscribe to sensor data, If the API is called multiple times, the last call takes effect.
* @permission ohos.permission.GYROSCOPE
* @param { SensorType.SENSOR_TYPE_ID_GYROSCOPE } type - type Indicate the sensor type to listen for,
* {@code SensorType.SENSOR_TYPE_ID_GYROSCOPE}.
* @param { Callback<GyroscopeResponse> } callback - callback gyroscope data.
* @param { Options } options - options Optional parameters specifying the interval at which sensor data is reported, {@code Options}.
* @syscap SystemCapability.Sensors.Sensor
* @since 8
* @deprecated since 9
* @useinstead sensor.SensorId#GYROSCOPE
*/
function on(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback: Callback<GyroscopeResponse>,
options?: Options): void;
/**
* Subscribe to sensor data, If the API is called multiple times, the last call takes effect.
* @permission ohos.permission.GYROSCOPE
* @param { SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED } type - type Indicate the sensor type to listen for,
* {@code SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED}.
* @param { Callback<GyroscopeUncalibratedResponse> } callback - callback gyroscope uncalibrated data.
* @param { Options } options - options Optional parameters specifying the interval at which sensor data is reported, {@code Options}.
* @syscap SystemCapability.Sensors.Sensor
* @since 8
* @deprecated since 9
* @useinstead sensor.SensorId#GYROSCOPE_UNCALIBRATED
*/
function on(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED, callback: Callback<GyroscopeUncalibratedResponse>,
options?: Options): void;
/**
* Subscribe to sensor data, If the API is called multiple times, the last call takes effect.
* @param { SensorType.SENSOR_TYPE_ID_HALL } type - type Indicate the sensor type to listen for,
* {@code SensorType.SENSOR_TYPE_ID_HALL}.
* @param { Callback<HallResponse> } callback - callback hall data.
* @param { Options } options - options Optional parameters specifying the interval at which sensor data is reported, {@code Options}.
* @syscap SystemCapability.Sensors.Sensor
* @since 8
* @deprecated since 9
* @useinstead sensor.SensorId#HALL
*/
function on(type: SensorType.SENSOR_TYPE_ID_HALL, callback: Callback<HallResponse>,
options?: Options): void;
/**
* Subscribe to sensor data, If the API is called multiple times, the last call takes effect.
* @permission ohos.permission.HEALTH_DATA
* @param { SensorType.SENSOR_TYPE_ID_HEART_RATE } type - type Indicate the sensor type to listen for,
* {@code SensorType.SENSOR_TYPE_ID_HEART_RATE}.
* @param { Callback<HeartRateResponse> } callback - callback heart rate data.
* @param { Options } options - options Optional parameters specifying the interval at which sensor data is reported, {@code Options}.
* @syscap SystemCapability.Sensors.Sensor
* @since 8
* @deprecated since 9
* @useinstead sensor.SensorId#HEART_RATE
*/
function on(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback: Callback<HeartRateResponse>,
options?: Options): void;
/**
* Subscribe to sensor data, If the API is called multiple times, the last call takes effect.
* @param { SensorType.SENSOR_TYPE_ID_HUMIDITY } type - type Indicate the sensor type to listen for,
* {@code SensorType.SENSOR_TYPE_ID_HUMIDITY}.
* @param { Callback<HumidityResponse> } callback - callback humidity data.
* @param { Options } options - options Optional parameters specifying the interval at which sensor data is reported, {@code Options}.
* @syscap SystemCapability.Sensors.Sensor
* @since 8
* @deprecated since 9
* @useinstead sensor.SensorId#HUMIDITY
*/
function on(type: SensorType.SENSOR_TYPE_ID_HUMIDITY, callback: Callback<HumidityResponse>,
options?: Options): void;
/**
* Subscribe to sensor data, If the API is called multiple times, the last call takes effect.
* @permission ohos.permission.ACCELEROMETER
* @param { SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION } type - type Indicate the sensor type to listen for,
* {@code SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION}.
* @param { Callback<LinearAccelerometerResponse> } callback - callback linear accelerometer data.
* @param { Options } options - options Optional parameters specifying the interval at which sensor data is reported, {@code Options}.
* @syscap SystemCapability.Sensors.Sensor
* @since 8
* @deprecated since 9
* @useinstead sensor.SensorId#LINEAR_ACCELEROMETER
*/
function on(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, callback: Callback<LinearAccelerometerResponse>,
options?: Options): void;
/**
* Subscribe to sensor data, If the API is called multiple times, the last call takes effect.
* @param { SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD } type - type Indicate the sensor type to listen for,
* {@code SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD}.
* @param { Callback<MagneticFieldResponse> } callback - callback magnetic field data.
* @param { Options } options - options Optional parameters specifying the interval at which sensor data is reported, {@code Options}.
* @syscap SystemCapability.Sensors.Sensor
* @since 8
* @deprecated since 9
* @useinstead sensor.SensorId#MAGNETIC_FIELD
*/
function on(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback: Callback<MagneticFieldResponse>,
options?: Options): void;
/**
* Subscribe to sensor data, If the API is called multiple times, the last call takes effect.
* @param { SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED } type - type Indicate the sensor type to listen for,
* {@code SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED}.
* @param { Callback<MagneticFieldUncalibratedResponse> } callback - callback magnetic field uncalibrated data.
* @param { Options } options - options Optional parameters specifying the interval at which sensor data is reported, {@code Options}.
* @syscap SystemCapability.Sensors.Sensor
* @since 8
* @deprecated since 9
* @useinstead sensor.SensorId#MAGNETIC_FIELD_UNCALIBRATED
*/
function on(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED, callback: Callback<MagneticFieldUncalibratedResponse>,
options?: Options): void;
/**
* Subscribe to sensor data, If the API is called multiple times, the last call takes effect.
* @param { SensorType.SENSOR_TYPE_ID_ORIENTATION } type - type Indicate the sensor type to listen for,
* {@code SensorType.SENSOR_TYPE_ID_ORIENTATION}.
* @param { Callback<OrientationResponse> } callback - callback orientation data.
* @param { Options } options - options Optional parameters specifying the interval at which sensor data is reported, {@code Options}.
* @syscap SystemCapability.Sensors.Sensor
* @since 8
* @deprecated since 9
* @useinstead sensor.SensorId#ORIENTATION
*/
function on(type: SensorType.SENSOR_TYPE_ID_ORIENTATION, callback: Callback<OrientationResponse>,
options?: Options): void;
/**
* Subscribe to sensor data, If the API is called multiple times, the last call takes effect.
* @permission ohos.permission.ACTIVITY_MOTION
* @param { SensorType.SENSOR_TYPE_ID_PEDOMETER } type - type Indicate the sensor type to listen for,
* {@code SensorType.SENSOR_TYPE_ID_PEDOMETER}.
* @param { Callback<PedometerResponse> } callback - callback pedometer data.
* @param { Options } options - options Optional parameters specifying the interval at which sensor data is reported, {@code Options}.
* @syscap SystemCapability.Sensors.Sensor
* @since 8
* @deprecated since 9
* @useinstead sensor.SensorId#PEDOMETER
*/
function on(type: SensorType.SENSOR_TYPE_ID_PEDOMETER, callback: Callback<PedometerResponse>,
options?: Options): void;
/**
* Subscribe to sensor data, If the API is called multiple times, the last call takes effect.
* @permission ohos.permission.ACTIVITY_MOTION
* @param { SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION } type - type Indicate the sensor type to listen for,
* {@code SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION}.
* @param { Callback<PedometerDetectionResponse> } callback - callback pedometer detection data.
* @param { Options } options - options Optional parameters specifying the interval at which sensor data is reported, {@code Options}.
* @syscap SystemCapability.Sensors.Sensor
* @since 8
* @deprecated since 9
* @useinstead sensor.SensorId#PEDOMETER_DETECTION
*/
function on(type: SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback: Callback<PedometerDetectionResponse>,
options?: Options): void;
/**
* Subscribe to sensor data, If the API is called multiple times, the last call takes effect.
* @param { SensorType.SENSOR_TYPE_ID_PROXIMITY } type - type Indicate the sensor type to listen for,
* {@code SensorType.SENSOR_TYPE_ID_PROXIMITY}.
* @param { Callback<ProximityResponse> } callback - callback proximity data.
* @param { Options } options - options Optional parameters specifying the interval at which sensor data is reported, {@code Options}.
* @syscap SystemCapability.Sensors.Sensor
* @since 8
* @deprecated since 9
* @useinstead sensor.SensorId#PROXIMITY
*/
function on(type: SensorType.SENSOR_TYPE_ID_PROXIMITY, callback: Callback<ProximityResponse>,
options?: Options): void;
/**
* Subscribe to sensor data, If the API is called multiple times, the last call takes effect.
* @param { SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR } type - type Indicate the sensor type to listen for,
* {@code SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR}.
* @param { Callback<RotationVectorResponse> } callback - callback rotation vector data.
* @param { Options } options - options Optional parameters specifying the interval at which sensor data is reported, {@code Options}.
* @syscap SystemCapability.Sensors.Sensor
* @since 8
* @deprecated since 9
* @useinstead sensor.SensorId#ROTATION_VECTOR
*/
function on(type: SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback: Callback<RotationVectorResponse>,
options?: Options): void;
/**
* Subscribe to sensor data, If the API is called multiple times, the last call takes effect.
* @param { SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION } type - type Indicate the sensor type to listen for,
* {@code SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION}.
* @param { Callback<SignificantMotionResponse> } callback - callback significant motion data.
* @param { Options } options - options Optional parameters specifying the interval at which sensor data is reported, {@code Options}.
* @syscap SystemCapability.Sensors.Sensor
* @since 8
* @deprecated since 9
* @useinstead sensor.SensorId#SIGNIFICANT_MOTION
*/
function on(type: SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, callback: Callback<SignificantMotionResponse>,
options?: Options): void;
/**
* Subscribe to sensor data, If the API is called multiple times, the last call takes effect.
* @param { SensorType.SENSOR_TYPE_ID_WEAR_DETECTION } type - type Indicate the sensor type to listen for,
* {@code SensorType.SENSOR_TYPE_ID_WEAR_DETECTION}.
* @param { Callback<WearDetectionResponse> } callback - callback wear detection data.
* @param { Options } options - options Optional parameters specifying the interval at which sensor data is reported, {@code Options}.
* @syscap SystemCapability.Sensors.Sensor
* @since 8
* @deprecated since 9
* @useinstead sensor.SensorId#WEAR_DETECTION
*/
function on(type: SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, callback: Callback<WearDetectionResponse>,
options?: Options): void;
/**
* Subscribe to sensor data once.
* @permission ohos.permission.ACCELEROMETER
* @param { SensorType.SENSOR_TYPE_ID_ACCELEROMETER } type - type Indicate the sensor type to listen for,
* {@code SensorType.SENSOR_TYPE_ID_ACCELEROMETER}.
* @param { Callback<AccelerometerResponse> } callback - callback accelerometer data.
* @syscap SystemCapability.Sensors.Sensor
* @since 8
* @deprecated since 9
* @useinstead sensor.SensorId#ACCELEROMETER
*/
function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback: Callback<AccelerometerResponse>): void;
/**
* Subscribe to sensor data once.
* @permission ohos.permission.ACCELEROMETER
* @param { SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED } type - type Indicate the sensor type to listen for,
* {@code SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED}.
* @param { Callback<AccelerometerUncalibratedResponse> } callback - callback accelerometer uncalibrated data.
* @syscap SystemCapability.Sensors.Sensor
* @since 8
* @deprecated since 9
* @useinstead sensor.SensorId#ACCELEROMETER_UNCALIBRATED
*/
function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED, callback: Callback<AccelerometerUncalibratedResponse>): void;
/**
* Subscribe to sensor data once.
* @param { SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT } type - type Indicate the sensor type to listen for,
* {@code SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT}.
* @param { Callback<LightResponse> } callback - callback light data.
* @syscap SystemCapability.Sensors.Sensor
* @since 8
* @deprecated since 9
* @useinstead sensor.SensorId#AMBIENT_LIGHT
*/
function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback: Callback<LightResponse>): void;
/**
* Subscribe to sensor data once.
* @param { SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE } type - type Indicate the sensor type to listen for,
* {@code SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE}.
* @param { Callback<AmbientTemperatureResponse> } callback - callback ambient temperature data.
* @syscap SystemCapability.Sensors.Sensor
* @since 8
* @deprecated since 9
* @useinstead sensor.SensorId#AMBIENT_TEMPERATURE
*/
function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE, callback: Callback<AmbientTemperatureResponse>): void;
/**
* Subscribe to sensor data once.
* @param { SensorType.SENSOR_TYPE_ID_BAROMETER } type - type Indicate the sensor type to listen for,
* {@code SensorType.SENSOR_TYPE_ID_BAROMETER}.
* @param { Callback<BarometerResponse> } callback - callback barometer data.
* @syscap SystemCapability.Sensors.Sensor
* @since 8
* @deprecated since 9
* @useinstead sensor.SensorId#BAROMETER
*/
function once(type: SensorType.SENSOR_TYPE_ID_BAROMETER, callback: Callback<BarometerResponse>): void;
/**
* Subscribe to sensor data once.
* @param { SensorType.SENSOR_TYPE_ID_GRAVITY } type - type Indicate the sensor type to listen for,
* {@code SensorType.SENSOR_TYPE_ID_GRAVITY}.
* @param { Callback<GravityResponse> } callback - callback gravity data.
* @syscap SystemCapability.Sensors.Sensor
* @since 8
* @deprecated since 9
* @useinstead sensor.SensorId#GRAVITY
*/
function once(type: SensorType.SENSOR_TYPE_ID_GRAVITY, callback: Callback<GravityResponse>): void;
/**
* Subscribe to sensor data once.
* @permission ohos.permission.GYROSCOPE
* @param { SensorType.SENSOR_TYPE_ID_GYROSCOPE } type - type Indicate the sensor type to listen for,
* {@code SensorType.SENSOR_TYPE_ID_GYROSCOPE}.
* @param { Callback<GyroscopeResponse> } callback - callback gyroscope data.
* @syscap SystemCapability.Sensors.Sensor
* @since 8
* @deprecated since 9
* @useinstead sensor.SensorId#GYROSCOPE
*/
function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback: Callback<GyroscopeResponse>): void;
/**
* Subscribe to sensor data once.
* @permission ohos.permission.GYROSCOPE
* @param { SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED } type - type Indicate the sensor type to listen for,
* {@code SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED}.
* @param { Callback<GyroscopeUncalibratedResponse> } callback - callback gyroscope uncalibrated data.
* @syscap SystemCapability.Sensors.Sensor
* @since 8
* @deprecated since 9
* @useinstead sensor.SensorId#GYROSCOPE_UNCALIBRATED
*/
function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED, callback: Callback<GyroscopeUncalibratedResponse>): void;
/**
* Subscribe to sensor data once.
* @param { SensorType.SENSOR_TYPE_ID_HALL } type - type Indicate the sensor type to listen for,
* {@code SensorType.SENSOR_TYPE_ID_HALL}.
* @param { Callback<HallResponse> } callback - callback hall data.
* @syscap SystemCapability.Sensors.Sensor
* @since 8
* @deprecated since 9
* @useinstead sensor.SensorId#HALL
*/
function once(type: SensorType.SENSOR_TYPE_ID_HALL, callback: Callback<HallResponse>): void;
/**
* Subscribe to sensor data once.
* @permission ohos.permission.HEART_RATE
* @param { SensorType.SENSOR_TYPE_ID_HEART_RATE } type - type Indicate the sensor type to listen for,
* {@code SensorType.SENSOR_TYPE_ID_HEART_RATE}.
* @param { Callback<HeartRateResponse> } callback - callback heart rate data.
* @syscap SystemCapability.Sensors.Sensor
* @since 8
* @deprecated since 9
* @useinstead sensor.SensorId#HEART_RATE
*/
function once(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback: Callback<HeartRateResponse>): void;
/**
* Subscribe to sensor data once.
* @param { SensorType.SENSOR_TYPE_ID_HUMIDITY } type - type Indicate the sensor type to listen for,
* {@code SensorType.SENSOR_TYPE_ID_HUMIDITY}.
* @param { Callback<HumidityResponse> } callback - callback humidity data.
* @syscap SystemCapability.Sensors.Sensor
* @since 8
* @deprecated since 9
* @useinstead sensor.SensorId#HUMIDITY
*/
function once(type: SensorType.SENSOR_TYPE_ID_HUMIDITY, callback: Callback<HumidityResponse>): void;
/**
* Subscribe to sensor data once.
* @permission ohos.permission.ACCELERATION
* @param { SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION } type - type Indicate the sensor type to listen for,
* {@code SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION}.
* @param { Callback<LinearAccelerometerResponse> } callback - callback linear accelerometer data.
* @syscap SystemCapability.Sensors.Sensor
* @since 8
* @deprecated since 9
* @useinstead sensor.SensorId#LINEAR_ACCELEROMETER
*/
function once(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, callback: Callback<LinearAccelerometerResponse>): void;
/**
* Subscribe to sensor data once.
* @param { SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD } type - type Indicate the sensor type to listen for,
* {@code SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD}.
* @param { Callback<MagneticFieldResponse> } callback - callback magnetic field data.
* @syscap SystemCapability.Sensors.Sensor
* @since 8
* @deprecated since 9
* @useinstead sensor.SensorId#MAGNETIC_FIELD
*/
function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback: Callback<MagneticFieldResponse>): void;
/**
* Subscribe to sensor data once.
* @param { SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED } type - type Indicate the sensor type to listen for,
* {@code SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED}.
* @param { Callback<MagneticFieldUncalibratedResponse> } callback - callback magnetic field uncalibrated data.
* @syscap SystemCapability.Sensors.Sensor
* @since 8
* @deprecated since 9
* @useinstead sensor.SensorId#MAGNETIC_FIELD_UNCALIBRATED
*/
function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED, callback: Callback<MagneticFieldUncalibratedResponse>): void;
/**
* Subscribe to sensor data once.
* @param { SensorType.SENSOR_TYPE_ID_ORIENTATION } type - type Indicate the sensor type to listen for,
* {@code SensorType.SENSOR_TYPE_ID_ORIENTATION}.
* @param { Callback<OrientationResponse> } callback - callback orientation data.
* @syscap SystemCapability.Sensors.Sensor
* @since 8
* @deprecated since 9
* @useinstead sensor.SensorId#ORIENTATION
*/
function once(type: SensorType.SENSOR_TYPE_ID_ORIENTATION, callback: Callback<OrientationResponse>): void;
/**
* Subscribe to sensor data once.
* @permission ohos.permission.ACTIVITY_MOTION
* @param { SensorType.SENSOR_TYPE_ID_PEDOMETER } type - type Indicate the sensor type to listen for,
* {@code SensorType.SENSOR_TYPE_ID_PEDOMETER}.
* @param { Callback<PedometerResponse> } callback - callback pedometer data.
* @syscap SystemCapability.Sensors.Sensor
* @since 8
* @deprecated since 9
* @useinstead sensor.SensorId#PEDOMETER
*/
function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER, callback: Callback<PedometerResponse>): void;
/**
* Subscribe to sensor data once.
* @permission ohos.permission.ACTIVITY_MOTION
* @param { SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION } type - type Indicate the sensor type to listen for,
* {@code SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION}.
* @param { Callback<PedometerDetectionResponse> } callback - callback pedometer detection data.
* @syscap SystemCapability.Sensors.Sensor
* @since 8
* @deprecated since 9
* @useinstead sensor.SensorId#PEDOMETER_DETECTION
*/
function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback: Callback<PedometerDetectionResponse>): void;
/**
* Subscribe to sensor data once.
* @param { SensorType.SENSOR_TYPE_ID_PROXIMITY } type - type Indicate the sensor type to listen for,
* {@code SensorType.SENSOR_TYPE_ID_PROXIMITY}.
* @param { Callback<ProximityResponse> } callback - callback proximity data.
* @syscap SystemCapability.Sensors.Sensor
* @since 8
* @deprecated since 9
* @useinstead sensor.SensorId#PROXIMITY
*/
function once(type: SensorType.SENSOR_TYPE_ID_PROXIMITY, callback: Callback<ProximityResponse>): void;
/**
* Subscribe to sensor data once.
* @param { SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR } type - type Indicate the sensor type to listen for,
* {@code SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR}.
* @param { Callback<RotationVectorResponse> } callback - callback rotation vector data.
* @syscap SystemCapability.Sensors.Sensor
* @since 8
* @deprecated since 9
* @useinstead sensor.SensorId#ROTATION_VECTOR
*/
function once(type: SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback: Callback<RotationVectorResponse>): void;
/**
* Subscribe to sensor data once.
* @param { SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION } type - type Indicate the sensor type to listen for,
* {@code SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION}.
* @param { Callback<SignificantMotionResponse> } callback - callback significant motion data.
* @syscap SystemCapability.Sensors.Sensor
* @since 8
* @deprecated since 9
* @useinstead sensor.SensorId#SIGNIFICANT_MOTION
*/
function once(type: SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, callback: Callback<SignificantMotionResponse>): void;
/**
* Subscribe to sensor data once.
* @param { SensorType.SENSOR_TYPE_ID_WEAR_DETECTION } type - type Indicate the sensor type to listen for,
* {@code SensorType.SENSOR_TYPE_ID_WEAR_DETECTION}.
* @param { Callback<WearDetectionResponse> } callback - callback wear detection data.
* @syscap SystemCapability.Sensors.Sensor
* @since 8
* @deprecated since 9
* @useinstead sensor.SensorId#WEAR_DETECTION
*/
function once(type: SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, callback: Callback<WearDetectionResponse>): void;
/**
* Unsubscribe to sensor data.
* @permission ohos.permission.ACCELEROMETER
* @param { SensorType.SENSOR_TYPE_ID_ACCELEROMETER } type - type Indicate the sensor type to unsubscribe,
* {@code SensorType.SENSOR_TYPE_ID_ACCELEROMETER}.
* @param { Callback<AccelerometerResponse> } callback - callback accelerometer data.
* @syscap SystemCapability.Sensors.Sensor
* @since 8
* @deprecated since 9
* @useinstead sensor.SensorId#ACCELEROMETER
*/
function off(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback?: Callback<AccelerometerResponse>): void;
/**
* Unsubscribe to sensor data.
* @permission ohos.permission.ACCELEROMETER
* @param { SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED } type - type Indicate the sensor type to unsubscribe,
* {@code SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED}.
* @param { Callback<AccelerometerUncalibratedResponse> } callback - callback accelerometer uncalibrated data.
* @syscap SystemCapability.Sensors.Sensor
* @since 8
* @deprecated since 9
* @useinstead sensor.SensorId#ACCELEROMETER_UNCALIBRATED
*/
function off(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED,
callback?: Callback<AccelerometerUncalibratedResponse>): void;
/**
* Unsubscribe to sensor data.
* @param { SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT } type - type Indicate the sensor type to unsubscribe,
* {@code SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT}.
* @param { Callback<LightResponse> } callback - callback light data.
* @syscap SystemCapability.Sensors.Sensor
* @since 8
* @deprecated since 9
* @useinstead sensor.SensorId#AMBIENT_LIGHT
*/
function off(type: SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback?: Callback<LightResponse>): void;
/**
* Unsubscribe to sensor data.
* @param { SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE } type - type Indicate the sensor type to unsubscribe,
* {@code SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE}.
* @param { Callback<AmbientTemperatureResponse> } callback - callback ambient temperature data.
* @syscap SystemCapability.Sensors.Sensor
* @since 8
* @deprecated since 9
* @useinstead sensor.SensorId#AMBIENT_TEMPERATURE
*/
function off(type: SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE, callback?: Callback<AmbientTemperatureResponse>): void;
/**
* Unsubscribe to sensor data.
* @param { SensorType.SENSOR_TYPE_ID_BAROMETER } type - type Indicate the sensor type to unsubscribe,
* {@code SensorType.SENSOR_TYPE_ID_BAROMETER}.
* @param { Callback<BarometerResponse> } callback - callback barometer response data.
* @syscap SystemCapability.Sensors.Sensor
* @since 8
* @deprecated since 9
* @useinstead sensor.SensorId#BAROMETER
*/
function off(type: SensorType.SENSOR_TYPE_ID_BAROMETER, callback?: Callback<BarometerResponse>): void;
/**
* Unsubscribe to sensor data.
* @param { SensorType.SENSOR_TYPE_ID_GRAVITY } type - type Indicate the sensor type to unsubscribe,
* {@code SensorType.SENSOR_TYPE_ID_GRAVITY}.
* @param { Callback<GravityResponse> } callback - callback gravity data.
* @syscap SystemCapability.Sensors.Sensor
* @since 8
* @deprecated since 9
* @useinstead sensor.SensorId#GRAVITY
*/
function off(type: SensorType.SENSOR_TYPE_ID_GRAVITY, callback?: Callback<GravityResponse>): void;
/**
* Unsubscribe to sensor data.
* @permission ohos.permission.GYROSCOPE
* @param { SensorType.SENSOR_TYPE_ID_GYROSCOPE } type - type Indicate the sensor type to unsubscribe,
* {@code SensorType.SENSOR_TYPE_ID_GYROSCOPE}.
* @param { Callback<GyroscopeResponse> } callback - callback gyroscope data.
* @syscap SystemCapability.Sensors.Sensor
* @since 8
* @deprecated since 9
* @useinstead sensor.SensorId#GYROSCOPE
*/
function off(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback?: Callback<GyroscopeResponse>): void;
/**
* Unsubscribe to sensor data.
* @permission ohos.permission.GYROSCOPE
* @param { SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED } type - type Indicate the sensor type to unsubscribe,
* {@code SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED}.
* @param { Callback<GyroscopeUncalibratedResponse> } callback - callback gyroscope uncalibrated data.
* @syscap SystemCapability.Sensors.Sensor
* @since 8
* @deprecated since 9
* @useinstead sensor.SensorId#GYROSCOPE_UNCALIBRATED
*/
function off(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED, callback?: Callback<GyroscopeUncalibratedResponse>): void;
/**
* Unsubscribe to sensor data.
* @param { SensorType.SENSOR_TYPE_ID_HALL } type - type Indicate the sensor type to unsubscribe,
* {@code SensorType.SENSOR_TYPE_ID_HALL}.
* @param { Callback<HallResponse> } callback - callback hall data.
* @syscap SystemCapability.Sensors.Sensor
* @since 8
* @deprecated since 9
* @useinstead sensor.SensorId#HALL
*/
function off(type: SensorType.SENSOR_TYPE_ID_HALL, callback?: Callback<HallResponse>): void;
/**
* Unsubscribe to sensor data.
* @permission ohos.permission.HEALTH_DATA
* @param { SensorType.SENSOR_TYPE_ID_HEART_RATE } type - type Indicate the sensor type to unsubscribe,
* {@code SensorType.SENSOR_TYPE_ID_HEART_RATE}.
* @param { Callback<HeartRateResponse> } callback - callback heart rate data.
* @syscap SystemCapability.Sensors.Sensor
* @since 8
* @deprecated since 9
* @useinstead sensor.SensorId#HEART_RATE
*/
function off(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback?: Callback<HeartRateResponse>): void;
/**
* Unsubscribe to sensor data.
* @param { SensorType.SENSOR_TYPE_ID_HUMIDITY } type - type Indicate the sensor type to unsubscribe,
* {@code SensorType.SENSOR_TYPE_ID_HUMIDITY}.
* @param { Callback<HumidityResponse> } callback - callback humidity data.
* @syscap SystemCapability.Sensors.Sensor
* @since 8
* @deprecated since 9
* @useinstead sensor.SensorId#HUMIDITY
*/
function off(type: SensorType.SENSOR_TYPE_ID_HUMIDITY, callback?: Callback<HumidityResponse>): void;
/**
* Unsubscribe to sensor data.
* @permission ohos.permission.ACCELEROMETER
* @param { SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION } type - type Indicate the sensor type to unsubscribe,
* {@code SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION}.
* @param { Callback<LinearAccelerometerResponse> } callback - callback linear accelerometer data.
* @syscap SystemCapability.Sensors.Sensor
* @since 8
* @deprecated since 9
* @useinstead sensor.SensorId#LINEAR_ACCELEROMETER
*/
function off(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, callback?: Callback<LinearAccelerometerResponse>): void;
/**
* Unsubscribe to sensor data.
* @param { SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD } type - type Indicate the sensor type to unsubscribe,
* {@code SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD}.
* @param { Callback<MagneticFieldResponse> } callback - callback magnetic field data.
* @syscap SystemCapability.Sensors.Sensor
* @since 8
* @deprecated since 9
* @useinstead sensor.SensorId#MAGNETIC_FIELD
*/
function off(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback?: Callback<MagneticFieldResponse>): void;
/**
* Unsubscribe to sensor data.
* @param { SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED } type - type Indicate the sensor type to unsubscribe,
* {@code SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED}.
* @param { Callback<MagneticFieldUncalibratedResponse> } callback - callback magnetic field uncalibrated data.
* @syscap SystemCapability.Sensors.Sensor
* @since 8
* @deprecated since 9
* @useinstead sensor.SensorId#MAGNETIC_FIELD_UNCALIBRATED
*/
function off(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED, callback?: Callback<MagneticFieldUncalibratedResponse>): void;
/**
* Unsubscribe to sensor data.
* @param { SensorType.SENSOR_TYPE_ID_ORIENTATION } type - type Indicate the sensor type to unsubscribe,
* {@code SensorType.SENSOR_TYPE_ID_ORIENTATION}.
* @param { Callback<OrientationResponse> } callback - callback orientation data.
* @syscap SystemCapability.Sensors.Sensor
* @since 8
* @deprecated since 9
* @useinstead sensor.SensorId#ORIENTATION
*/
function off(type: SensorType.SENSOR_TYPE_ID_ORIENTATION, callback?: Callback<OrientationResponse>): void;
/**
* Unsubscribe to sensor data.
* @permission ohos.permission.ACTIVITY_MOTION
* @param { SensorType.SENSOR_TYPE_ID_PEDOMETER } type - type Indicate the sensor type to unsubscribe, {@code SensorType.SENSOR_TYPE_ID_PEDOMETER}.
* @param { Callback<PedometerResponse> } callback - callback pedometer data.
* @syscap SystemCapability.Sensors.Sensor
* @since 8
* @deprecated since 9
* @useinstead sensor.SensorId#PEDOMETER
*/
function off(type: SensorType.SENSOR_TYPE_ID_PEDOMETER, callback?: Callback<PedometerResponse>): void;
/**
* Unsubscribe to sensor data.
* @permission ohos.permission.ACTIVITY_MOTION
* @param { SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION } type - type Indicate the sensor type to unsubscribe,
* {@code SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION}.
* @param { Callback<PedometerDetectionResponse> } callback - callback pedometer detection data.
* @syscap SystemCapability.Sensors.Sensor
* @since 8
* @deprecated since 9
* @useinstead sensor.SensorId#PEDOMETER_DETECTION
*/
function off(type: SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback?: Callback<PedometerDetectionResponse>): void;
/**
* Unsubscribe to sensor data.
* @param { SensorType.SENSOR_TYPE_ID_PROXIMITY } type - type Indicate the sensor type to unsubscribe,
* {@code SensorType.SENSOR_TYPE_ID_PROXIMITY}.
* @param { Callback<ProximityResponse> } callback - callback proximity data.
* @syscap SystemCapability.Sensors.Sensor
* @since 8
* @deprecated since 9
* @useinstead sensor.SensorId#PROXIMITY
*/
function off(type: SensorType.SENSOR_TYPE_ID_PROXIMITY, callback?: Callback<ProximityResponse>): void;
/**
* Unsubscribe to sensor data.
* @param { SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR } type - type Indicate the sensor type to unsubscribe,
* {@code SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR}.
* @param { Callback<RotationVectorResponse> } callback - callback rotation vector data.
* @syscap SystemCapability.Sensors.Sensor
* @since 8
* @deprecated since 9
* @useinstead sensor.SensorId#ROTATION_VECTOR
*/
function off(type: SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback?: Callback<RotationVectorResponse>): void;
/**
* Unsubscribe to sensor data.
* @param { SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION } type - type Indicate the sensor type to unsubscribe,
* {@code SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION}.
* @param { Callback<SignificantMotionResponse> } callback - callback significant motion data.
* @syscap SystemCapability.Sensors.Sensor
* @since 8
* @deprecated since 9
* @useinstead sensor.SensorId#SIGNIFICANT_MOTION
*/
function off(type: SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, callback?: Callback<SignificantMotionResponse>): void;
/**
* Unsubscribe to sensor data.
* @param { SensorType.SENSOR_TYPE_ID_WEAR_DETECTION } type - type Indicate the sensor type to unsubscribe,
* {@code SensorType.SENSOR_TYPE_ID_WEAR_DETECTION}.
* @param { Callback<WearDetectionResponse> } callback - callback wear detection data.
* @syscap SystemCapability.Sensors.Sensor
* @since 8
* @deprecated since 9
* @useinstead sensor.SensorId#WEAR_DETECTION
*/
function off(type: SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, callback?: Callback<WearDetectionResponse>): void;
/**
* Indicates sensor information.
* @typedef Sensor
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
interface Sensor {
/**
* Sensor name.
* @type { string }
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
sensorName:string;
/**
* Sensor vendor.
* @type { string }
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
vendorName:string;
/**
* Sensor firmware version.
* @type { string }
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
firmwareVersion:string;
/**
* Sensor hardware version.
* @type { string }
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
hardwareVersion:string;
/**
* Sensor type ID, {@code SensorType}.
* @type { number }
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
sensorId:number;
/**
* Maximum measurement range of the sensor.
* @type { number }
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
maxRange:number;
/**
* Minimum sample period allowed, in ns.
* @type { number }
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
minSamplePeriod:number;
/**
* Maximum sample period allowed, in ns.
* @type { number }
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
maxSamplePeriod:number;
/**
* Sensor accuracy.
* @type { number }
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
precision:number;
/**
* Sensor power.
* @type { number }
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
power:number;
/**
* Index of sensors of the same type.
* @type { ?number }
* @syscap SystemCapability.Sensors.Sensor
* @since 19
*/
sensorIndex?: number;
/**
* Device ID which the sensors attached.
* @type { ?number }
* @syscap SystemCapability.Sensors.Sensor
* @since 19
*/
deviceId?: number;
/**
* Name of the device.
*
* @type { ?string }
* @syscap SystemCapability.Sensors.Sensor
* @since 19
*/
deviceName?: string;
/**
* Is the device a local device or an external device
* @type { ?boolean }
* @syscap SystemCapability.Sensors.Sensor
* @since 19
*/
isLocalSensor?: boolean;
}
/**
* Obtains the sensor information of a specified type.
* @param { SensorId } type - Indicate the sensor type, {@code SensorId}.
* @param { AsyncCallback<Sensor> } callback - callback sensor info.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br> 2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception;
* <br> 2. Sensor service ipc exception;3. Sensor data channel exception.
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
/**
* Obtains the sensor information of a specified type.
* @param { SensorId } type - Indicate the sensor type, {@code SensorId}.
* @param { AsyncCallback<Sensor> } callback - callback sensor info.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br> 2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception;
* <br> 2. Sensor service ipc exception;3. Sensor data channel exception.
* @throws { BusinessError } 14500102 - The sensor is not supported by the device.
* @syscap SystemCapability.Sensors.Sensor
* @since 12
*/
function getSingleSensor(type: SensorId, callback: AsyncCallback<Sensor>): void;
/**
* Obtains the sensor information of a specified type.
* @param { SensorId } type - Indicate the sensor type, {@code SensorId}.
* @returns { Promise<Sensor> } Promise used to return the result.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br> 2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception;
* <br> 2. Sensor service ipc exception;3. Sensor data channel exception.
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
/**
* Obtains the sensor information of a specified type.
* @param { SensorId } type - Indicate the sensor type, {@code SensorId}.
* @returns { Promise<Sensor> } Promise used to return the result.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br> 2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception;
* <br> 2. Sensor service ipc exception;3. Sensor data channel exception.
* @throws { BusinessError } 14500102 - The sensor is not supported by the device.
* @syscap SystemCapability.Sensors.Sensor
* @since 12
*/
function getSingleSensor(type: SensorId): Promise<Sensor>;
/**
* Synchronously obtains the sensor information of a specified type.
* @param { SensorId } type - Indicate the sensor type, {@code SensorId}.
* @returns { Sensor } Returns sensor information.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br> 2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception;
* <br> 2. Sensor service ipc exception;3. Sensor data channel exception.
* @throws { BusinessError } 14500102 - The sensor is not supported by the device.
* @syscap SystemCapability.Sensors.Sensor
* @since 12
*/
function getSingleSensorSync(type: SensorId): Sensor;
/**
* Synchronously obtains the sensor information of the specified device and type.
* @param { SensorId } type - Indicate the sensor type, {@code SensorId}.
* @param { number } [deviceId] - Device ID which the sensors attached. If not specified, the local device will be used.
* @returns { Array<Sensor> } Returns sensor information.
* @syscap SystemCapability.Sensors.Sensor
* @since 19
*/
function getSingleSensorByDeviceSync(type: SensorId, deviceId?: number): Array<Sensor>;
/**
* Obtains all sensor information on the device.
* @param { AsyncCallback<Array<Sensor>> } callback - callback sensor list.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br> 2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception;
* <br> 2. Sensor service ipc exception;3. Sensor data channel exception.
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
function getSensorList(callback: AsyncCallback<Array<Sensor>>): void;
/**
* Obtains all sensor information on the device.
* @returns { Promise<Array<Sensor>> } Promise used to return the result.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br> 2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception;
* <br> 2. Sensor service ipc exception;3. Sensor data channel exception.
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
function getSensorList(): Promise<Array<Sensor>>;
/**
* Synchronously obtains all sensor information on the device.
* @returns { Array<Sensor> } Return a list of sensor information.
* @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception;
* <br> 2. Sensor service ipc exception;3. Sensor data channel exception.
* @syscap SystemCapability.Sensors.Sensor
* @since 12
*/
function getSensorListSync(): Array<Sensor>;
/**
* Synchronously obtains all sensor information on the device.
* @param { number } [deviceId] - Device ID which the sensors attached. If not specified, the local device will be used.
* @returns { Array<Sensor> } Return a list of sensor information.
* @syscap SystemCapability.Sensors.Sensor
* @since 19
*/
function getSensorListByDeviceSync(deviceId?: number): Array<Sensor>;
/**
* Indicates geomagnetic field data.
* @typedef GeomagneticResponse
* @syscap SystemCapability.Sensors.Sensor
* @since 8
*/
interface GeomagneticResponse {
/**
* Geomagnetic x-axis component.
* @type { number }
* @syscap SystemCapability.Sensors.Sensor
* @since 8
*/
x: number;
/**
* Geomagnetic y-axis component.
* @type { number }
* @syscap SystemCapability.Sensors.Sensor
* @since 8
*/
y: number;
/**
* Geomagnetic z-axis component.
* @type { number }
* @syscap SystemCapability.Sensors.Sensor
* @since 8
*/
z: number;
/**
* The Angle between the earth's magnetic field lines and the horizontal plane.
* @type { number }
* @syscap SystemCapability.Sensors.Sensor
* @since 8
*/
geomagneticDip: number;
/**
* The Angle of magnetic north and true north on a horizontal plane.
* @type { number }
* @syscap SystemCapability.Sensors.Sensor
* @since 8
*/
deflectionAngle: number;
/**
* The horizontal strength of the geomagnetic field.
* @type { number }
* @syscap SystemCapability.Sensors.Sensor
* @since 8
*/
levelIntensity: number;
/**
* The total strength of the geomagnetic field.
* @type { number }
* @syscap SystemCapability.Sensors.Sensor
* @since 8
*/
totalIntensity: number;
}
/**
* Indicates geographic location.
* @typedef LocationOptions
* @syscap SystemCapability.Sensors.Sensor
* @since 8
*/
interface LocationOptions {
/**
* Specifies the latitude of the point.
* @type { number }
* @syscap SystemCapability.Sensors.Sensor
* @since 8
*/
latitude: number;
/**
* Specifies the longitude of the point.
* @type { number }
* @syscap SystemCapability.Sensors.Sensor
* @since 8
*/
longitude: number;
/**
* Specifies the altitude of the point.
* @type { number }
* @syscap SystemCapability.Sensors.Sensor
* @since 8
*/
altitude: number;
}
/**
* Implements the calculation of the geomagnetic field at a specific location on Earth.
* @param { LocationOptions } locationOptions - Indicates geographic location, {@code LocationOptions}.
* @param { number } timeMillis - Indicates the time at which the magnetic declination is to be obtained,
* in milliseconds since the Unix epoch.
* @param { AsyncCallback<GeomagneticResponse> } callback - callback geomagnetic field.
* @syscap SystemCapability.Sensors.Sensor
* @since 8
* @deprecated since 9
* @useinstead sensor#getGeomagneticInfo
*/
function getGeomagneticField(locationOptions: LocationOptions, timeMillis: number, callback: AsyncCallback<GeomagneticResponse>): void;
/**
* Implements the calculation of the geomagnetic field at a specific location on Earth.
* @param { LocationOptions } locationOptions - LocationOptions Indicates geographic location, {@code LocationOptions}.
* @param { number } timeMillis - timeMillis Indicates the time at which the magnetic declination is to be obtained,
* in milliseconds since the Unix epoch.
* @returns { Promise<GeomagneticResponse> } Returns the geomagnetic field data, {@code GeomagneticResponse}.
* @syscap SystemCapability.Sensors.Sensor
* @since 8
* @deprecated since 9
* @useinstead sensor#getGeomagneticInfo
*/
function getGeomagneticField(locationOptions: LocationOptions, timeMillis: number): Promise<GeomagneticResponse>;
/**
* Obtains the geomagnetic field at a specific location on the Earth.
* @param { LocationOptions } locationOptions - LocationOptions Indicates geographic location, {@code LocationOptions}.
* @param { number } timeMillis - timeMillis Indicates the time at which the magnetic declination is to be obtained,
* in milliseconds since the Unix epoch.
* @param { AsyncCallback<GeomagneticResponse> } callback - callback geomagnetic field.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br> 2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception;
* <br> 2. Sensor service ipc exception;3. Sensor data channel exception.
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
function getGeomagneticInfo(locationOptions: LocationOptions, timeMillis: number, callback: AsyncCallback<GeomagneticResponse>): void;
/**
* Obtains the geomagnetic field at a specific location on the Earth.
* @param { LocationOptions } locationOptions - LocationOptions Indicates geographic location, {@code LocationOptions}.
* @param { number } timeMillis - timeMillis Indicates the time at which the magnetic declination is to be obtained,
* in milliseconds since the Unix epoch.
* @returns { Promise<GeomagneticResponse> } Promise used to return the result.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br> 2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception;
* <br> 2. Sensor service ipc exception;3. Sensor data channel exception.
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
function getGeomagneticInfo(locationOptions: LocationOptions, timeMillis: number): Promise<GeomagneticResponse>;
/**
* Obtains the altitude at which the device is located based on the current atmospheric pressure.
* @param { number } seaPressure - Indicates the sea level pressure, in hPa.
* @param { number } currentPressure - Indicates the atmospheric pressure measured by the barometer, in hPa.
* @param { AsyncCallback<number> } callback - callback device altitude.
* @syscap SystemCapability.Sensors.Sensor
* @since 8
* @deprecated since 9
* @useinstead sensor#getDeviceAltitude
*/
function getAltitude(seaPressure: number, currentPressure: number, callback: AsyncCallback<number>): void;
/**
* Obtains the altitude at which the device is located based on the current atmospheric pressure.
* @param { number } seaPressure - seaPressure Indicates the sea level pressure, in hPa.
* @param { number } currentPressure - currentPressure Indicates the atmospheric pressure measured by the barometer, in hPa.
* @returns { Promise<number> } Returns the altitude in meters at which the device is located.
* @syscap SystemCapability.Sensors.Sensor
* @since 8
* @deprecated since 9
* @useinstead sensor#getDeviceAltitude
*/
function getAltitude(seaPressure: number, currentPressure: number): Promise<number>;
/**
* Obtains the altitude at which the device is located based on the current atmospheric pressure.
* @param { number } seaPressure - seaPressure Indicates the sea level pressure, in hPa.
* @param { number } currentPressure - currentPressure Indicates the atmospheric pressure measured by the barometer, in hPa.
* @param { AsyncCallback<number> } callback - callback device altitude.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br> 2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception;
* <br> 2. Sensor service ipc exception;3. Sensor data channel exception.
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
function getDeviceAltitude(seaPressure: number, currentPressure: number, callback: AsyncCallback<number>): void;
/**
* Obtains the altitude at which the device is located based on the current atmospheric pressure.
* @param { number } seaPressure - seaPressure Indicates the sea level pressure, in hPa.
* @param { number } currentPressure - currentPressure Indicates the atmospheric pressure measured by the barometer, in hPa.
* @returns { Promise<number> } Promise used to return the result.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br> 2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception;
* <br> 2. Sensor service ipc exception;3. Sensor data channel exception.
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
function getDeviceAltitude(seaPressure: number, currentPressure: number): Promise<number>;
/**
* Computes the geomagnetic inclination angle in radians from the inclination matrix.
* @param { Array<number> } inclinationMatrix - Indicates the inclination matrix.
* @param { AsyncCallback<number> } callback - callback geomagnetic inclination data.
* @syscap SystemCapability.Sensors.Sensor
* @since 8
* @deprecated since 9
* @useinstead sensor#getInclination
*/
function getGeomagneticDip(inclinationMatrix: Array<number>, callback: AsyncCallback<number>): void;
/**
* Computes the geomagnetic inclination angle in radians from the inclination matrix.
* @param { Array<number> } inclinationMatrix - Indicates the inclination matrix.
* @returns { Promise<number> } Returns the geomagnetic inclination angle in radians.
* @syscap SystemCapability.Sensors.Sensor
* @since 8
* @deprecated since 9
* @useinstead sensor#getInclination
*/
function getGeomagneticDip(inclinationMatrix: Array<number>): Promise<number>;
/**
* Computes the geomagnetic inclination in radians from the inclination matrix.
* @param { Array<number> } inclinationMatrix - Indicates the inclination matrix.
* @param { AsyncCallback<number> } callback - callback inclination in radians.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br> 2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception;
* <br> 2. Sensor service ipc exception;3. Sensor data channel exception.
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
function getInclination(inclinationMatrix: Array<number>, callback: AsyncCallback<number>): void;
/**
* Computes the geomagnetic inclination in radians from the inclination matrix.
* @param { Array<number> } inclinationMatrix - Indicates the inclination matrix.
* @returns { Promise<number> } Promise used to return the result.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br> 2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception;
* <br> 2. Sensor service ipc exception;3. Sensor data channel exception.
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
function getInclination(inclinationMatrix: Array<number>): Promise<number>;
/**
* Get the angle change between two rotation matrices.
* @param { Array<number> } currentRotationMatrix - Indicates the current rotation matrix.
* @param { Array<number> } preRotationMatrix - Indicates the current rotation matrix.
* @param { AsyncCallback<Array<number>> } callback - callback angle variation.
* @syscap SystemCapability.Sensors.Sensor
* @since 8
* @deprecated since 9
* @useinstead sensor#getAngleVariation
*/
function getAngleModify(currentRotationMatrix: Array<number>, preRotationMatrix: Array<number>,
callback: AsyncCallback<Array<number>>): void;
/**
* Get the angle change between two rotation matrices.
* @param { Array<number> } currentRotationMatrix - currentRotationMatrix Indicates the current rotation matrix.
* @param { Array<number> } preRotationMatrix - preRotationMatrix Indicates the current rotation matrix.
* @returns { Promise<Array<number>> } Returns the array of number(z, x and y) in which the angle variety.
* @syscap SystemCapability.Sensors.Sensor
* @since 8
* @deprecated since 9
* @useinstead sensor#getAngleVariation
*/
function getAngleModify(currentRotationMatrix: Array<number>, preRotationMatrix: Array<number>): Promise<Array<number>>;
/**
* Get the angle variation between two rotation matrices.
* @param { Array<number> } currentRotationMatrix - currentRotationMatrix Indicates the current rotation matrix.
* @param { Array<number> } preRotationMatrix - preRotationMatrix Indicates the current rotation matrix.
* @param { AsyncCallback<Array<number>> } callback - callback angle variation.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br> 2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception;
* <br> 2. Sensor service ipc exception;3. Sensor data channel exception.
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
function getAngleVariation(currentRotationMatrix: Array<number>, preRotationMatrix: Array<number>,
callback: AsyncCallback<Array<number>>): void;
/**
* Get the angle variation between two rotation matrices.
* @param { Array<number> } currentRotationMatrix - Indicates the current rotation matrix.
* @param { Array<number> } preRotationMatrix - preRotationMatrix Indicates the current rotation matrix.
* @returns { Promise<Array<number>> } Promise used to return the result.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br> 2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception;
* <br> 2. Sensor service ipc exception;3. Sensor data channel exception.
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
function getAngleVariation(currentRotationMatrix: Array<number>, preRotationMatrix: Array<number>): Promise<Array<number>>;
/**
* Convert rotation vector to rotation matrix.
* @param { Array<number> } rotationVector - Indicates the rotation vector.
* @param { AsyncCallback<Array<number>> } callback - callback rotation matrix.
* @syscap SystemCapability.Sensors.Sensor
* @since 8
* @deprecated since 9
* @useinstead sensor#getRotationMatrix
*/
function createRotationMatrix(rotationVector: Array<number>, callback: AsyncCallback<Array<number>>): void;
/**
* Convert rotation vector to rotation matrix.
* @param { Array<number> } rotationVector - rotationVector Indicates the rotation vector.
* @returns { Promise<Array<number>> } Returns the rotation matrix.
* @syscap SystemCapability.Sensors.Sensor
* @since 8
* @deprecated since 9
* @useinstead sensor#getRotationMatrix
*/
function createRotationMatrix(rotationVector: Array<number>): Promise<Array<number>>;
/**
* Convert rotation vector to rotation matrix.
* @param { Array<number> } rotationVector - rotationVector Indicates the rotation vector.
* @param { AsyncCallback<Array<number>> } callback - callback rotation matrix.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br> 2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception;
* <br> 2. Sensor service ipc exception;3. Sensor data channel exception.
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
function getRotationMatrix(rotationVector: Array<number>, callback: AsyncCallback<Array<number>>): void;
/**
* Convert rotation vector to rotation matrix.
* @param { Array<number> } rotationVector - rotationVector Indicates the rotation vector.
* @returns { Promise<Array<number>> } Promise used to return the result.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br> 2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception;
* <br> 2. Sensor service ipc exception;3. Sensor data channel exception.
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
function getRotationMatrix(rotationVector: Array<number>): Promise<Array<number>>;
/**
* Indicates the axis of the new coordinate system that coincides with the XY axis of the original coordinate system.
* @typedef CoordinatesOptions
* @syscap SystemCapability.Sensors.Sensor
* @since 8
*/
interface CoordinatesOptions {
/** Indicates the axis of the new coordinate system that coincides with the X axis of the original coordinate system.
* @type { number }
* @syscap SystemCapability.Sensors.Sensor
* @since 8
*/
x: number;
/** Indicates the axis of the new coordinate system that coincides with the Y axis of the original coordinate system.
* @type { number }
* @syscap SystemCapability.Sensors.Sensor
* @since 8
*/
y: number;
}
/**
* Rotate the provided rotation matrix so that it can be represented in a different way Coordinate System.
* @param { Array<number> } inRotationVector - Indicates the rotation matrix to be transformed.
* @param { CoordinatesOptions } coordinates - Indicates coordinate system guidance, {@code CoordinatesOptions}.
* @param { AsyncCallback<Array<number>> } callback - callback rotation matrix.
* @syscap SystemCapability.Sensors.Sensor
* @since 8
* @deprecated since 9
* @useinstead sensor#transformRotationMatrix
*/
function transformCoordinateSystem(inRotationVector: Array<number>, coordinates: CoordinatesOptions,
callback: AsyncCallback<Array<number>>): void;
/**
* Rotate the provided rotation matrix so that it can be represented in a different way Coordinate System.
* @param { Array<number> } inRotationVector - inRotationVector Indicates the rotation matrix to be transformed.
* @param { CoordinatesOptions } coordinates - coordinates Indicates coordinate system guidance, {@code CoordinatesOptions}.
* @returns { Promise<Array<number>> } Returns the transformed rotation matrix.
* @syscap SystemCapability.Sensors.Sensor
* @since 8
* @deprecated since 9
* @useinstead sensor#transformRotationMatrix
*/
function transformCoordinateSystem(inRotationVector: Array<number>, coordinates: CoordinatesOptions): Promise<Array<number>>;
/**
* Rotate the provided rotation matrix so that it can be represented in a different way coordinate System.
* @param { Array<number> } inRotationVector - inRotationVector Indicates the rotation matrix to be transformed.
* @param { CoordinatesOptions } coordinates - coordinates Indicates coordinate system guidance, {@code CoordinatesOptions}.
* @param { AsyncCallback<Array<number>> } callback - callback rotation matrix.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br> 2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception;
* <br> 2. Sensor service ipc exception;3. Sensor data channel exception.
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
function transformRotationMatrix(inRotationVector: Array<number>, coordinates: CoordinatesOptions,
callback: AsyncCallback<Array<number>>): void;
/**
* Rotate the provided rotation matrix so that it can be represented in a different way coordinate System.
* @param { Array<number> } inRotationVector - inRotationVector Indicates the rotation matrix to be transformed.
* @param { CoordinatesOptions } coordinates - coordinates Indicates coordinate system guidance, {@code CoordinatesOptions}.
* @returns { Promise<Array<number>> } Promise used to return the result.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br> 2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception;
* <br> 2. Sensor service ipc exception;3. Sensor data channel exception.
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
function transformRotationMatrix(inRotationVector: Array<number>, coordinates: CoordinatesOptions): Promise<Array<number>>;
/**
* convert a rotation vector to a normalized quaternion.
* @param { Array<number> } rotationVector - Indicates the rotation vector.
* @param { AsyncCallback<Array<number>> } callback - callback a normalized quaternion.
* @syscap SystemCapability.Sensors.Sensor
* @since 8
* @deprecated since 9
* @useinstead sensor#getQuaternion
*/
function createQuaternion(rotationVector: Array<number>, callback: AsyncCallback<Array<number>>): void;
/**
* convert a rotation vector to a normalized quaternion.
* @param { Array<number> } rotationVector - rotationVector Indicates the rotation vector.
* @returns { Promise<Array<number>> } Returns the normalized quaternion.
* @syscap SystemCapability.Sensors.Sensor
* @since 8
* @deprecated since 9
* @useinstead sensor#getQuaternion
*/
function createQuaternion(rotationVector: Array<number>): Promise<Array<number>>;
/**
* convert a rotation vector to a normalized quaternion.
* @param { Array<number> } rotationVector - rotationVector Indicates the rotation vector.
* @param { AsyncCallback<Array<number>> } callback - callback a normalized quaternion.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br> 2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception;
* <br> 2. Sensor service ipc exception;3. Sensor data channel exception.
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
function getQuaternion(rotationVector: Array<number>, callback: AsyncCallback<Array<number>>): void;
/**
* convert a rotation vector to a normalized quaternion.
* @param { Array<number> } rotationVector - rotationVector Indicates the rotation vector.
* @returns { Promise<Array<number>> } Promise used to return the result.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br> 2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception;
* <br> 2. Sensor service ipc exception;3. Sensor data channel exception.
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
function getQuaternion(rotationVector: Array<number>): Promise<Array<number>>;
/**
* Computes the device's orientation based on the rotation matrix.
* @param { Array<number> } rotationMatrix - Indicates the rotation matrix.
* @param { AsyncCallback<Array<number>> } callback - callback the angle of rotation around the z, x, y axis.
* @syscap SystemCapability.Sensors.Sensor
* @since 8
* @deprecated since 9
* @useinstead sensor#getOrientation
*/
function getDirection(rotationMatrix: Array<number>, callback: AsyncCallback<Array<number>>): void;
/**
* Computes the device's orientation based on the rotation matrix.
* @param { Array<number> } rotationMatrix - rotationMatrix Indicates the rotation matrix.
* @returns { Promise<Array<number>> } Returns the array is the angle of rotation around the z, x, y axis.
* @syscap SystemCapability.Sensors.Sensor
* @since 8
* @deprecated since 9
* @useinstead sensor#getOrientation
*/
function getDirection(rotationMatrix: Array<number>): Promise<Array<number>>;
/**
* Computes the device's orientation based on the rotation matrix.
* @param { Array<number> } rotationMatrix - rotationMatrix Indicates the rotation matrix.
* @param { AsyncCallback<Array<number>> } callback - callback the angle of rotation around the z, x, y axis.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br> 2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception;
* <br> 2. Sensor service ipc exception;3. Sensor data channel exception.
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
function getOrientation(rotationMatrix: Array<number>, callback: AsyncCallback<Array<number>>): void;
/**
* Computes the device's orientation based on the rotation matrix.
* @param { Array<number> } rotationMatrix - rotationMatrix Indicates the rotation matrix.
* @returns { Promise<Array<number>> } Promise used to return the result.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br> 2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception;
* <br> 2. Sensor service ipc exception;3. Sensor data channel exception.
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
function getOrientation(rotationMatrix: Array<number>): Promise<Array<number>>;
/**
* Indicates the response of rotation matrix.
* @typedef RotationMatrixResponse
* @syscap SystemCapability.Sensors.Sensor
* @since 8
*/
interface RotationMatrixResponse {
/**
* rotation matrix.
* @type { Array<number> }
* @syscap SystemCapability.Sensors.Sensor
* @since 8
*/
rotation: Array<number>;
/**
* inclination matrix.
* @type { Array<number> }
* @syscap SystemCapability.Sensors.Sensor
* @since 8
*/
inclination: Array<number>
}
/**
* Calculate rotation matrix based on gravity vector and geomagnetic vector.
* @param { Array<number> } gravity - Indicates the gravity vector.
* @param { Array<number> } geomagnetic - Indicates the geomagnetic vector.
* @param { AsyncCallback<RotationMatrixResponse> } callback - callback rotation matrix and inclination matrix.
* @syscap SystemCapability.Sensors.Sensor
* @since 8
* @deprecated since 9
* @useinstead sensor#getRotationMatrix
*/
function createRotationMatrix(gravity: Array<number>, geomagnetic: Array<number>, callback: AsyncCallback<RotationMatrixResponse>): void;
/**
* Calculate rotation matrix based on gravity vector and geomagnetic vector.
* @param { Array<number> } gravity - gravity Indicates the gravity vector.
* @param { Array<number> } geomagnetic - geomagnetic Indicates the geomagnetic vector.
* @returns { Promise<RotationMatrixResponse> } Returns the rotation matrix, {@code RotationMatrixResponse}.
* @syscap SystemCapability.Sensors.Sensor
* @since 8
* @deprecated since 9
* @useinstead sensor#getRotationMatrix
*/
function createRotationMatrix(gravity: Array<number>, geomagnetic: Array<number>,): Promise<RotationMatrixResponse>;
/**
* Calculate rotation matrix based on gravity vector and geomagnetic vector.
* @param { Array<number> } gravity - gravity Indicates the gravity vector.
* @param { Array<number> } geomagnetic - geomagnetic Indicates the geomagnetic vector.
* @param { AsyncCallback<RotationMatrixResponse> } callback - callback rotation matrix and inclination matrix.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br> 2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception;
* <br> 2. Sensor service ipc exception;3. Sensor data channel exception.
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
function getRotationMatrix(gravity: Array<number>, geomagnetic: Array<number>, callback: AsyncCallback<RotationMatrixResponse>): void;
/**
* Calculate rotation matrix based on gravity vector and geomagnetic vector.
* @param { Array<number> } gravity - gravity Indicates the gravity vector.
* @param { Array<number> } geomagnetic - geomagnetic Indicates the geomagnetic vector.
* @returns { Promise<RotationMatrixResponse> } Promise used to return the result.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* <br> 2. Incorrect parameter types; 3. Parameter verification failed.
* @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception;
* <br> 2. Sensor service ipc exception;3. Sensor data channel exception.
* @syscap SystemCapability.Sensors.Sensor
* @since 9
*/
function getRotationMatrix(gravity: Array<number>, geomagnetic: Array<number>): Promise<RotationMatrixResponse>;
/**
* Subscribe to the sensor's optional parameters.
* @typedef Options
* @syscap SystemCapability.Sensors.Sensor
* @since 8
*/
/**
* Subscribe to the sensor's optional parameters.
* @typedef Options
* @syscap SystemCapability.Sensors.Sensor
* @atomicservice
* @since arkts {'1.1':'11', '1.2':'20'}
* @arkts 1.1&1.2
*/
interface Options {
/**
* Sensor event reporting event interval.
* @type { ?number }
* @syscap SystemCapability.Sensors.Sensor
* @since 8
*/
/**
* Sensor event reporting event interval.
* @type { ?(number | SensorFrequency) }
* @syscap SystemCapability.Sensors.Sensor
* @atomicservice
* @since arkts {'1.1':'11', '1.2':'20'}
* @arkts 1.1&1.2
*/
interval?: number | SensorFrequency;
/**
* Parameters of sensor on the device.
* @type { ?SensorInfoParam }
* @syscap SystemCapability.Sensors.Sensor
* @atomicservice
* @since 19
*/
sensorInfoParam?: SensorInfoParam;
}
/**
* The sensor reporting frequency is divided into three modes.
* @typedef {'game' | 'ui' | 'normal'}
* @syscap SystemCapability.Sensors.Sensor
* @atomicservice
* @since arkts {'1.1':'11', '1.2':'20'}
* @arkts 1.1&1.2
*/
type SensorFrequency = 'game' | 'ui' | 'normal';
/**
* The type of number.
* @enum { number }
* @syscap SystemCapability.Sensors.Sensor
* @since 8
* @deprecated since 9
* @useinstead sensor.SensorId
*/
enum SensorType {
/**
* Acceleration sensor.
* @syscap SystemCapability.Sensors.Sensor
* @since 8
* @deprecated since 9
*/
SENSOR_TYPE_ID_ACCELEROMETER = 1,
/**
* Gyroscope sensor.
* @syscap SystemCapability.Sensors.Sensor
* @since 8
* @deprecated since 9
*/
SENSOR_TYPE_ID_GYROSCOPE = 2,
/**
* Ambient light sensor.
* @syscap SystemCapability.Sensors.Sensor
* @since 8
* @deprecated since 9
*/
SENSOR_TYPE_ID_AMBIENT_LIGHT = 5,
/**
* Magnetic field sensor.
* @syscap SystemCapability.Sensors.Sensor
* @since 8
* @deprecated since 9
*/
SENSOR_TYPE_ID_MAGNETIC_FIELD = 6,
/**
* Barometric pressure sensor.
* @syscap SystemCapability.Sensors.Sensor
* @since 8
* @deprecated since 9
*/
SENSOR_TYPE_ID_BAROMETER = 8,
/**
* Hall effect sensor.
* @syscap SystemCapability.Sensors.Sensor
* @since 8
* @deprecated since 9
*/
SENSOR_TYPE_ID_HALL = 10,
/**
* Proximity sensor.
* @syscap SystemCapability.Sensors.Sensor
* @since 8
* @deprecated since 9
*/
SENSOR_TYPE_ID_PROXIMITY = 12,
/**
* Humidity sensor.
* @syscap SystemCapability.Sensors.Sensor
* @since 8
* @deprecated since 9
*/
SENSOR_TYPE_ID_HUMIDITY = 13,
/**
* Orientation sensor.
* @syscap SystemCapability.Sensors.Sensor
* @since 8
* @deprecated since 9
*/
SENSOR_TYPE_ID_ORIENTATION = 256,
/**
* Gravity sensor.
* @syscap SystemCapability.Sensors.Sensor
* @since 8
* @deprecated since 9
*/
SENSOR_TYPE_ID_GRAVITY = 257,
/**
* Linear acceleration sensor.
* @syscap SystemCapability.Sensors.Sensor
* @since 8
* @deprecated since 9
*/
SENSOR_TYPE_ID_LINEAR_ACCELERATION = 258,
/**
* Rotation vector sensor.
* @syscap SystemCapability.Sensors.Sensor
* @since 8
* @deprecated since 9
*/
SENSOR_TYPE_ID_ROTATION_VECTOR = 259,
/**
* Ambient temperature sensor.
* @syscap SystemCapability.Sensors.Sensor
* @since 8
* @deprecated since 9
*/
SENSOR_TYPE_ID_AMBIENT_TEMPERATURE = 260,
/**
* Uncalibrated magnetic field sensor.
* @syscap SystemCapability.Sensors.Sensor
* @since 8
* @deprecated since 9
*/
SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED = 261,
/**
* Uncalibrated gyroscope sensor.
* @syscap SystemCapability.Sensors.Sensor
* @since 8
* @deprecated since 9
*/
SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED = 263,
/**
* Significant motion sensor.
* @syscap SystemCapability.Sensors.Sensor
* @since 8
* @deprecated since 9
*/
SENSOR_TYPE_ID_SIGNIFICANT_MOTION = 264,
/**
* Pedometer detection sensor.
* @syscap SystemCapability.Sensors.Sensor
* @since 8
* @deprecated since 9
*/
SENSOR_TYPE_ID_PEDOMETER_DETECTION = 265,
/**
* Pedometer sensor.
* @syscap SystemCapability.Sensors.Sensor
* @since 8
* @deprecated since 9
*/
SENSOR_TYPE_ID_PEDOMETER = 266,
/**
* Heart rate sensor.
* @syscap SystemCapability.Sensors.Sensor
* @since 8
* @deprecated since 9
*/
SENSOR_TYPE_ID_HEART_RATE = 278,
/**
* Wear detection sensor.
* @syscap SystemCapability.Sensors.Sensor
* @since 8
* @deprecated since 9
*/
SENSOR_TYPE_ID_WEAR_DETECTION = 280,
/**
* Uncalibrated acceleration sensor.
* @syscap SystemCapability.Sensors.Sensor
* @since 8
* @deprecated since 9
*/
SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED = 281
}
/**
* Enumerates the accuracy levels of data reported by a sensor.
* @enum { number }
* @syscap SystemCapability.Sensors.Sensor
* @atomicservice
* @since arkts {'1.1':'11', '1.2':'20'}
* @arkts 1.1&1.2
*/
enum SensorAccuracy {
/**
* The sensor data is unreliable. It is possible that the sensor does not contact with the device to measure.
* @syscap SystemCapability.Sensors.Sensor
* @atomicservice
* @since arkts {'1.1':'11', '1.2':'20'}
* @arkts 1.1&1.2
*/
ACCURACY_UNRELIABLE = 0,
/**
* The sensor data is at a low accuracy level. The data must be calibrated based on the environment before being used.
* @syscap SystemCapability.Sensors.Sensor
* @atomicservice
* @since arkts {'1.1':'11', '1.2':'20'}
* @arkts 1.1&1.2
*/
ACCURACY_LOW = 1,
/**
* The sensor data is at a medium accuracy level. You are advised to calibrate the data based on the environment before using it.
* @syscap SystemCapability.Sensors.Sensor
* @atomicservice
* @since arkts {'1.1':'11', '1.2':'20'}
* @arkts 1.1&1.2
*/
ACCURACY_MEDIUM = 2,
/**
* The sensor data is at a high accuracy level. The data can be used directly.
* @syscap SystemCapability.Sensors.Sensor
* @atomicservice
* @since arkts {'1.1':'11', '1.2':'20'}
* @arkts 1.1&1.2
*/
ACCURACY_HIGH = 3
}
/**
* The basic data structure of the sensor event.
* @typedef Response
* @syscap SystemCapability.Sensors.Sensor
* @since 8
*/
/**
* The basic data structure of the sensor event.
* @typedef Response
* @syscap SystemCapability.Sensors.Sensor
* @atomicservice
* @since arkts {'1.1':'11', '1.2':'20'}
* @arkts 1.1&1.2
*/
interface Response {
/**
* The timestamp of the reported sensor data.
* @type { number }
* @syscap SystemCapability.Sensors.Sensor
* @since 8
*/
/**
* The timestamp of the reported sensor data.
* @type { number }
* @syscap SystemCapability.Sensors.Sensor
* @atomicservice
* @since arkts {'1.1':'11', '1.2':'20'}
* @arkts 1.1&1.2
*/
timestamp: number;
/**
* The accuracy levels of data reported by a sensor.
* @type { SensorAccuracy }
* @syscap SystemCapability.Sensors.Sensor
* @atomicservice
* @since arkts {'1.1':'11', '1.2':'20'}
* @arkts 1.1&1.2
*/
accuracy: SensorAccuracy;
}
/**
* Acceleration sensor event data.
* @typedef AccelerometerResponse
* @syscap SystemCapability.Sensors.Sensor
* @since 8
*/
/**
* Acceleration sensor event data.
* @typedef AccelerometerResponse
* @syscap SystemCapability.Sensors.Sensor
* @atomicservice
* @since 11
*/
interface AccelerometerResponse extends Response {
/**
* Acceleration x-axis component.
* @type { number }
* @syscap SystemCapability.Sensors.Sensor
* @since 8
*/
/**
* Acceleration x-axis component.
* @type { number }
* @syscap SystemCapability.Sensors.Sensor
* @atomicservice
* @since 11
*/
x: number;
/**
* Acceleration y-axis component.
* @type { number }
* @syscap SystemCapability.Sensors.Sensor
* @since 8
*/
/**
* Acceleration y-axis component.
* @type { number }
* @syscap SystemCapability.Sensors.Sensor
* @atomicservice
* @since 11
*/
y: number;
/**
* Acceleration z-axis component
* @type { number }
* @syscap SystemCapability.Sensors.Sensor
* @since 8
*/
/**
* Acceleration z-axis component
* @type { number }
* @syscap SystemCapability.Sensors.Sensor
* @atomicservice
* @since 11
*/
z: number;
}
/**
* Linear acceleration sensor event data.
* @typedef LinearAccelerometerResponse
* @syscap SystemCapability.Sensors.Sensor
* @since 8
*/
interface LinearAccelerometerResponse extends Response {
/**
* Linear acceleration x-axis component.
* @type { number }
* @syscap SystemCapability.Sensors.Sensor
* @since 8
*/
x: number;
/**
* Linear acceleration y-axis component.
* @type { number }
* @syscap SystemCapability.Sensors.Sensor
* @since 8
*/
y: number;
/**
* Linear acceleration z-axis component.
* @type { number }
* @syscap SystemCapability.Sensors.Sensor
* @since 8
*/
z: number;
}
/**
* Acceleration uncalibrated sensor event data.
* @typedef AccelerometerUncalibratedResponse
* @syscap SystemCapability.Sensors.Sensor
* @since 8
*/
interface AccelerometerUncalibratedResponse extends Response {
/**
* Acceleration uncalibrated x-axis component.
* @type { number }
* @syscap SystemCapability.Sensors.Sensor
* @since 8
*/
x: number;
/**
* Acceleration uncalibrated y-axis component.
* @type { number }
* @syscap SystemCapability.Sensors.Sensor
* @since 8
*/
y: number;
/**
* Acceleration uncalibrated z-axis component.
* @type { number }
* @syscap SystemCapability.Sensors.Sensor
* @since 8
*/
z: number;
/**
* Acceleration uncalibrated x-axis offset.
*
* @type { number }
* @syscap SystemCapability.Sensors.Sensor
* @since 8
*/
biasX: number;
/**
* Acceleration uncalibrated y-axis offset.
*
* @type { number }
* @syscap SystemCapability.Sensors.Sensor
* @since 8
*/
biasY: number;
/**
* Acceleration uncalibrated z-axis offset.
*
* @type { number }
* @syscap SystemCapability.Sensors.Sensor
* @since 8
*/
biasZ: number;
}
/**
* Gravity sensor event data.
* @typedef GravityResponse
* @syscap SystemCapability.Sensors.Sensor
* @since 8
*/
interface GravityResponse extends Response {
/**
* Gravity x-axis component.
* @type { number }
* @syscap SystemCapability.Sensors.Sensor
* @since 8
*/
x: number;
/**
* Gravity y-axis component.
* @type { number }
* @syscap SystemCapability.Sensors.Sensor
* @since 8
*/
y: number;
/**
* Gravity z-axis component.
* @type { number }
* @syscap SystemCapability.Sensors.Sensor
* @since 8
*/
z: number;
}
/**
* Orientation sensor event data.
* @typedef OrientationResponse
* @syscap SystemCapability.Sensors.Sensor
* @since 8
*/
/**
* Orientation sensor event data.
* @typedef OrientationResponse
* @syscap SystemCapability.Sensors.Sensor
* @atomicservice
* @since arkts {'1.1':'11', '1.2':'20'}
* @arkts 1.1&1.2
*/
interface OrientationResponse extends Response {
/**
* The device rotates at an angle around the Z axis.
* @type { number }
* @syscap SystemCapability.Sensors.Sensor
* @since 8
*/
/**
* The device rotates at an angle around the Z axis.
* @type { number }
* @syscap SystemCapability.Sensors.Sensor
* @atomicservice
* @since arkts {'1.1':'11', '1.2':'20'}
* @arkts 1.1&1.2
*/
alpha: number;
/**
* The device rotates at an angle around the X axis.
* @type { number }
* @syscap SystemCapability.Sensors.Sensor
* @since 8
*/
/**
* The device rotates at an angle around the X axis.
* @type { number }
* @syscap SystemCapability.Sensors.Sensor
* @atomicservice
* @since arkts {'1.1':'11', '1.2':'20'}
* @arkts 1.1&1.2
*/
beta: number;
/**
* The device rotates at an angle around the Y axis.
* @type { number }
* @syscap SystemCapability.Sensors.Sensor
* @since 8
*/
/**
* The device rotates at an angle around the Y axis.
* @type { number }
* @syscap SystemCapability.Sensors.Sensor
* @atomicservice
* @since arkts {'1.1':'11', '1.2':'20'}
* @arkts 1.1&1.2
*/
gamma: number;
}
/**
* Rotation vector sensor event data.
* @typedef RotationVectorResponse
* @syscap SystemCapability.Sensors.Sensor
* @since 8
*/
interface RotationVectorResponse extends Response {
/**
* Rotation vector x-axis component.
* @type { number }
* @syscap SystemCapability.Sensors.Sensor
* @since 8
*/
x: number;
/**
* Rotation vector y-axis component.
* @type { number }
* @syscap SystemCapability.Sensors.Sensor
* @since 8
*/
y: number;
/**
* Rotation vector z-axis component.
* @type { number }
* @syscap SystemCapability.Sensors.Sensor
* @since 8
*/
z: number;
/**
* Scalar quantity.
* @type { number }
* @syscap SystemCapability.Sensors.Sensor
* @since 8
*/
w: number;
}
/**
* Gyroscope sensor event data.
* @typedef GyroscopeResponse
* @syscap SystemCapability.Sensors.Sensor
* @since 8
*/
/**
* Gyroscope sensor event data.
* @typedef GyroscopeResponse
* @syscap SystemCapability.Sensors.Sensor
* @atomicservice
* @since 11
*/
interface GyroscopeResponse extends Response {
/**
* Gyroscope x-axis component.
* @type { number }
* @syscap SystemCapability.Sensors.Sensor
* @since 8
*/
/**
* Gyroscope x-axis component.
* @type { number }
* @syscap SystemCapability.Sensors.Sensor
* @atomicservice
* @since 11
*/
x: number;
/**
* Gyroscope y-axis component.
* @type { number }
* @syscap SystemCapability.Sensors.Sensor
* @since 8
*/
/**
* Gyroscope y-axis component.
* @type { number }
* @syscap SystemCapability.Sensors.Sensor
* @atomicservice
* @since 11
*/
y: number;
/**
* Gyroscope z-axis component.
* @type { number }
* @syscap SystemCapability.Sensors.Sensor
* @since 8
*/
/**
* Gyroscope z-axis component.
* @type { number }
* @syscap SystemCapability.Sensors.Sensor
* @atomicservice
* @since 11
*/
z: number;
}
/**
* Gyroscope uncalibrated sensor event data.
* @typedef GyroscopeUncalibratedResponse
* @syscap SystemCapability.Sensors.Sensor
* @since 8
*/
interface GyroscopeUncalibratedResponse extends Response {
/**
* Gyroscope uncalibrated x-axis component.
* @type { number }
* @syscap SystemCapability.Sensors.Sensor
* @since 8
*/
x: number;
/**
* Gyroscope uncalibrated y-axis component.
* @type { number }
* @syscap SystemCapability.Sensors.Sensor
* @since 8
*/
y: number;
/**
* Gyroscope uncalibrated z-axis component.
* @type { number }
* @syscap SystemCapability.Sensors.Sensor
* @since 8
*/
z: number;
/**
* Gyroscope uncalibrated x-axis offset.
* @type { number }
* @syscap SystemCapability.Sensors.Sensor
* @since 8
*/
biasX: number;
/**
* Gyroscope uncalibrated y-axis offset.
* @type { number }
* @syscap SystemCapability.Sensors.Sensor
* @since 8
*/
biasY: number;
/**
* Gyroscope uncalibrated z-axis offset.
* @type { number }
* @syscap SystemCapability.Sensors.Sensor
* @since 8
*/
biasZ: number;
}
/**
* Significant motion sensor event data.
* @typedef SignificantMotionResponse
* @syscap SystemCapability.Sensors.Sensor
* @since 8
*/
interface SignificantMotionResponse extends Response {
/**
* The degree of significant motion.
* Whether the device has a significant motion.
* The value 1 means that the device has a significant motion, and 0 means the opposite.
* @type { number }
* @syscap SystemCapability.Sensors.Sensor
* @since 8
*/
scalar: number;
}
/**
* Proximity sensor event data.
* @typedef ProximityResponse
* @syscap SystemCapability.Sensors.Sensor
* @since 8
*/
interface ProximityResponse extends Response {
/**
* Indicates the degree of proximity, event 0 indicates proximity, and greater than 0 indicates distance.
* @type { number }
* @syscap SystemCapability.Sensors.Sensor
* @since 8
*/
distance: number;
}
/**
* Light sensor event data.
* @typedef LightResponse
* @syscap SystemCapability.Sensors.Sensor
* @since 8
*/
interface LightResponse extends Response {
/**
* Indicates light intensity, in lux.
* @type { number }
* @syscap SystemCapability.Sensors.Sensor
* @since 8
*/
intensity: number;
/**
* Indicates color temperature, in kelvin.
* @type { ?number }
* @syscap SystemCapability.Sensors.Sensor
* @since 12
*/
colorTemperature?: number;
/**
* Indicates infrared luminance, in cd/m2.
* @type { ?number }
* @syscap SystemCapability.Sensors.Sensor
* @since 12
*/
infraredLuminance?: number;
}
/**
* Hall sensor event data.
* @typedef HallResponse
* @syscap SystemCapability.Sensors.Sensor
* @since 8
*/
interface HallResponse extends Response {
/**
* Indicates hall status, 0 indicates open, and greater than 0 indicates suction.
* @type { number }
* @syscap SystemCapability.Sensors.Sensor
* @since 8
*/
status: number;
}
/**
* Magnetic field sensor event data.
* @typedef MagneticFieldResponse
* @syscap SystemCapability.Sensors.Sensor
* @since 8
*/
interface MagneticFieldResponse extends Response {
/**
* Magnetic field x-axis component.
* @type { number }
* @syscap SystemCapability.Sensors.Sensor
* @since 8
*/
x: number;
/**
* Magnetic field y-axis component.
* @type { number }
* @syscap SystemCapability.Sensors.Sensor
* @since 8
*/
y: number;
/**
* Magnetic field z-axis component.
* @type { number }
* @syscap SystemCapability.Sensors.Sensor
* @since 8
*/
z: number;
}
/**
* Magnetic field uncalibrated sensor event data.
* @typedef MagneticFieldUncalibratedResponse
* @syscap SystemCapability.Sensors.Sensor
* @since 8
*/
interface MagneticFieldUncalibratedResponse extends Response {
/**
* Magnetic field uncalibrated x-axis component.
* @type { number }
* @syscap SystemCapability.Sensors.Sensor
* @since 8
*/
x: number;
/**
* Magnetic field uncalibrated y-axis component.
* @type { number }
* @syscap SystemCapability.Sensors.Sensor
* @since 8
*/
y: number;
/**
* Magnetic field uncalibrated z-axis component.
* @type { number }
* @syscap SystemCapability.Sensors.Sensor
* @since 8
*/
z: number;
/**
* Magnetic field uncalibrated x-axis offset.
* @type { number }
* @syscap SystemCapability.Sensors.Sensor
* @since 8
*/
biasX: number;
/**
* Magnetic field uncalibrated y-axis offset.
* @type { number }
* @syscap SystemCapability.Sensors.Sensor
* @since 8
*/
biasY: number;
/**
* Magnetic field uncalibrated z-axis offset.
* @type { number }
* @syscap SystemCapability.Sensors.Sensor
* @since 8
*/
biasZ: number;
}
/**
* Pedometer sensor event data.
* @typedef PedometerResponse
* @syscap SystemCapability.Sensors.Sensor
* @since 8
*/
interface PedometerResponse extends Response {
/**
* Indicates the number of steps.
* @type { number }
* @syscap SystemCapability.Sensors.Sensor
* @since 8
*/
steps: number;
}
/**
* Humidity sensor event data.
* @typedef HumidityResponse
* @syscap SystemCapability.Sensors.Sensor
* @since 8
*/
interface HumidityResponse extends Response {
/**
* Indicates the number of humidity.
* @type { number }
* @syscap SystemCapability.Sensors.Sensor
* @since 8
*/
humidity: number;
}
/**
* Pedometer detection sensor event data.
* @typedef PedometerDetectionResponse
* @syscap SystemCapability.Sensors.Sensor
* @since 8
*/
interface PedometerDetectionResponse extends Response {
/**
* Indicates the pedometer detection status, 1 indicates that a walking action has occurred,
* and 0 indicates that no movement has occurred.
* @type { number }
* @syscap SystemCapability.Sensors.Sensor
* @since 8
*/
scalar: number;
}
/**
* Ambient temperature sensor event data.
* @typedef AmbientTemperatureResponse
* @syscap SystemCapability.Sensors.Sensor
* @since 8
*/
interface AmbientTemperatureResponse extends Response {
/**
* Indicates ambient temperature, in celsius.
* @type { number }
* @syscap SystemCapability.Sensors.Sensor
* @since 8
*/
temperature: number;
}
/**
* Barometer sensor event data.
* @typedef BarometerResponse
* @syscap SystemCapability.Sensors.Sensor
* @since 8
*/
interface BarometerResponse extends Response {
/**
* Indicates the number of barometer, in hpa.
* @type { number }
* @syscap SystemCapability.Sensors.Sensor
* @since 8
*/
pressure: number;
}
/**
* Heart rate sensor event data.
* @typedef HeartRateResponse
* @syscap SystemCapability.Sensors.Sensor
* @since 8
*/
interface HeartRateResponse extends Response {
/**
* Indicates the number of heart rate.
* @type { number }
* @syscap SystemCapability.Sensors.Sensor
* @since 8
*/
heartRate: number;
}
/**
* Wear detection sensor event data.
* @typedef WearDetectionResponse
* @syscap SystemCapability.Sensors.Sensor
* @since 8
*/
interface WearDetectionResponse extends Response {
/**
* Indicates the status of wear detection, 1 for wearing, 0 for wearing not.
* @type { number }
* @syscap SystemCapability.Sensors.Sensor
* @since 8
*/
value: number;
}
/**
* Color sensor event data.
* @typedef ColorResponse
* @syscap SystemCapability.Sensors.Sensor
* @systemapi
* @since 10
*/
interface ColorResponse extends Response {
/**
* Indicates the intensity of light, in lux.
* @type { number }
* @syscap SystemCapability.Sensors.Sensor
* @systemapi
* @since 10
*/
lightIntensity: number;
/**
* Indicates the color temperature, in kelvin.
* @type { number }
* @syscap SystemCapability.Sensors.Sensor
* @systemapi
* @since 10
*/
colorTemperature: number;
}
/**
* Sar sensor event data.
* @typedef SarResponse
* @syscap SystemCapability.Sensors.Sensor
* @systemapi
* @since 10
*/
interface SarResponse extends Response {
/**
* Indicates the specific absorption rate, in W/kg.
* @type { number }
* @syscap SystemCapability.Sensors.Sensor
* @systemapi
* @since 10
*/
absorptionRatio: number;
}
/**
* Start listening on device status changes.
* @param { 'sensorStatusChange' } type - event of the listening.
* @param { Callback<SensorStatusEvent> } callback - callback of sensor status.
* @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception;
* <br> 2. Sensor service ipc exception;3. Sensor data channel exception.
* @syscap SystemCapability.Sensors.Sensor
* @since 19
*/
function on(type: 'sensorStatusChange', callback: Callback<SensorStatusEvent>): void;
/**
* Stop listening on device status changes.
* @param { 'sensorStatusChange' } type - event of the listening
* @param { Callback<SensorStatusEvent> } [callback] - callback of sensor status.
* @throws { BusinessError } 14500101 - Service exception. Possible causes: 1. Sensor hdf service exception;
* <br> 2. Sensor service ipc exception;3. Sensor data channel exception.
* @syscap SystemCapability.Sensors.Sensor
* @since 19
*/
function off(type: 'sensorStatusChange', callback?: Callback<SensorStatusEvent>): void;
/**
* Defines the data structure of the device status change event.
* @typedef SensorStatusEvent
* @syscap SystemCapability.Sensors.Sensor
* @since 19
*/
interface SensorStatusEvent {
/**
* Indicates the timestamp of the status change.
* @type { number }
* @syscap SystemCapability.Sensors.Sensor
* @since 19
*/
timestamp: number;
/**
* Sensor type id.
* @type { number }
* @syscap SystemCapability.Sensors.Sensor
* @since 19
*/
sensorId: number;
/**
* Index of sensors of the same type.
* @type { number }
* @syscap SystemCapability.Sensors.Sensor
* @since 19
*/
sensorIndex: number;
/**
* Whether the device is online, true indicates online, false indicates offline.
*
* @type { boolean }
* @syscap SystemCapability.Sensors.Sensor
* @since 19
*/
isSensorOnline: boolean;
/**
* Device ID.
* @type { number }
* @syscap SystemCapability.Sensors.Sensor
* @since 19
*/
deviceId: number;
/**
* Device name.
* @type { string }
* @syscap SystemCapability.Sensors.Sensor
* @since 19
*/
deviceName: string;
}
/**
* Parameters of sensor on the device.
* @typedef SensorInfoParam
* @syscap SystemCapability.Sensors.Sensor
* @atomicservice
* @since 19
*/
interface SensorInfoParam {
/**
* Unique identifier for the device that contains one or multiple sensors.
* By default, deviceId may default to querying or controlling the local default sensor.
*
* @type { ?number }
* @syscap SystemCapability.Sensors.Sensor
* @atomicservice
* @since 19
*/
deviceId?: number;
/**
* Index of sensors of the same type. By default, it controls default sensors of the sensor type.
* @type { ?number }
* @syscap SystemCapability.Sensors.Sensor
* @atomicservice
* @since 19
*/
sensorIndex?: number;
}
}
export default sensor;
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/openharmony/interface_sdk-js.git
git@gitee.com:openharmony/interface_sdk-js.git
openharmony
interface_sdk-js
interface_sdk-js
master

搜索帮助