<<  WWI The Russian Revolution Imtegrum Databases from Russia and CIS New Possibilities for Public Libraries  >>
The project course goes Android
The project course goes Android
The project course goes Android
The project course goes Android
FrameWork: User interface
FrameWork: User interface
Threads (internals)
Threads (internals)
Test harness
Test harness
Welcome to EQ2430\EQ2440 Android Lecture

: Tillhor. , . , Welcome to EQ2430\EQ2440 Android Lecture.ppt zip- 279 .

Welcome to EQ2430\EQ2440 Android Lecture

Welcome to EQ2430\EQ2440 Android Lecture.ppt
1Welcome to EQ2430/EQ2440 Android 18message_out(my_message,SPEAKER); public
Lecture. Per Zetterberg School of void message_in(StudentMessage message) {
Electrical Engineering. March 21, 2012. If (sync_message) correlation=value1;
2The project course goes Android! 19Logging on file 1(2). loggingOn =
Features used in our projects: Display : true; Logs measurements from all active
plots and text. Microphone. Loudspeaker. sensor except camera and you own debug
Magnetometer measurements. WiFi RSSI messages:
measurements. Send data using WiFi. write_string_on_logfile(correlation=+cor
Accelerometers. Touch screen. Camera. elation) Creates a measurement file called
3FrameWork. FrameWork is a java project sensorlogYYYYMMDDHHMM.csv on the SDCARD.
(program) in Eclipse. FrameWork is a The measurement file is ASCI with
Android 2.2 project that runs (at least) measurents in clear text. How retrieve
on HTC Desire and Samsung S3. FrameWork is file: method1: Mount SDCARD on PC.
a generic skeleton which can be used as methods: Using our matlab functions.
the starting point for many student 20Logging on file 2(2): matlab
projects (including yours!). FrameWork has utilities. Copy file to PC-harddisc
an object StudentCode which is where you (matlab command)
implement your prototype. Application copy_file_from_sdcard_to_working_directory
name: StudentFrameWork (Change this) m Obtain the data from the log-file into
Creators: Martin Ohlsson and Per matlab: get_log_data_from_FrameWork.m
Zetterberg. Extract data from some certain sensors:
4FrameWork: User interface. PlotView: extract_acceloremeter_from_log_data.m,
Graphs and/or Camera picture. TextView: extract_sound_from_log_data.m,
Textual output. extract_magnetic_from_log_data.m Other
5Downloading FrameWork. Go to EQ2440 sensors: Do it yourself. Problem: SOUND_IN
web (KTH social) => Android support fluds measurement log. Solution:
Download: FrameWork_empty.zip empty logSound=false;
because most StudentCode functions are 21Test harness. Purpose: Test
empty . or almost empty. Unzip and move implementation of math-intensive
the code to workspace directory. Do functions/algorithms in an isolated and
file->import->existing project repeatable way. Method: Run your matlab-
into workspace-> and java- (with android environment)
6StudentCode (i.e your code). -implementations side by side with exactly
Parameters: useSensors, loggingOn, the same input . How? Matlab produces
logSound, useCameraGUI,useMessaging, data, and pushes it on the sdcard
messageServer, processInterval, introText, FrameWork includes a function called
messageGroups, StudentMessage (class) test_harness(). Inside this function the
useSensors (bitfield): xor the following data can be read from the sdcard, the
GPS,CAMERA,CAMERA_RGB,SOUND_OUT,SOUND_IN,W function to be tested is called, and the
FI_SCAN,ACCELEROMETER,MAGNETIC_FIELD,PROXI results are saved on the sdcard. Matlab
ITY,TIME_SYNC, then pulls the data from sdcard. Finally,
PROXIMITY,LIGHT,SOUND_IN,CAMERA, the results from the matlab- and
GYROSCOPE. java-implementation are compared. What do
7Called by StudentCode 1(3). I need to do ? The example
sound_out(short[] buffer, int length): test_harness_example.m shows how to
Send data to DAC=>loudspeaker (somewhat automate the process. This code can be
stochastic latency). used as a starting point, however, you
message_out(StudentMessage message): Send need to customize the code to the function
message to all the other phones. you are going to test. All, non-trivial
message_out(StudentMessage message, String functions should be tested like this.
groupIdString): Send message to the phones 22State-machine and functions. Functions
in group defined by groupIdString. that can be tested against matlab
streaming_buffer_out(short[] buffer, int implementation using harness. Example of
length, String groupIdString): Send buffer debugging method.
of int16 to the phones in group defined by 23Using sound (input). useSensors =
groupIdString. SOUND_IN | SOUND_OUT; sampleRate = 22050;
8Called by StudentCode 2(3). 1536 samples. time. sound_in(long time,
set_output_text(String text): Set the text short[] samples, int length).
too be displayed in TextView. sound_in(long time,
plot_camera_image(Canvas plotCanvas, 24Sound output 1(2). sound_out(short[]
byte[] image, int imageWidth,int buffer, int length). sound_out(short[]
imageHeight, int width, int height): buffer, int length).
Display a camera image. 25Sound output 2(2).
plot_camera_image_rgb(): Display color wavwrite(y,44100,16,bing.wav);
write_string_on_logfile(String): No \n copy_file_from_working_directory_to_sdcard
or ;. load_sound_file(String fileName) + bing.wav);
play_sound_file(int loop): Repeatedly load_sound_file("bing.wav");
plays the wav-file specified by fileName. play_sound_file(-1); stop_sound_file();
No timing gitter (loop=-1 means forever) Constant gaps.
stop_sound_file(): Stops the above. 26RGB Camera: Image format. void
9Called by StudentCode 3(3). camera_image_rgb(byte[] image, int width,
save_rgb_frame_on_file(String int height). 0. 1. 3.
filename,byte[] frame,int width,int image={r0,g0,b0,r1,g1,b1,r2,g2,b2,}. Byte
height,boolean append) : Saves an RGB 0-255.
picture (=frame) on file. public byte[] 27RGB Camera: File format. Filename
read_rgb_frame_from_file(int image_number, (example): video201303181626.rec. Always
String filename) : loads an RGB picture stored in /sdram/recordings.
(=frame) from file. 28RGB_Camera: GUI. Alt1: useSensors =
10Defined by StudentCode: Called by CAMERA_RGB; useCameraGUI=true; Stop. Play.
FrameWork 1(2). init(): Do all your Rec. Start.
initialization. start(): Called when menu 29RGB_Camera:No GUI. Alt1: useSensors =
button start is pressed. stop (): Called CAMERA_RGB; useCameraGUI=false; Camera
when menu button stop is pressed. runs continuously. void
message_in() Received message from other camera_image_rgb(byte[] image, int width,
phone. gps() position estimate int height). .is called. save pictures
magnetic_field() magnetic field to file using call:
measurement light() : . Light intensity save_rgb_frame_on_file(String
(lux) event (trigger when changed) filename,byte[] frame,int width,int
proximity(): Proximity state event height,boolean append).
(trigger when changed) accelerometer() 30Load RGB picture from file. int
accelerometer measurement process(), read_rgb_frame_width_from_file(int
Periodic processing with interval set by image_number, String filename) int
processInterval parameter. The read_rgb_frame_height_from_file(int
processInterval parameter can be changed image_number, String filename) byte[]
during runtime. You fill these functions read_rgb_frame_from_file(int image_number,
with code! String filename).
11Defined by StudentCode: Called by 31Display picture (example).
FrameWork 2(2). gyroscope() gyroscope plot_data(Canvas plotCanvas, int width,
measurement sound_in() sound input int height) { if((latestRGBImage != null)
samples wifi_ap() ... signal strength of && ((useSensors & CAMERA_RGB)
surrounding WiFi APs screen_touched() == CAMERA_RGB)) {
position event streaming_sound_in() plot_camera_image_rgb(plotCanvas,
buffer of samples (int16) received from latestRGBImage,ImageWidth,imageHeight,widt
other phone camera_image() image received ,height); };};
from camera (black and white) 32Pictures Matlab interface.
camera_image_rgb() image received from list=list_video_recordings_on_sdcard(time0
camera (color) plot_data(): Screen update. copy_video_recording_file_from_sdcard_to_
All are inputs except plot_data! You fill orking_directory(filename) rgb_video=
these functions with code! extract_video_recording_from_file(filename
12Your code structure. plot_data(Canvas ; image(rgb_video.frames{1}.rgb)
plotCanvas, { present results}. public create_video( filename, rgb_video )
void init() { set parameters rgb_video.frames{1}.rgb.
initialize}. Data structures algorithm 33Display pictures another way. void
state. camera_image_rgb() { save latest plot_data(Canvas plotCanvas, int width,
image new_image=true; public message_in () int height) { plotCanvas.drawLine(
{ process save}. public void process() plotCanvas.drawRect( }. More info:
{ heavy calculations http://developer.android.com/reference/and
set_output_text(s)}. oid/graphics/Canvas.html.
13The GUI. Press menu button. Press 34ZXING QR decoder. ZXing (pronounced
Start. Start() is called Sensors switched "zebra crossing") is an
+on etc. Start. Stop. Press menu + Stop. open-source, multi-format 1D/2D barcode
stop() is called. image processing library implemented in
14Threads (internals). Parent thread: Java To test: useSensor=CAMERA_RGB;
Indirectly calls init(). uncomment code in StudentCode.java between
studentProcessThread: Calls process(). zxing start color and zxing stop color
ipListenerThread: Calls message_in() Direct camera towards QR code Source code
guiTriggerThread: Renders what you provide located under
with set_output_text() and plot_data(). ExternalSrc.com.google.zxing.
t1: Calls sound_in() wifiScanThread: 35Give your App a unique identity. Right
calls wifi_ap() ipSoundListenerThread: click on project folder (Top level folder
calls streaming_buffer_in FrameWork named FrameWork) within the Package
implements OnRecordPositionUpdateListener: Explorer window Select Android
Calls gps() FrameWork implements Tools/Rename Application Package Add a
SensorEventListener accelerometer(), unique name after FrameWork like:
magnetic_field(), light(), proximity() se.kth.android.FrameWork.GroupRed2013
FrameWork extends Activity: Press Finish in the Refactoring window
sreen_touched() streaming_sound_in() Confirm update of Launch Configurations
buffer of samples (int16) sent from other Voila, you now have a separately
phone. installable version of your app!
15How communication between phones works 36Phone configuration. Samsung S3
1(2). A Linux computer connected to Settings -> developer options ->
internet acts as a server (the address of tick USB debugging Settings ->
which is given by messageServer). When Security and lock screen -> tick
FrameWork starts, it contacts the server Unknown sources HTC Desire Settings
and asks for the ip adress of one of the -> Applications -> Development
other phones in the project (a project is -> tick USB debugging Settings
defined by the projectName string e.g. -> Applications -> tick Unknown
yellow). The phone then contacts that sources When connecting to PC: choose
phone and gets a list of all other phones charge only Wifi (both):
in the project. When one phone calls http://www.lan.kth.se/eduroam/phones/phone
message_out(message) the message is sent _mobile_guide.html.
to all other phones in the project. The 37Assignments. Write letter C and D
other phones receives the message through in plot_data using the drawRect function
a call of message_in (callback). The of Canvas. Plot the letters using a system
message is of type StudentMessage and of bitmap fonts that you may design
contains the fields that you decide. yourself. Switch between the letters of
16How communication between phones work your group color every two seconds. Record
2(2). Second form of message_out: a sound and play it with two echoes. Make
message_out(message, groupIdString) Where an app running on two phones. When one of
groupIdString defines a group of users the phones is moved, the other phone
e.g. data_receivers which should receive beeps. Make an app which captures pictures
the message. Which groups exist ? You and classifies them as mostly red, green,
define the groups with the messageGroups blue or yellow. The result is displayed in
parameters. When FrameWork starts, it asks the text window. Make an app which sends
the user which group the phone belongs to. audible pulses from one phone. Run the app
When sending buffers of int16 use the on two phones (with distinguishable
following version: pulses). Make another app which estimates
streaming_buffer_out(buffer,length, the difference between the sample-clocks
groupIdString) This data is received of the two phones by listening to the
through: streaming_buffer_in( buffer, int aforementioned pulses. Make a test-harness
length, senderId). for a non-trivial algorithm which is
17How to use communication between relevant for your project. Deadline :
phones 1(2). Set useMessaging = true; If Mid-term evaluation.
you need groups: String temp[] = 38Hints. Start command line prompt in
{"MICROPHONE","SPEAKER" windows 7: press windows_button+r, then
}; messageGroups = temp; Otherwise: run cmd.exe. Android software developers
messageGroups = null; In both cases: kit:
messageServerType = LINUX_MESSAGE_SERVER; http://developer.android.com/sdk/index.htm
messageServer = "192.168.0.68"; Killing tasks. Download and install
Define StudentMessage (defined in Advanced Task Killer Free (ATKF). To
StudentMessage.java). Which message group kill e.g. StudentFrameWork open ATFK
do this phone belong to ?: press StudentFrameWork until a new menu
messageGroups[myGroupID]. appears where you can select Kill Error
18How to use communication between message: ActivityManager: Warning:
phones 2(2). public class StudentMessage Activity not started, its current task has
extends StudentMessageBase { // Add your been brought to the front => Change a
message fields here // do not use single line in the source files code and
primitive types that begins with lower try again. Error
case letters Float dummy=0.0F; /* Example message:FrameWork_empty_130319]
of student message data */ Boolean Re-installation failed due to different
is_sync_message; Boolean application signatures => Do uninstall
is_distance_message; Float value1; Float se.kth.android.FrameWork from command
value2; Float value3; Float value4; }. line prompt.
Welcome to EQ2430\EQ2440 Android Lecture.ppt
http://900igr.net/kartinka/anglijskij-jazyk/welcome-to-eq2430eq2440-android-lecture-240647.html
c

Welcome to EQ2430\EQ2440 Android Lecture

Welcome to EQ2430\EQ2440 Android Lecture

My country Russia - The capital of Russia - Moscow. The red colour has always meant love and bravery. It flows into the Caspian Sea. Russia has a population of about 145,600 people. The stripes are white, blue and red. Summer temperatures in Russia from +1 to +40, and in winter from -1 to -50 degrees. Russia is situated on two continents: Europe and Asia.

- This gun was never fired. . ? ? ? , , . . Before the revolution it had up to 200 small shops. It is located at the Kremlin wall in the Alexander Garden.

Moscow sights - Game. Hospitable. St Basils Cathedral. . Insert the articles where necessary. Choose the right answer. Read the sentence. The founder of the Tretyakov Gallery. . A Famous Sight of Moscow.

Russia - Monument a Millenium Russia in Novgorod. Mausoleum Lenina in Moscow. The Hermitage in Sankt-Peterburge. Welcome to Russia. At present the president is-Medvedev Dmitry Anatolievich. Monument the tsar of a down in Moscow. Dvortsovo-park ensemble "Peterhof " on the bank of a southern Finnish gulf.

- Arkhangelskiy Cathedral. I love Moscow very much. Bell tower of Ivan the Great. The city is situated on seven hills. Moscow is an old city. Now Moscow is the biggest and most wonderful city in Russia. Kutuzovskiy prospect. Andreevskiy Bridge. The Church of Ascension. Pokrovskiy cathedral. Blagoveshshenskiy Cathedral.

About Russia - Excellent for 3-5. Cheryl L. Enderlein. www.russia.com/photos/. Lets visit some important cities in Russia. The capital of Russia is Moscow. Sarah DeCapua. The language spoken is Russian. Irkutsk, in Siberia. Russia is famous for (Click on each name for more information.). The money used is the ruble.

8

29
900igr.net > > > Welcome to EQ2430\EQ2440 Android Lecture