This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // The BroadcastReceiver that listens for discovered devices and | |
| // changes the title when discovery is finished | |
| private final BroadcastReceiver mReceiver = new BroadcastReceiver() { | |
| @Override | |
| public void onReceive(Context context, Intent intent) { | |
| String action = intent.getAction(); | |
| // When discovery finds a device | |
| if (BluetoothDevice.ACTION_FOUND.equals(action)) { | |
| // Get the BluetoothDevice object from the Intent |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Register for broadcasts when a device is discovered | |
| IntentFilter filter = new IntentFilter(BluetoothDevice.ACTION_FOUND); | |
| this.registerReceiver(mReceiver, filter); | |
| // Register for broadcasts when discovery has finished | |
| filter = new IntentFilter(BluetoothAdapter.ACTION_DISCOVERY_FINISHED); | |
| this.registerReceiver(mReceiver, filter); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Get the local Bluetooth adapter | |
| mBtAdapter = BluetoothAdapter.getDefaultAdapter(); | |
| // Get a set of currently paired devices | |
| Set<BluetoothDevice> pairedDevices = mBtAdapter.getBondedDevices(); | |
| // If there are paired devices, add each one to the ArrayAdapter | |
| if (pairedDevices.size() > 0) { | |
| findViewById(R.id.title_paired_devices).setVisibility(View.VISIBLE); | |
| for (BluetoothDevice device : pairedDevices) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public void onActivityResult(int requestCode, int resultCode, Intent data) { | |
| if(D) Log.d(TAG, "onActivityResult " + resultCode); | |
| switch (requestCode) { | |
| case REQUEST_CONNECT_DEVICE: | |
| // When DeviceListActivity returns with a device to connect | |
| if (resultCode == Activity.RESULT_OK) { | |
| // Get the device MAC address | |
| String address = data.getExtras() | |
| .getString(DeviceListActivity.EXTRA_DEVICE_ADDRESS); | |
| // Get the BLuetoothDevice object |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // If BT is not on, request that it be enabled. | |
| // setupChat() will then be called during onActivityResult | |
| if (!mBluetoothAdapter.isEnabled()) { | |
| Intent enableIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE); | |
| startActivityForResult(enableIntent, REQUEST_ENABLE_BT); | |
| // Otherwise, setup the chat session | |
| } else { | |
| if (mChatService == null) setupChat(); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Get local Bluetooth adapter | |
| mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter(); | |
| // If the adapter is null, then Bluetooth is not supported | |
| if (mBluetoothAdapter == null) { | |
| Toast.makeText(this, "Bluetooth is not available", Toast.LENGTH_LONG).show(); | |
| finish(); | |
| return; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <manifest nuestraAplicacion> | |
| <uses-permission android:name="android.permission.BLUETOOTH" /> | |
| ...... Otras clausulas | |
| </manifest> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| .LC1: | |
| .string "\nEl arreglo en desorden es: " | |
| .LC2: | |
| .string " %d " | |
| .LC3: | |
| .string "\nEl arreglo en orden es: " | |
| .text | |
| .globl main | |
| main: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| .file "burbuja.c" // nombre del archivo | |
| .section .rodata // y creacion de asembly | |
| .LC0: // primera seccion que guarda | |
| .string "Metodo Burbuja" // una cadena de caracteres | |
| .LC1: // otra seccion que | |
| .string "\nEl arreglo" // tambien guarda una cadena | |
| .LC2: // En esta seccion se guarda una | |
| .string " %d " // cadena, es para tomar un numero | |
| .LC3: // En esta parte se guarda un cada | |
| .string "\nEl arreglo ordenado es: " // que es la segunda que se muestra |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| main (){ | |
| int N,i,pasadas,almacena; |
NewerOlder