21
Develop Apps for Embedded Android Networking 01/13/2014 Fred Eady Class 1: A Basic4Android Wireless Digital I/O App

Develop Apps for Embedded Android Networking

  • Upload
    lemuel

  • View
    66

  • Download
    0

Embed Size (px)

DESCRIPTION

Develop Apps for Embedded Android Networking. Class 1: A Basic4Android Wireless Digital I/O App. 01/13/2014 Fred Eady. A Basic4Android Wireless Digital I/O App. AGENDA. Basic4Android Serial Library Code a Simple Bluetooth Engine Setup and Code the Remote Device - PowerPoint PPT Presentation

Citation preview

Page 1: Develop Apps for Embedded Android Networking

Develop Apps for Embedded Android Networking

01/13/2014Fred Eady

Class 1: A Basic4Android Wireless Digital I/O App

Page 2: Develop Apps for Embedded Android Networking

A Basic4Android Wireless Digital I/O App

Basic4Android Serial Library Code a Simple Bluetooth Engine Setup and Code the Remote Device Basic4Android RandomAccessFile

Library Code a Data Communications Activity Combine the Simple Bluetooth Engine

with a Communications Activity to Produce a Remote Control App

2

AGENDA

Page 3: Develop Apps for Embedded Android Networking

A Basic4Android Wireless Digital I/O App

Allows Communication with Bluetooth Devices

Functionality Based on RFCOMM Usage Based on the Serial Object

Properties Allows Administration of the Bluetooth

Adapter Using the BluetoothAdmin Object

3

Basic4Android Serial Library

Page 4: Develop Apps for Embedded Android Networking

A Basic4Android Wireless Digital I/O App

4

Code a Simple Bluetooth EngineStep 1: Declare the Global Variables

Page 5: Develop Apps for Embedded Android Networking

A Basic4Android Wireless Digital I/O App

5

Code a Simple Bluetooth EngineStep 2: Code the bluAdmin / bluSPP Object Initialization

Step 3: Write Code to Load Layout the File simpleEngine

Page 6: Develop Apps for Embedded Android Networking

A Basic4Android Wireless Digital I/O App

6

Page 7: Develop Apps for Embedded Android Networking

A Basic4Android Wireless Digital I/O App

7

Code a Simple Bluetooth EngineStep 4: Write the Button Event Code

The btnScan_Click subroutine shell was created by employing the services of the Abstract Designer’s Generate Members function.

Page 8: Develop Apps for Embedded Android Networking

A Basic4Android Wireless Digital I/O App

8

Code a Simple Bluetooth EngineStep 5: Write the Bluetooth Administration Code

Page 9: Develop Apps for Embedded Android Networking

A Basic4Android Wireless Digital I/O App

9

Code a Simple Bluetooth EngineStep 6: Write the Device Discovery Code

Page 10: Develop Apps for Embedded Android Networking

A Basic4Android Wireless Digital I/O App

10

Code a Simple Bluetooth EngineStep 7: Write the Device Selection/Connection Code

Page 11: Develop Apps for Embedded Android Networking

A Basic4Android Wireless Digital I/O App

11

Code a Simple Bluetooth EngineStep 8: Test Our Simple Bluetooth App

Attempt to connect to EDTPBLU.

1234 and CONNECTED

Page 12: Develop Apps for Embedded Android Networking

A Basic4Android Wireless Digital I/O App

12

Setup and Code the Remote Device

Page 13: Develop Apps for Embedded Android Networking

A Basic4Android Wireless Digital I/O App

13

Setup and Code the Remote Device

Page 14: Develop Apps for Embedded Android Networking

A Basic4Android Wireless Digital I/O App

14

Setup and Code the Remote DevicePIC32MX Atomic Port I/O Operations

TRISxSET - TRISxCLR PORTxSET – PORTxCLR - PORTxINV LATxSET – LATxCLR – LATxINV

TRISACLR = 0x0001 RA0 = OUTPUTTRISASET = 0x0001 RA0 = INPUT

LATASET = 0x0001 RA0 = 1LATAINV = 0x0001 RA0 = 0

Page 15: Develop Apps for Embedded Android Networking

A Basic4Android Wireless Digital I/O App

15

Setup and Code the Remote DeviceStep 1: Define the WF32 LEDs 5 and 6.

Step 2: Code the LED Command Handler.

TRISFCLR = 0x0001; //WF32 RF0 = OUTPUT - LED5 TRISGCLR = 0x0040; //WF32 RG6 = OUTPUT - LED6

if(CharInQueue()) //print received character {

biteIn = recvchar();switch(biteIn)

{ case 0x35: LATFINV = 0x0001; //LED5 break; case 0x36: LATGINV = 0x0040; //LED6 break; } }

This code is added to the main function of the EDTP Embedded Bluetooth Driver.

Page 16: Develop Apps for Embedded Android Networking

A Basic4Android Wireless Digital I/O App

Bluetooth Usage Based on the AsyncStreams Object Properties

Allows Reading and Writing to I/O Streams Without Blocking the Main Thread

Facilitates Easy Movement of Any Amount of Data

Easily Transports Files, Arrays and Objects

16

Basic4Android RandomAccessFile Library

Page 17: Develop Apps for Embedded Android Networking

A Basic4Android Wireless Digital I/O App

17

Code a Data Communications ActivityStep 1: Declare the Global Variables

Page 18: Develop Apps for Embedded Android Networking

A Basic4Android Wireless Digital I/O App

18

Code a Data Communications ActivityStep 2: Code the Layout Sequence and “Pipe” Initialization.

Page 19: Develop Apps for Embedded Android Networking

A Basic4Android Wireless Digital I/O App

19

Code a Data Communications ActivityStep 3: Code the Button Event Handlers

Page 20: Develop Apps for Embedded Android Networking

A Basic4Android Wireless Digital I/O App

20

A Bluetooth Remote Control App

Page 21: Develop Apps for Embedded Android Networking

A Basic4Android Wireless Digital I/O App

21

Day 1 Topic Review

We Used BluetoothAdmin and Serial Objects to Spawn a Bare Bones Bluetooth Engine.

We Used a Digilent WF32 to Create an Embedded Bluetooth-Capable Device.

We Attached an AsyncStreams-Based Basic4Android Module to Our Simple Bluetooth Engine and Built a Useful Android App.