@ file : Suppress (" Member Visibility Can Be Private ") Ċ Ċ package Ġcom . mas sel is . rx bluetooth kotlin Ċ Ċ import Ġandroid . bluetooth . Bluetooth Device Ċ import Ġandroid . bluetooth . Bluetooth GattCharacteristic Ċ import Ġandroid . bluetooth . Bluetooth Gatt Descriptor Ċ import Ġandroid . bluetooth . Bluetooth Gatt Service Ċ import Ġandroid . os . Build Ċ import Ġandroidx . annotation . Requires Api Ċ import Ġcom . mas sel is . rx bluetooth kotlin . Cannot Initialize . Cannot Initialize Characteristic Write Ċ import Ġcom . mas sel is . rx bluetooth kotlin . Device Disconnected . Characteristic Write Device Disconnected Ċ import Ġjava . util .* ĊĊ Ċ // Ġ---------------- -- ĠBluetooth Ġexceptions Ġfor Ġscanning Ġand ĠI / O Ċ Ċ /** Ċ Ġ* ĠFire Ġthis Ġerror Ġif Ġthe Ġbluetooth Ġis Ġturned Ġoff Ġon Ġthe Ġcurrent Ġdevice . ĠYou Ġcan Ġask Ġthe Ġuser Ġto Ċ Ġ* Ġenable ĠBluetooth Ġby Ġstarting Ġan Ġactivity Ġfor Ġresult Ġwith Ġthis Ġintent Ġ: Ċ Ġ* Ġ[ android . bluetooth . Bluetooth Adapter . ACTION _ REQUEST _ ENABLE ] Ċ Ġ*/ Ċ public Ġclass ĠBluetooth Is Turn ed Off Ġ: ĠThrowable () Ġ{ ĊĠĠĠ Ġoverride Ġfun ĠtoString (): ĠString Ġ= Ġ" Bluetooth Is Turn ed Off ()" Ċ } Ċ Ċ // Ġ---------------- -- ĠBluetooth Ġexceptions Ġfor Ġscanning Ġonly Ċ Ċ /** Ċ Ġ* ĠFire Ġthis Ġerror Ġif Ġthe Ġcurrent Ġdevice Ġdoesn 't Ġsupport ĠBluetooth . Ċ Ġ*/ Ċ public Ġclass ĠDevice DoesNot Support Bluetooth Ġ: ĠThrowable () Ġ{ ĊĠĠĠ Ġoverride Ġfun ĠtoString (): ĠString Ġ= Ġ" Device DoesNot Support Bluetooth ()" Ċ } Ċ Ċ /** Ċ Ġ* ĠError Ġfired Ġif Ġthe Ġlocation Ġpermission Ġis Ġrequire Ġfor Ġthe Ġcurrent Ġapp . ĠYou Ġhave Ġto Ġrequest Ġfor Ċ Ġ* Ġthe Ġmissing Ġpermission Ġ[ android . Manifest . permission . ACCESS _ F INE _ LOCATION ]. Ċ Ġ*/ Ċ public Ġclass ĠNeed Location Permission Ġ: ĠThrowable () Ġ{ ĊĠĠĠ Ġoverride Ġfun ĠtoString (): ĠString Ġ= Ġ" Need Location Permission ()" Ċ } Ċ Ċ /** Ċ Ġ* ĠError Ġfired Ġif Ġthe Ġbluetooth Ġpermission Ġis Ġrequire Ġfor Ġthe Ġcurrent Ġapp . ĠYou Ġhave Ġto Ġrequest Ġfor Ċ Ġ* Ġthe Ġmissing Ġpermission Ġ[ android . Manifest . permission . BL U ETO OTH _ SCAN ]. Ċ Ġ*/ Ċ @ Requires Api ( Build . VERSION _ CODES . S ) Ċ public Ġclass ĠNeed Bluetooth Scan Permission Ġ: ĠThrowable () Ġ{ ĊĠĠĠ Ġoverride Ġfun ĠtoString (): ĠString Ġ= Ġ" Need Bluetooth Scan Permission ()" Ċ } Ċ Ċ /** Ċ Ġ* ĠError Ġfired Ġif Ġthe Ġbluetooth Ġpermission Ġis Ġrequire Ġfor Ġthe Ġcurrent Ġapp . ĠYou Ġhave Ġto Ġrequest Ġfor Ċ Ġ* Ġthe Ġmissing Ġpermission Ġ[ android . Manifest . permission . BL U ETO OTH _ CONNECT ]. Ċ Ġ*/ Ċ @ Requires Api ( Build . VERSION _ CODES . S ) Ċ public Ġclass ĠNeed Bluetooth Connect Permission Ġ: ĠThrowable () Ġ{ ĊĠĠĠ Ġoverride Ġfun ĠtoString (): ĠString Ġ= Ġ" Need Bluetooth Connect Permission ()" Ċ } Ċ Ċ /** Ċ Ġ* ĠF ired Ġif Ġlocation Ġservice Ġis Ġdisabled Ġfor Ġthe Ġapp . ĠYou Ġcan Ġask Ġthe Ġuser Ġto Ġenable ĠLocation Ċ Ġ* Ġservice Ġby Ġstarting Ġan Ġactivity Ġfor Ġresult Ġwith Ġthis Ġintent Ġ: Ċ Ġ* Ġ[ android . provider . Settings . ACTION _ LOCATION _ SOURCE _ SETTINGS ] Ċ Ġ*/ Ċ public Ġclass ĠLocation Service Disabled Ġ: ĠThrowable () Ġ{ ĊĠĠĠ Ġoverride Ġfun ĠtoString (): ĠString Ġ= Ġ" Location Service Disabled ()" Ċ } Ċ Ċ /** Ċ Ġ* ĠF ired Ġif Ġan Ġerror Ġappend Ġwhen Ġscanning . Ċ Ġ* ĠThe Ġ[ status ] Ġfield Ġis Ġfilled Ġwith Ġan Ġ[ Int ] Ġprovided Ġby Ġthe ĠAndroid Ġframework , Ġit Ġcould Ġbe Ġone Ġof Ċ Ġ* Ġthe Ġ[ android . bluetooth . le . Scan Callback . SCAN _ FAILED _* ] Ġconst Ċ Ġ*/ Ċ public Ġclass ĠScan FailedException ( public Ġval Ġstatus : ĠInt ) Ġ: ĠThrowable () Ġ{ ĊĠĠĠ Ġoverride Ġfun ĠtoString (): ĠString Ġ= Ġ" Scan FailedException ( status =$ status )" Ċ } ĊĊ Ċ // Ġ---------------- -- ĠBluetooth Ġexceptions Ġwhen Ġconnected Ċ Ċ /** Ċ Ġ* ĠException Ġfired Ġwhen Ġtrying Ġto Ġconnect Ġto Ġa Ġremote Ġdevice Ġbut Ġthe Ġ[ Bluetooth Device . connect Gatt ] Ġmethod Ġreturned Ġnull . Ċ Ġ* ĠAccording Ġto Ġthe ĠAndroid Ġsource Ġcode , Ġthis Ġexception Ġcould Ġfire Ġif Ġthe Ġdevice Ġdoesn 't Ġsupport ĠBluetooth Ġor Ġif Ġan Ċ Ġ* Ġexception Ġoccurs Ġwhile Ġgetting Ġthe ĠBluetooth Ġinterface Ġfrom Ġthe Ġmanufacturer . Ċ Ġ*/ Ċ public Ġclass ĠNull Bluetooth Gatt Ġ: ĠThrowable () Ġ{ ĊĠĠĠ Ġoverride Ġfun ĠtoString (): ĠString Ġ= Ġ" Null Bluetooth Gatt ()" Ċ } Ċ Ċ /** Ċ Ġ* ĠF ired Ġwhen Ġa ĠI / O Ġoperation Ġtakes Ġmore Ġthan Ġ 1 Ġminute Ġto Ġbe Ġexecuted . ĠNorm ally , Ġa Ċ Ġ* Ġ[ Device Disconnected ] Ġexception Ġshould Ġbe Ġfired Ġbefore Ġthis Ġexception Ġbecause Ġthe Ġbluetooth Ċ Ġ* Ġstandard Ġdefine Ġa ĠTimeout Ġof Ġ 3 Ġseconds Ġbut , Ġsometimes , Ġthe ĠAndroid ĠBLE Ġframework Ġdoesn 't Ġcall Ġthe Ċ Ġ* Ġcallback Ġand Ġthe Ġ[ Device Disconnected ] Ġexception Ġis Ġnot Ġfired ĠÂ ¯ \_ ( ãĥĦ )_ / Â ¯ . ĠIs Ġthis Ġcase , Ġthis Ċ Ġ* Ġexception Ġis Ġfired . Ċ Ġ*/ Ċ public Ġclass ĠBluetooth Timeout Ġ: ĠThrowable () Ġ{ ĊĠĠĠ Ġoverride Ġfun ĠtoString (): ĠString Ġ= Ġ" Bluetooth Timeout ()" Ċ } Ċ Ċ /** Ċ Ġ* ĠF ired Ġwhen Ġtrying Ġto Ġsearch Ġa Ġcharacteristic Ġwhereas Ġservices Ġare Ġnot Ġdiscovered Ċ Ġ*/ Ċ public Ġclass ĠLooking For Characteristic But Services Not Dis covered ( ĊĠĠĠ Ġpublic Ġval Ġdevice : ĠBluetooth Device , ĊĠĠĠ Ġpublic Ġval Ġcharacteristic UUID : ĠUUID Ċ ) Ġ: ĠThrowable () Ġ{ ĊĠĠĠ Ġoverride Ġfun ĠtoString (): ĠString Ġ= ĊĠĠĠĠĠĠĠ Ġ" Searching Characteristic But Services Not Dis covered ( device =$ device , Ġcharacteristic UUID =$ character istic UUID )" Ċ } Ċ Ċ /** Ċ Ġ* ĠF ired Ġwhen Ġcalling Ġ[ Rx Bluetooth Gatt . enable Notification ] Ġor Ġ[ Rx Bluetooth Gatt . disable Notification ] Ġif Ġthe Ġdescriptor Ġfor Ġnotifications Ġis Ġnot Ġfound . Ċ Ġ*/ Ċ public Ġclass ĠDescriptor NotFound ( ĊĠĠĠ Ġpublic Ġval Ġdevice : ĠBluetooth Device , ĊĠĠĠ Ġpublic Ġval Ġcharacteristic UUID : ĠUUID , ĊĠĠĠ Ġpublic Ġval Ġdescriptor UUID : ĠUUID Ċ ) Ġ: ĠThrowable () Ġ{ ĊĠĠĠ Ġoverride Ġfun ĠtoString (): ĠString Ġ= ĊĠĠĠĠĠĠĠ Ġ" Descriptor NotFound ( device =$ device , Ġcharacteristic UUID =$ character istic UUID , Ġdescriptor UUID =$ descriptor UUID )" Ċ } Ċ Ċ // Ġ---------------- -- ĠBluetooth Ġexceptions Ġfor ĠI / O Ġonly Ċ Ċ /** Ċ Ġ* ĠTop Ġerror Ġcorresponding Ġto Ġa Ġdevice Ġdis connection . ĠEach ĠI / O Ġmethod Ġlike Ġ[ Rx Bluetooth Gatt . write ] Ġhave Ġan Ġspecific Ġimplementation Ġof Ġ[ Device Disconnected ], Ġin Ġthis Ġcase Ġit 's Ċ Ġ* Ġ[ Characteristic Write Device Disconnected ]. Ċ Ġ* Ċ Ġ* ĠThe Ġ[ status ] Ġfield Ġis Ġfilled Ġwith Ġan Ġ[ Int ] Ġprovided Ġby Ġthe ĠAndroid Ġframework . ĠAndroid Ġsources Ġare Ċ Ġ* Ġund ocument ed Ġbut Ġ[ status ] Ġseems Ġto Ġrefers Ġto Ġthe ses Ġconst s Ġ: Ċ Ġ* Ġ[ https :// android . google source . com / platform / external / bluetooth / bl ued roid / +/ android - 5 . 1 . 0 _ r 1 / stack / include / g att _ api . h ] Ċ Ġ*/ Ċ public Ġsealed Ġclass ĠDevice Disconnected ( public Ġval Ġdevice : ĠBluetooth Device , Ġpublic Ġval Ġstatus : ĠInt ) Ġ: ĊĠĠĠ ĠThrowable () Ġ{ ĊĠĠĠ Ġoverride Ġfun ĠtoString (): ĠString Ġ= Ġ" Device Disconnected ( device =$ device , Ġstatus =$ status )" ĊĊĠĠĠ Ġ/** ĊĠĠĠĠ Ġ* ĠF ired Ġwhen Ġdevice Ġdisconnect . ĠUn like Ġthe Ġother Ġsealed Ġpublic Ġclasses , Ġthis Ġ[ Throwable ] Ġdoesn 't ĊĠĠĠĠ Ġ* Ġprovides Ġthe Ġbluetooth Ġoperation Ġwhich Ġhas Ġfailed Ġand Ġcaused Ġa Ġdis connection . ĊĠĠĠĠ Ġ*/ ĊĠĠĠ Ġpublic Ġclass ĠSimple Device Disconnected ( bluetooth Device : ĠBluetooth Device , Ġstatus : ĠInt ) Ġ: ĊĠĠĠĠĠĠĠ ĠDevice Disconnected ( bluetooth Device , Ġstatus ) Ġ{ ĊĠĠĠĠĠĠĠ Ġoverride Ġfun ĠtoString (): ĠString Ġ= Ġ" Simple Device Disconnected () Ġ${ super . toString () }" ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ/** ĊĠĠĠĠ Ġ* ĠF ired Ġwhen Ġdevice Ġdisconnect Ġwhile Ġfetching ĠRSS I ĊĠĠĠĠ Ġ*/ ĊĠĠĠ Ġpublic Ġclass ĠR ssi Device Disconnected ( bluetooth Device : ĠBluetooth Device , Ġstatus : ĠInt ) Ġ: ĊĠĠĠĠĠĠĠ ĠDevice Disconnected ( bluetooth Device , Ġstatus ) Ġ{ ĊĠĠĠĠĠĠĠ Ġoverride Ġfun ĠtoString (): ĠString Ġ= Ġ" R ssi Device Disconnected () Ġ${ super . toString () }" ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ/** ĊĠĠĠĠ Ġ* ĠF ired Ġwhen Ġdevice Ġdisconnect Ġwhile Ġdiscover ing Ġservices ĊĠĠĠĠ Ġ*/ ĊĠĠĠ Ġpublic Ġclass ĠDis cover Services Device Disconnected ( bluetooth Device : ĠBluetooth Device , Ġstatus : ĠInt ) Ġ: ĊĠĠĠĠĠĠĠ ĠDevice Disconnected ( bluetooth Device , Ġstatus ) Ġ{ ĊĠĠĠĠĠĠĠ Ġoverride Ġfun ĠtoString (): ĠString Ġ= Ġ" Discover Services Device Disconnected () Ġ${ super . toString () }" ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ/** ĊĠĠĠĠ Ġ* ĠF ired Ġwhen Ġdevice Ġdisconnect Ġwhile Ġrequesting ĠMT U ĊĠĠĠĠ Ġ*/ ĊĠĠĠ Ġpublic Ġclass ĠM tu Device Disconnected ( bluetooth Device : ĠBluetooth Device , Ġstatus : ĠInt ) Ġ: ĊĠĠĠĠĠĠĠ ĠDevice Disconnected ( bluetooth Device , Ġstatus ) Ġ{ ĊĠĠĠĠĠĠĠ Ġoverride Ġfun ĠtoString (): ĠString Ġ= Ġ" M tu Device Disconnected () Ġ${ super . toString () }" ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ/** ĊĠĠĠĠ Ġ* ĠF ired Ġwhen Ġdevice Ġdisconnect Ġwhile Ġreading Ġphy ĊĠĠĠĠ Ġ*/ ĊĠĠĠ Ġpublic Ġclass ĠRead Phy Device Disconnected ( bluetooth Device : ĠBluetooth Device , Ġstatus : ĠInt ) Ġ: ĊĠĠĠĠĠĠĠ ĠDevice Disconnected ( bluetooth Device , Ġstatus ) Ġ{ ĊĠĠĠĠĠĠĠ Ġoverride Ġfun ĠtoString (): ĠString Ġ= Ġ" Read Phy Device Disconnected () Ġ${ super . toString () }" ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ/** ĊĠĠĠĠ Ġ* ĠF ired Ġwhen Ġdevice Ġdisconnect Ġwhile Ġreading Ġphy ĊĠĠĠĠ Ġ*/ ĊĠĠĠ Ġpublic Ġclass ĠSet Preferred Phy Device Disconnected ( ĊĠĠĠĠĠĠĠ Ġpublic Ġval Ġconnection Phy : ĠConnection PHY , ĊĠĠĠĠĠĠĠ Ġpublic Ġval Ġphy Options : ĠInt , ĊĠĠĠĠĠĠĠ Ġbluetooth Device : ĠBluetooth Device , ĊĠĠĠĠĠĠĠ Ġstatus : ĠInt ĊĠĠĠ Ġ) Ġ: ĊĠĠĠĠĠĠĠ ĠDevice Disconnected ( bluetooth Device , Ġstatus ) Ġ{ ĊĠĠĠĠĠĠĠ Ġoverride Ġfun ĠtoString (): ĠString Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ" Set Preferred Phy Device Disconnected ( connection Phy =$ connection Phy , Ġphy Options =$ phy Options ) Ġ${ super . toString () }" ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ/** ĊĠĠĠĠ Ġ* ĠF ired Ġif Ġthe Ġdevice Ġdisconnect s Ġwhile Ġchanging Ġthe Ġnotification Ġstate Ġ( enable Ġor Ġdisable ) ĊĠĠĠĠ Ġ*/ ĊĠĠĠ Ġpublic Ġclass ĠChange Notification Device Disconnected ( ĊĠĠĠĠĠĠĠ Ġbluetooth Device : ĠBluetooth Device , Ġstatus : ĠInt , ĊĠĠĠĠĠĠĠ Ġpublic Ġval Ġcharacteristic : ĠBluetooth GattCharacteristic , ĊĠĠĠĠĠĠĠ Ġpublic Ġval Ġvalue : ĠByteArray , ĊĠĠĠĠĠĠĠ Ġpublic Ġval Ġcheck If Already Changed : ĠBoolean ĊĠĠĠ Ġ) Ġ: ĠDevice Disconnected ( bluetooth Device , Ġstatus ) Ġ{ ĊĠĠĠĠĠĠĠ Ġoverride Ġfun ĠtoString (): ĠString Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ" Change Notification Device Disconnected ( character istic =$ character istic , Ġnotification public Ġvalue =${ value . content ToString ()}, Ġcheck If Already Changed =$ check If Already Changed ) Ġ${ super . toString () }" ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ/** ĊĠĠĠĠ Ġ* ĠF ired Ġwhen Ġdevice Ġdisconnect Ġwhile Ġreading Ġcharacteristic ĊĠĠĠĠ Ġ*/ ĊĠĠĠ Ġpublic Ġclass ĠCharacter istic Read Device Disconnected ( ĊĠĠĠĠĠĠĠ Ġbluetooth Device : ĠBluetooth Device , ĊĠĠĠĠĠĠĠ Ġstatus : ĠInt , ĊĠĠĠĠĠĠĠ Ġpublic Ġval Ġservice : ĠBluetooth Gatt Service , ĊĠĠĠĠĠĠĠ Ġpublic Ġval Ġcharacteristic : ĠBluetooth GattCharacteristic ĊĠĠĠ Ġ) Ġ: ĊĠĠĠĠĠĠĠ ĠDevice Disconnected ( bluetooth Device , Ġstatus ) Ġ{ ĊĠĠĠĠĠĠĠ Ġoverride Ġfun ĠtoString (): ĠString Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ" Characteristic Read Device Disconnected ( service =$ service , Ġcharacteristic =$ character istic ) Ġ${ super . toString () }" ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ/** ĊĠĠĠĠ Ġ* ĠF ired Ġwhen Ġdevice Ġdisconnect Ġwhile Ġwriting Ġcharacteristic ĊĠĠĠĠ Ġ*/ ĊĠĠĠ Ġpublic Ġclass ĠCharacter istic Write Device Disconnected ( ĊĠĠĠĠĠĠĠ Ġbluetooth Device : ĠBluetooth Device , ĊĠĠĠĠĠĠĠ Ġstatus : ĠInt , ĊĠĠĠĠĠĠĠ Ġpublic Ġval Ġservice : ĠBluetooth Gatt Service , ĊĠĠĠĠĠĠĠ Ġpublic Ġval Ġcharacteristic : ĠBluetooth GattCharacteristic , ĊĠĠĠĠĠĠĠ Ġpublic Ġval Ġvalue : ĠByteArray ĊĠĠĠ Ġ) Ġ: ĠDevice Disconnected ( bluetooth Device , Ġstatus ) Ġ{ ĊĠĠĠĠĠĠĠ Ġoverride Ġfun ĠtoString (): ĠString Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ" Characteristic Write Device Disconnected ( service =$ service , Ġcharacteristic =$ character istic , Ġpublic Ġvalue =${ value . content ToString () }) Ġ${ super . toString () }" ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ/** ĊĠĠĠĠ Ġ* ĠF ired Ġwhen Ġdevice Ġdisconnect Ġwhile Ġlistening Ġchanges Ġon Ġthis Ġ[ character istic ] ĊĠĠĠĠ Ġ*/ ĊĠĠĠ Ġpublic Ġclass ĠListen Changes Device Disconnected ( ĊĠĠĠĠĠĠĠ Ġbluetooth Device : ĠBluetooth Device , ĊĠĠĠĠĠĠĠ Ġstatus : ĠInt , ĊĠĠĠĠĠĠĠ Ġpublic Ġval Ġservice : ĠBluetooth Gatt Service , ĊĠĠĠĠĠĠĠ Ġpublic Ġval Ġcharacteristic : ĠBluetooth GattCharacteristic ĊĠĠĠ Ġ) Ġ: ĠDevice Disconnected ( bluetooth Device , Ġstatus ) Ġ{ ĊĠĠĠĠĠĠĠ Ġoverride Ġfun ĠtoString (): ĠString Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ" Listen Changes Device Disconnected ( service =$ service , Ġcharacteristic =$ character istic ) Ġ${ super . toString () }" ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ/** ĊĠĠĠĠ Ġ* ĠF ired Ġwhen Ġdevice Ġdisconnect Ġwhile Ġreading Ġdescriptor ĊĠĠĠĠ Ġ*/ ĊĠĠĠ Ġpublic Ġclass ĠDescriptor Read Device Disconnected ( ĊĠĠĠĠĠĠĠ Ġdevice : ĠBluetooth Device , ĊĠĠĠĠĠĠĠ Ġstatus : ĠInt , ĊĠĠĠĠĠĠĠ Ġpublic Ġval Ġservice : ĠBluetooth Gatt Service , ĊĠĠĠĠĠĠĠ Ġpublic Ġval Ġcharacteristic : ĠBluetooth GattCharacteristic , ĊĠĠĠĠĠĠĠ Ġpublic Ġval Ġdescriptor : ĠBluetooth Gatt Descriptor ĊĠĠĠ Ġ) Ġ: ĠDevice Disconnected ( device , Ġstatus ) Ġ{ ĊĠĠĠĠĠĠĠ Ġoverride Ġfun ĠtoString (): ĠString Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ" Descriptor Read Device Disconnected ( service =$ service , Ġcharacteristic =$ character istic , Ġdescriptor =$ descriptor ) Ġ${ super . toString () }" ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ/** ĊĠĠĠĠ Ġ* ĠF ired Ġwhen Ġdevice Ġdisconnect Ġwhile Ġwriting Ġdescriptor ĊĠĠĠĠ Ġ*/ ĊĠĠĠ Ġpublic Ġclass ĠDescriptor Write Device Disconnected ( ĊĠĠĠĠĠĠĠ Ġdevice : ĠBluetooth Device , ĊĠĠĠĠĠĠĠ Ġstatus : ĠInt , ĊĠĠĠĠĠĠĠ Ġpublic Ġval Ġservice : ĠBluetooth Gatt Service , ĊĠĠĠĠĠĠĠ Ġpublic Ġval Ġcharacteristic : ĠBluetooth GattCharacteristic , ĊĠĠĠĠĠĠĠ Ġpublic Ġval Ġdescriptor : ĠBluetooth Gatt Descriptor , ĊĠĠĠĠĠĠĠ Ġpublic Ġval Ġvalue : ĠByteArray ĊĠĠĠ Ġ) Ġ: ĠDevice Disconnected ( device , Ġstatus ) Ġ{ ĊĠĠĠĠĠĠĠ Ġoverride Ġfun ĠtoString (): ĠString Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ" Descriptor Write Device Disconnected ( service =$ service , Ġcharacteristic =$ character istic , Ġdescriptor =$ descriptor , Ġpublic Ġvalue =${ value . content ToString () }) Ġ${ super . toString () }" ĊĠĠĠ Ġ} Ċ } Ċ Ċ /** Ċ Ġ* ĠTop Ġerror Ġcorresponding Ġto Ġan Ġerror Ġwrite Ġpre paring ĠI / O . ĠEach ĠI / O Ġmethod Ġlike Ġ[ Rx Bluetooth Gatt . write ] Ġhave Ġan Ġspecific Ġimplementation Ġof Ġ[ Cannot Initialize ], Ġin Ġthis Ġcase Ġit 's Ċ Ġ* Ġ[ Cannot Initialize Characteristic Write ]. Ċ Ġ*/ Ċ public Ġsealed Ġclass ĠCannot Initialize ( public Ġval Ġdevice : ĠBluetooth Device ) Ġ: ĠThrowable () Ġ{ ĊĠĠĠ Ġoverride Ġfun ĠtoString (): ĠString Ġ= Ġ" Cannot Initialize ( device =$ device )" ĊĊĠĠĠ Ġ/** ĊĠĠĠĠ Ġ* ĠF ired Ġwhen ĠRSS I Ġrequest Ġcannot Ġbe Ġpro ceeded ĊĠĠĠĠ Ġ*/ ĊĠĠĠ Ġpublic Ġclass ĠCannot Initialize R ssi Reading ( device : ĠBluetooth Device ) Ġ: ĠCannot Initialize ( device ) Ġ{ ĊĠĠĠĠĠĠĠ Ġoverride Ġfun ĠtoString (): ĠString Ġ= Ġ" Cannot Initialize R ssi Reading () Ġ${ super . toString () }" ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ/** ĊĠĠĠĠ Ġ* ĠF ired Ġwhen Ġservice Ġdiscover Ġrequest Ġcannot Ġbe Ġpro ceeded ĊĠĠĠĠ Ġ*/ ĊĠĠĠ Ġpublic Ġclass ĠCannot Initialize Services Discover ing ( device : ĠBluetooth Device ) Ġ: ĊĠĠĠĠĠĠĠ ĠCannot Initialize ( device ) Ġ{ ĊĠĠĠĠĠĠĠ Ġoverride Ġfun ĠtoString (): ĠString Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ" Cannot Initialize Services Discover ing () Ġ${ super . toString () }" ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ/** ĊĠĠĠĠ Ġ* ĠF ired Ġwhen ĠMT U Ġrequest Ġcannot Ġbe Ġpro ceeded ĊĠĠĠĠ Ġ*/ ĊĠĠĠ Ġpublic Ġclass ĠCannot Initialize M tu Request ing ( device : ĠBluetooth Device ) Ġ: ĠCannot Initialize ( device ) Ġ{ ĊĠĠĠĠĠĠĠ Ġoverride Ġfun ĠtoString (): ĠString Ġ= Ġ" Cannot Initialize M tu Request ing () Ġ${ super . toString () }" ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ/** ĊĠĠĠĠ Ġ* ĠF ired Ġwhen Ġread Ġrequest Ġcannot Ġbe Ġpro ceeded ĊĠĠĠĠ Ġ*/ ĊĠĠĠ Ġpublic Ġclass ĠCannot Initialize Characteristic Reading ( ĊĠĠĠĠĠĠĠ Ġdevice : ĠBluetooth Device , ĊĠĠĠĠĠĠĠ Ġpublic Ġval Ġservice : ĠBluetooth Gatt Service ?, ĊĠĠĠĠĠĠĠ Ġpublic Ġval Ġcharacteristic : ĠBluetooth GattCharacteristic , ĊĠĠĠĠĠĠĠ Ġpublic Ġval Ġproperties : ĠInt , ĊĠĠĠĠĠĠĠ Ġpublic Ġval Ġinternal Service : ĠAny ?, ĊĠĠĠĠĠĠĠ Ġpublic Ġval Ġclient If : ĠAny ?, ĊĠĠĠĠĠĠĠ Ġpublic Ġval Ġfound Device : ĠAny ?, ĊĠĠĠĠĠĠĠ Ġpublic Ġval Ġis Device Busy : ĠAny ? ĊĠĠĠ Ġ) Ġ: ĠCannot Initialize ( device ) Ġ{ ĊĠĠĠĠĠĠĠ Ġoverride Ġfun ĠtoString (): ĠString Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ" Cannot Initialize Characteristic Reading ( service =$ service , Ġcharacteristic =$ character istic , Ġproperties =$ properties , Ġinternal Service =$ internal Service , Ġclient If =$ client If , Ġfound Device =$ found Device , Ġis Device Busy =$ is Device Busy ) Ġ${ super . toString () }" ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ/** ĊĠĠĠĠ Ġ* ĠF ired Ġwhen Ġwrite Ġrequest Ġcannot Ġbe Ġpro ceeded ĊĠĠĠĠ Ġ*/ ĊĠĠĠ Ġpublic Ġclass ĠCannot Initialize Characteristic Write ( ĊĠĠĠĠĠĠĠ Ġdevice : ĠBluetooth Device , ĊĠĠĠĠĠĠĠ Ġpublic Ġval Ġservice : ĠBluetooth Gatt Service ?, ĊĠĠĠĠĠĠĠ Ġpublic Ġval Ġcharacteristic : ĠBluetooth GattCharacteristic , ĊĠĠĠĠĠĠĠ Ġpublic Ġval Ġvalue : ĠByteArray , ĊĠĠĠĠĠĠĠ Ġpublic Ġval Ġproperties : ĠInt , ĊĠĠĠĠĠĠĠ Ġpublic Ġval Ġinternal Service : ĠAny ?, ĊĠĠĠĠĠĠĠ Ġpublic Ġval Ġclient If : ĠAny ?, ĊĠĠĠĠĠĠĠ Ġpublic Ġval Ġfound Device : ĠAny ?, ĊĠĠĠĠĠĠĠ Ġpublic Ġval Ġis Device Busy : ĠAny ? ĊĠĠĠ Ġ) Ġ: ĠCannot Initialize ( device ) Ġ{ ĊĠĠĠĠĠĠĠ Ġoverride Ġfun ĠtoString (): ĠString Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ" Cannot Initialize Characteristic Write ( service =$ service , Ġcharacteristic =$ character istic , Ġpublic Ġvalue =${ value . content ToString ()}, Ġproperties =$ properties , Ġinternal Service =$ internal Service , Ġclient If =$ client If , Ġfound Device =$ found Device , Ġis Device Busy =$ is Device Busy ) Ġ${ super . toString () }" ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ/** ĊĠĠĠĠ Ġ* ĠF ired Ġwhen Ġnotification Ġrequest Ġcannot Ġbe Ġpro ceeded ĊĠĠĠĠ Ġ*/ ĊĠĠĠ Ġpublic Ġclass ĠCannot Initialize Characteristic Notification ( ĊĠĠĠĠĠĠĠ Ġdevice : ĠBluetooth Device , ĊĠĠĠĠĠĠĠ Ġpublic Ġval Ġservice : ĠBluetooth Gatt Service , ĊĠĠĠĠĠĠĠ Ġpublic Ġval Ġcharacteristic : ĠBluetooth GattCharacteristic , ĊĠĠĠĠĠĠĠ Ġpublic Ġval Ġinternal Service : ĠAny ?, ĊĠĠĠĠĠĠĠ Ġpublic Ġval Ġclient If : ĠAny ?, ĊĠĠĠĠĠĠĠ Ġpublic Ġval Ġfound Device : ĠAny ? ĊĠĠĠ Ġ) Ġ: ĠCannot Initialize ( device ) Ġ{ ĊĠĠĠĠĠĠĠ Ġoverride Ġfun ĠtoString (): ĠString Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ" Cannot Initialize Characteristic Notification ( service =$ service , Ġcharacteristic =$ character istic , Ġinternal Service =$ internal Service , Ġclient If =$ client If , Ġfound Device =$ found Device ) Ġ${ super . toString () }" ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ/** ĊĠĠĠĠ Ġ* ĠF ired Ġwhen Ġread Ġrequest Ġcannot Ġbe Ġpro ceeded ĊĠĠĠĠ Ġ*/ ĊĠĠĠ Ġpublic Ġclass ĠCannot Initialize Descriptor Reading ( ĊĠĠĠĠĠĠĠ Ġdevice : ĠBluetooth Device , ĊĠĠĠĠĠĠĠ Ġpublic Ġval Ġservice : ĠBluetooth Gatt Service ?, ĊĠĠĠĠĠĠĠ Ġpublic Ġval Ġcharacteristic : ĠBluetooth GattCharacteristic ?, ĊĠĠĠĠĠĠĠ Ġpublic Ġval Ġdescriptor : ĠBluetooth Gatt Descriptor , ĊĠĠĠĠĠĠĠ Ġpublic Ġval Ġinternal Service : ĠAny ?, ĊĠĠĠĠĠĠĠ Ġpublic Ġval Ġclient If : ĠAny ?, ĊĠĠĠĠĠĠĠ Ġpublic Ġval Ġfound Device : ĠAny ?, ĊĠĠĠĠĠĠĠ Ġpublic Ġval Ġis Device Busy : ĠAny ? ĊĠĠĠ Ġ) Ġ: ĠCannot Initialize ( device ) Ġ{ ĊĠĠĠĠĠĠĠ Ġoverride Ġfun ĠtoString (): ĠString Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ" Cannot Initialize Descriptor Reading ( service =$ service , Ġcharacteristic =$ character istic , Ġdescriptor =$ descriptor , Ġinternal Service =$ internal Service , Ġclient If =$ client If , Ġfound Device =$ found Device , Ġis Device Busy =$ is Device Busy ) Ġ${ super . toString () }" ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ/** ĊĠĠĠĠ Ġ* ĠF ired Ġwhen Ġwrite Ġrequest Ġcannot Ġbe Ġpro ceeded ĊĠĠĠĠ Ġ*/ ĊĠĠĠ Ġpublic Ġclass ĠCannot Initialize Descriptor Write ( ĊĠĠĠĠĠĠĠ Ġdevice : ĠBluetooth Device , ĊĠĠĠĠĠĠĠ Ġpublic Ġval Ġservice : ĠBluetooth Gatt Service ?, ĊĠĠĠĠĠĠĠ Ġpublic Ġval Ġcharacteristic : ĠBluetooth GattCharacteristic ?, ĊĠĠĠĠĠĠĠ Ġpublic Ġval Ġdescriptor : ĠBluetooth Gatt Descriptor , ĊĠĠĠĠĠĠĠ Ġpublic Ġval Ġvalue : ĠByteArray , ĊĠĠĠĠĠĠĠ Ġpublic Ġval Ġinternal Service : ĠAny ?, ĊĠĠĠĠĠĠĠ Ġpublic Ġval Ġclient If : ĠAny ?, ĊĠĠĠĠĠĠĠ Ġpublic Ġval Ġfound Device : ĠAny ?, ĊĠĠĠĠĠĠĠ Ġpublic Ġval Ġis Device Busy : ĠAny ? ĊĠĠĠ Ġ) Ġ: ĠCannot Initialize ( device ) Ġ{ ĊĠĠĠĠĠĠĠ Ġoverride Ġfun ĠtoString (): ĠString Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ" Cannot Initialize Descriptor Write ( service =$ service , Ġcharacteristic =$ character istic , Ġdescriptor =$ descriptor , Ġpublic Ġvalue =${ value . content ToString ()}, Ġinternal Service =$ internal Service , Ġclient If =$ client If , Ġfound Device =$ found Device , Ġis Device Busy =$ is Device Busy ) Ġ${ super . toString () }" ĊĠĠĠ Ġ} Ċ } Ċ Ċ /** Ċ Ġ* ĠF ired Ġwhen Ġan ĠRead Ġor ĠWrite Ġoperation Ġfails . Ċ Ġ* ĠThe Ġ[ status ] Ġfield Ġis Ġfilled Ġwith Ġan Ġ[ Int ] Ġprovided Ġby Ġthe ĠAndroid Ġframework . ĠAndroid Ġsources Ġare Ċ Ġ* Ġund ocument ed Ġbut Ġ[ status ] Ġseems Ġto Ġrefers Ġto Ġthe ses Ġconst s Ġ: Ċ Ġ* Ġ[ https :// android . google source . com / platform / external / bluetooth / bl ued roid / +/ android - 5 . 1 . 0 _ r 1 / stack / include / g att _ api . h ] Ċ Ġ*/ Ċ public Ġsealed Ġclass ĠI OF ailed ( public Ġval Ġstatus : ĠInt , Ġpublic Ġval Ġdevice : ĠBluetooth Device ) Ġ: ĊĠĠĠ ĠThrowable () Ġ{ ĊĠĠĠ Ġoverride Ġfun ĠtoString (): ĠString Ġ= Ġ" I OF ailed ( status =$ status , Ġdevice =$ device )" ĊĊĠĠĠ Ġ/** ĊĠĠĠĠ Ġ* ĠF ired Ġwhen ĠRSS I Ġrequest Ġreturns Ġan Ġerror ĊĠĠĠĠ Ġ*/ ĊĠĠĠ Ġpublic Ġclass ĠR ssi Reading Failed ( status : ĠInt , Ġdevice : ĠBluetooth Device ) Ġ: ĊĠĠĠĠĠĠĠ ĠI OF ailed ( status , Ġdevice ) Ġ{ ĊĠĠĠĠĠĠĠ Ġoverride Ġfun ĠtoString (): ĠString Ġ= Ġ" R ssi Reading Failed () Ġ${ super . toString () }" ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ/** ĊĠĠĠĠ Ġ* ĠF ired Ġwhen Ġservice Ġdiscover ing Ġrequest Ġreturns Ġan Ġerror ĊĠĠĠĠ Ġ*/ ĊĠĠĠ Ġpublic Ġclass ĠService Discover ing Failed ( status : ĠInt , Ġdevice : ĠBluetooth Device ) Ġ: ĊĠĠĠĠĠĠĠ ĠI OF ailed ( status , Ġdevice ) Ġ{ ĊĠĠĠĠĠĠĠ Ġoverride Ġfun ĠtoString (): ĠString Ġ= Ġ" Service Discover ing Failed () Ġ${ super . toString () }" ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ/** ĊĠĠĠĠ Ġ* ĠF ired Ġwhen ĠMT U Ġrequest Ġreturns Ġan Ġerror ĊĠĠĠĠ Ġ*/ ĊĠĠĠ Ġpublic Ġclass ĠM tu Request ing Failed ( status : ĠInt , Ġdevice : ĠBluetooth Device ) Ġ: ĊĠĠĠĠĠĠĠ ĠI OF ailed ( status , Ġdevice ) Ġ{ ĊĠĠĠĠĠĠĠ Ġoverride Ġfun ĠtoString (): ĠString Ġ= Ġ" M tu Request ing Failed () Ġ${ super . toString () }" ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ/** ĊĠĠĠĠ Ġ* ĠF ired Ġwhen ĠPHY Ġrequest Ġreturns Ġan Ġerror ĊĠĠĠĠ Ġ*/ ĊĠĠĠ Ġpublic Ġclass ĠP hy Read Failed ( ĊĠĠĠĠĠĠĠ Ġpublic Ġval Ġconnection Phy : ĠConnection PHY , ĊĠĠĠĠĠĠĠ Ġstatus : ĠInt , ĊĠĠĠĠĠĠĠ Ġdevice : ĠBluetooth Device ĊĠĠĠ Ġ) Ġ: ĠI OF ailed ( status , Ġdevice ) Ġ{ ĊĠĠĠĠĠĠĠ Ġoverride Ġfun ĠtoString (): ĠString Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ" Phy Read Failed ( connection Phy =$ connection Phy ) Ġ${ super . toString () }" ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ/** ĊĠĠĠĠ Ġ* ĠF ired Ġwhen ĠPHY Ġpreferred Ġchanges Ġreturns Ġan Ġerror ĊĠĠĠĠ Ġ*/ ĊĠĠĠ Ġpublic Ġclass ĠSet Preferred Phy Failed ( ĊĠĠĠĠĠĠĠ Ġpublic Ġval Ġconnection Phy : ĠConnection PHY , ĊĠĠĠĠĠĠĠ Ġpublic Ġval Ġphy Options : ĠInt , ĊĠĠĠĠĠĠĠ Ġstatus : ĠInt , ĊĠĠĠĠĠĠĠ Ġdevice : ĠBluetooth Device ĊĠĠĠ Ġ) Ġ: ĠI OF ailed ( status , Ġdevice ) Ġ{ ĊĠĠĠĠĠĠĠ Ġoverride Ġfun ĠtoString (): ĠString Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ" Set Preferred Phy Failed ( connection Phy =$ connection Phy , Ġphy Options =$ phy Options ) Ġ${ super . toString () }" ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ/** ĊĠĠĠĠ Ġ* ĠF ired Ġwhen Ġread Ġrequest Ġreturns Ġan Ġerror ĊĠĠĠĠ Ġ*/ ĊĠĠĠ Ġpublic Ġclass ĠCharacter istic Reading Failed ( ĊĠĠĠĠĠĠĠ Ġstatus : ĠInt , ĊĠĠĠĠĠĠĠ Ġdevice : ĠBluetooth Device , ĊĠĠĠĠĠĠĠ Ġpublic Ġval Ġservice : ĠBluetooth Gatt Service , ĊĠĠĠĠĠĠĠ Ġpublic Ġval Ġcharacteristic : ĠBluetooth GattCharacteristic ĊĠĠĠ Ġ) Ġ: ĊĠĠĠĠĠĠĠ ĠI OF ailed ( status , Ġdevice ) Ġ{ ĊĠĠĠĠĠĠĠ Ġoverride Ġfun ĠtoString (): ĠString Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ" Characteristic Reading Failed ( service =$ service , Ġcharacteristic =$ character istic ) Ġ${ super . toString () }" ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ/** ĊĠĠĠĠ Ġ* ĠF ired Ġwhen Ġwrite Ġrequest Ġreturns Ġan Ġerror ĊĠĠĠĠ Ġ*/ ĊĠĠĠ Ġpublic Ġclass ĠCharacter istic Write Failed ( ĊĠĠĠĠĠĠĠ Ġstatus : ĠInt , ĊĠĠĠĠĠĠĠ Ġdevice : ĠBluetooth Device , ĊĠĠĠĠĠĠĠ Ġpublic Ġval Ġservice : ĠBluetooth Gatt Service , ĊĠĠĠĠĠĠĠ Ġpublic Ġval Ġcharacteristic : ĠBluetooth GattCharacteristic , ĊĠĠĠĠĠĠĠ Ġpublic Ġval Ġvalue : ĠByteArray ĊĠĠĠ Ġ) Ġ: ĠI OF ailed ( status , Ġdevice ) Ġ{ ĊĠĠĠĠĠĠĠ Ġoverride Ġfun ĠtoString (): ĠString Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ" Characteristic Write Failed ( service =$ service , Ġcharacteristic =$ character istic , Ġpublic Ġvalue =${ value . content ToString () }) Ġ${ super . toString () }" ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ/** ĊĠĠĠĠ Ġ* ĠF ired Ġwhen Ġread Ġrequest Ġreturns Ġan Ġerror ĊĠĠĠĠ Ġ*/ ĊĠĠĠ Ġpublic Ġclass ĠDescriptor Reading Failed ( ĊĠĠĠĠĠĠĠ Ġstatus : ĠInt , ĊĠĠĠĠĠĠĠ Ġdevice : ĠBluetooth Device , ĊĠĠĠĠĠĠĠ Ġpublic Ġval Ġservice : ĠBluetooth Gatt Service , ĊĠĠĠĠĠĠĠ Ġpublic Ġval Ġcharacteristic : ĠBluetooth GattCharacteristic , ĊĠĠĠĠĠĠĠ Ġpublic Ġval Ġdescriptor : ĠBluetooth Gatt Descriptor ĊĠĠĠ Ġ) Ġ: ĠI OF ailed ( status , Ġdevice ) Ġ{ ĊĠĠĠĠĠĠĠ Ġoverride Ġfun ĠtoString (): ĠString Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ" Descriptor Reading Failed ( service =$ service , Ġcharacteristic =$ character istic , Ġdescriptor =$ descriptor ) Ġ${ super . toString () }" ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ/** ĊĠĠĠĠ Ġ* ĠF ired Ġwhen Ġwrite Ġrequest Ġreturns Ġan Ġerror ĊĠĠĠĠ Ġ*/ ĊĠĠĠ Ġpublic Ġclass ĠDescriptor Write Failed ( ĊĠĠĠĠĠĠĠ Ġstatus : ĠInt , ĊĠĠĠĠĠĠĠ Ġdevice : ĠBluetooth Device , ĊĠĠĠĠĠĠĠ Ġpublic Ġval Ġservice : ĠBluetooth Gatt Service , ĊĠĠĠĠĠĠĠ Ġpublic Ġval Ġcharacteristic : ĠBluetooth GattCharacteristic , ĊĠĠĠĠĠĠĠ Ġpublic Ġval Ġdescriptor : ĠBluetooth Gatt Descriptor , ĊĠĠĠĠĠĠĠ Ġpublic Ġval Ġvalue : ĠByteArray ĊĠĠĠ Ġ) Ġ: ĠI OF ailed ( status , Ġdevice ) Ġ{ ĊĠĠĠĠĠĠĠ Ġoverride Ġfun ĠtoString (): ĠString Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ" Descriptor Write Failed ( service =$ service , Ġcharacteristic =$ character istic , Ġdescriptor =$ descriptor , Ġpublic Ġvalue =${ value . content ToString () }) Ġ${ super . toString () }" ĊĠĠĠ Ġ} Ċ }