亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

?? ??? ??
android Manifest Manifest.permission Manifest.permission_group android.accessibilityservice AccessibilityService android.accounts Account android.app NotificationManager android.bluetooth BluetoothAdapter BluetoothClass BluetoothClass.Device BluetoothClass.Device.Major BluetoothClass.Service BluetoothDevice BluetoothServerSocket BluetoothSocket android.content SharedPreferences android.database.sqlite SQLiteCursorDriver SQLiteOpenHelper android.graphics Bitmap android.location LocationListener Geocoder GpsStatus GpsStatus.Listener GpsStatus.NmeaListener GpsSatellite android.media AudioFormat AsyncPlayer AudioRecord AudioRecord.OnRecordPositionUpdateListener ThumbnailUtils AudioManager android.net TrafficStats MailTo LocalSocket android.os AsyncTask AsyncTask.Status CountDownTimer Message MessageQueue HandlerThread android.text Html android.util JsonWriter android.view ContextMenu ContextMenu.ContextMenuInfo Display ViewManager View ViewStub ViewTreeObserver ViewParent WindowManager GestureDetector Gravity MenuInflater ScaleGestureDetector SoundEffectConstants android.view.inputmethod InputConnection InputMethod InputMethodSession BaseInputConnection InputMethodManager android.widget AbsListView AbsListView.LayoutParams AbsListView.OnScrollListener AbsListView.RecyclerListener AbsoluteLayout AbsoluteLayout.LayoutParams AbsSeekBar AbsSpinner AdapterView AdapterView.AdapterContextMenuInfo AdapterView.OnItemLongClickListener AdapterView.OnItemSelectedListener AdapterView.OnItemClickListener AnalogClock BaseAdapter BaseExpandableListAdapter Button CheckBox CheckedTextView Checkable Chronometer Chronometer.OnChronometerTickListener CompoundButton CompoundButton.OnCheckedChangeListener CursorAdapter CursorTreeAdapter DatePicker DatePicker.OnDateChangedListener DialerFilter DigitalClock EditText Filter Filter.FilterListener Filter.FilterResults ExpandableListAdapter ExpandableListView.OnChildClickListener ExpandableListView.OnGroupClickListener ExpandableListView.OnGroupCollapseListener ExpandableListView.OnGroupExpandListener Filterable Gallery Gallery.LayoutParams GridView GridLayout GridLayout.Alignment RadioGroup ImageView ImageView.ScaleType HorizontalScrollView ImageButton ImageSwitcher FilterQueryProvider ListAdapter ListView MediaController MultiAutoCompleteTextView MultiAutoCompleteTextView.CommaTokenizer MultiAutoCompleteTextView.Tokenizer QuickContactBadge RadioButton RatingBar RatingBar.OnRatingBarChangeListener RelativeLayout RemoteViews ResourceCursorAdapter ResourceCursorTreeAdapter Scroller ScrollView SearchView SearchView.OnCloseListener SearchView.OnQueryTextListener SearchView.OnSuggestionListener SeekBar SeekBar.OnSeekBarChangeListener SimpleAdapter SimpleAdapter.ViewBinder SimpleCursorAdapter SimpleCursorAdapter.CursorToStringConverter SimpleCursorAdapter.ViewBinder SimpleCursorTreeAdapter SimpleCursorTreeAdapter.ViewBinder SimpleExpandableListAdapter SlidingDrawer SlidingDrawer.OnDrawerCloseListener SlidingDrawer.OnDrawerOpenListener SlidingDrawer.OnDrawerScrollListener Spinner SpinnerAdapter WrapperListAdapter TabHost TabHost.TabSpec TextView TimePicker TimePicker.OnTimeChangedListener Toast TableLayout TableLayout.LayoutParams TableRow TableRow.LayoutParams TabWidget TextSwitcher ToggleButton TwoLineListItem VideoView ViewAnimator ViewFlipper ViewSwitcher ViewSwitcher.ViewFactory ZoomButtonsController ZoomButtonsController.OnZoomListener ZoomButton ZoomControls dalvik.system DexFile
??


