08.06.2013 Views

PEMBUATAN APLIKASI MOBILE PEMESANAN MAKANAN DAN ...

PEMBUATAN APLIKASI MOBILE PEMESANAN MAKANAN DAN ...

PEMBUATAN APLIKASI MOBILE PEMESANAN MAKANAN DAN ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

54<br />

...<br />

private LocalDevice localDevice;<br />

// local bluetooth manager<br />

...<br />

//mendapatkan informasi dari local device dan untuk<br />

dapat<br />

//mengakses bluetooth manager<br />

localDevice = LocalDevice.getLocalDevice();<br />

//pengesetan discoverable mode GIAC pada server<br />

localDevice.setDiscoverable(DiscoveryAgent.GIAC);<br />

...<br />

Setelah melakukan proses inisialisasi, proses selanjutnya adalah<br />

membuat koneksi server dengan menggunakan<br />

Connector.open() method<br />

/koneksi server<br />

import javax.microedition.io.Connector;<br />

private StreamConnectionNotifier notifier;<br />

...<br />

//membuat koneksi server menggunakan Serial Port<br />

Profile URL,<br />

//spesifik UUID, dan nama service<br />

notifier =<br />

(StreamConnectionNotifier)Connector.open(<br />

"btspp://localhost:102030405060708090A0B0C0D0E0F010<br />

;" +<br />

"name=FOODCOURT;authenticate=false;encrypt=false");<br />

...<br />

Proses berikutnya yaitu mengeset attribute service record pada<br />

Service Discovery Database (SDDB). Berikut potongan source codenya<br />

:<br />

...<br />

//mengambil record dari SDDB<br />

ServiceRecord record =<br />

localDevice.getRecord(notifier);<br />

//mengeset service record ServiceAvailability<br />

(0x0008)

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!