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
| char variable; | |
| boolean estado; | |
| void setup() { | |
| Serial.begin(115200); | |
| estado=false; | |
| ////////////////////////////////////////////// | |
| //ADELANTE | |
| pinMode(13, OUTPUT); | |
| digitalWrite(13, LOW); |
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 class HolaMundo extends MIDlet { | |
| // Componentes del interfaz de usuario | |
| private Display display; | |
| private Form form; | |
| //Constructor de la clase. | |
| public HolaMundo() { | |
| // Cogemos el display | |
| display=Display.getDisplay(this); |
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 class HolaMundo extends Activity { | |
| public void onCreate(Bundle icicle) { | |
| super.onCreate(icicle); | |
| TextView tv = new TextView(this); | |
| tv.setText("Hola Mundo"); | |
| setContentView(tv); | |
| } | |
| } |
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
| @Override | |
| protected void finalize(){ | |
| _wifiLock.release(); | |
| } |
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
| for(Iterator<ScanResult> it = scanResults.iterator(); it.hasNext();){ | |
| ScanResult result = it.next(); | |
| if (_ssidsMap.containsKey(result.SSID)){ | |
| // Si ya existe informacion sobre el SSID, la actualiza. | |
| _ssidsMap.put(result.SSID, _ssidsMap.get(result.SSID) + result.level); | |
| } else { | |
| // Si no existe informacion sobre el SSID, la crea. | |
| _ssidsMap.put(result.SSID, result.level); | |
| } | |
| } |
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
| private final BroadcastReceiver _bcReceiver = new BroadcastReceiver() { | |
| @Override | |
| public void onReceive(Context context, Intent intent){ | |
| String action = intent.getAction(); | |
| if(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION.equals(action)){ | |
| Log.i(WifiService.NAME, "Scan finished with " + | |
| _wifiManager.getScanResults().size() + " items found"); | |
| calculateRSSI(_wifiManager.getScanResults()); | |
| _isScanning = false; |
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 startScanning(){ | |
| Log.i(WifiService.NAME, "in startScanning()"); | |
| if (!_wifiManager.isWifiEnabled()){ | |
| Log.i(WifiService.NAME, "WIFI disabled"); | |
| Toast.makeText(_context, "Wifi Deshabilitada\nHabilitela e intente de nuevo", | |
| Toast.LENGTH_LONG).show(); | |
| // Es aconsejable asegurarse de que se detienen los escaneos. | |
| _scanning = false; | |
| 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.ACCESS_WIFI_STATE" /> | |
| <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" /> | |
| ...... 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
| public ConnectThread(BluetoothDevice device) { | |
| mmDevice = device; | |
| BluetoothSocket tmp = null; | |
| // Get a BluetoothSocket for a connection with the | |
| // given BluetoothDevice | |
| try { | |
| tmp = device.createRfcommSocketToServiceRecord(MY_UUID); | |
| } catch (IOException e) { | |
| Log.e(TAG, "create() failed", e); |
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 AcceptThread() { | |
| BluetoothServerSocket tmp = null; | |
| // Create a new listening server socket | |
| try { | |
| tmp = mAdapter.listenUsingRfcommWithServiceRecord(NAME, MY_UUID); | |
| } catch (IOException e) { | |
| Log.e(TAG, "listen() failed", e); | |
| } | |
| mmServerSocket = tmp; |