BluetoothSocket

版本:Android 2.3 r1

?

結構

繼承關系

public final class BluetoothSocket extends Object implements Closeable

????????

java.lang.Object

android.bluetooth.BluetoothSocket

?

類概述

???????? 已連接或連接到藍牙套接字(socket)。

???????? 藍牙端口監(jiān)聽接口和TCP端口類似:SocketServerSocket類。在服務器端,使用BluetoothServerSocket類來創(chuàng)建一個 監(jiān)聽服務端口。當一個連接被BluetoothServerSocket所接受,它會返回一個新的BluetoothSocket來管理該連接。在客戶 端,使用一個單獨的BluetoothSocket類去初始化一個外接連接和管理該連接。

最通常使用的藍牙端口是RFCOMM,它是被Android API支持的類型。RFCOMM是一個面向連接,通過藍牙模塊進行的數(shù)據(jù)流傳輸方式,它也被稱為串行端口規(guī)范(Serial Port Profile,SPP)。

為了創(chuàng)建一個BluetoothSocket去連接到一個已知設備,使用方法 BluetoothDevice.createRfcommSocketToServiceRecord()。然后調用connect()方法去嘗試一個 面向遠程設備的連接。這個調用將被阻塞指導一個連接已經(jīng)建立或者該鏈接失效。

為了創(chuàng)建一個BluetoothSocket作為服務端(或者主機),查看BluetoothServerSocket文檔。

每當該端口連接成功,無論它初始化為客戶端,或者被接受作為服務器端,通過getInputStream()getOutputStream()來打開IO流,從而獲得各自的InputStreamOutputStream對象

BluetoothSocket類線程安全。特別的,close()方法總會馬上放棄外界操作并關閉服務器端口。

注意:需要BLUETOOTH權限。

參見

???????? BluetoothServerSocket

??? InputStream

??? OutputStream

?

公共方法

??? public void close ()

馬上關閉該端口并且釋放所有相關的資源。

在其它線程的該端口中引起阻塞,從而使系統(tǒng)馬上拋出一個IO異常。

異常

IOException

?

??? public void connect ()

嘗試連接到遠程設備。

該方法將阻塞,指導一個連接建立或者失效。如果該方法沒有返回異常值,則該端口現(xiàn)在已經(jīng)建立。

當設備查找正在進行的時候,創(chuàng)建對遠程藍牙設備的新連接不可被嘗試。在藍牙適配器上,設備查找是一個重量級過程,并且肯定會降低一個設備的連接。使用 cancelDiscovery()方法去取消一個外界的查詢。查詢并不由活動所管理,而作為一個系統(tǒng)服務來運行,所以即使它不能直接請求一個查詢,應用 程序也總會調用cancelDiscovery()方法。

close()方法可以用來放棄從另一線程而來的調用。

異常

IOException???? 一個錯誤,例如連接失敗。

?

??? public InputStream getInputStream ()

通過連接的端口獲得輸入數(shù)據(jù)流

即使該端口未連接,該輸入數(shù)據(jù)流也會返回。不過在該數(shù)據(jù)流上的操作將拋出異常,直到相關的連接已經(jīng)建立。

返回值

輸入流

異常

IOException

?

??? public OutputStream getOutputStream ()

通過連接的端口獲得輸出數(shù)據(jù)流

即使該端口未連接,該輸出數(shù)據(jù)流也會返回。不過在該數(shù)據(jù)流上的操作將拋出異常,直到相關的連接已經(jīng)建立。

返回值

輸出流

異常

IOException

?

??? public BluetoothDevice getRemoteDevice ()

獲得該端口正在連接或者已經(jīng)連接的遠程設備。

返回值

遠程設備

?

補充

??? 文章精選

??????? 第四十一講:Android藍牙編程入門

??????? Android藍牙APIBluetoothSocket

??????? Android藍牙APIBluetoothSocket(2)

?

?


?? ??: ?? ??: