GSoC 17: Add Audio, Video and SOS input support in MapMint4ME

== Introduction ==
=== Idea ===
This project aims to include the audio, video, and SOS(Sensor Observation Service) input support to the MapMint4ME. MapMint4ME is an android application for MapMint web-service. MapMint is an internet-based Geographic Information System(GIS), designed to facilitate the deployment of Spatial Data Infrastructure(SDI). In an SDI, geographic data, metadata, tools, and the users are connected in an interactive manner in a framework so as to use the spatial information in an efficient and flexible way.
The MapMint is built on top of the ZOO-Project. The ZOO-Project is an SDI manager which gives the users the capability of building their own map and web-applications.
===Project proposal===
My proposal for GSoC 2017 can be found at: Proposal.
=== Advantages from this project ===
Audio and Video data is an important feature for creating an instance of the real world scenario. Many times, GIS users require collecting data from locations where the internet is not accessible. The idea is to store the data locally at that time and then storing that to the database, once the internet connectivity is possible. Also, It is not possible for the human to reach every corner of the world and take data continuously. For such situations, sensors could be deployed and the sensor data could be directly retrieved to the database using MapMint4ME.
== Reports ==
=== May 4 - May 14===
# The part, I completed in this period:
* Installed MapMint.
* Tried to understand the code flow of MapMint. 
# The part, I plan to complete in the upcoming period:
 
* Publish data using MapMint and continue to understand the code flow of MapMint4ME.
# Learning outcomes and the problems faced:
 
* The dependencies should be checked before installation. The issues which I faced during installation are compiled in points and can be followed at url.
=== May 15 - May 31===
# What I have done in this period?
* Introduced myself to the ZOO-project community. It was a splendid feeling to interact with the developers who already are the masters' of their domain. :) 
* I installed the tables and import modules in the MapMint. The tables module helps in viewing the database.
* I published the local map data using MapMint. Though I got stuck due to some errors. I am working on it so that the local map data of my region can be published without any errors.
* Refreshed concepts of Android development and Java. Some of the links I referred are compiled here.
* I learned Interoperability. There was some issues with the Table and Importer module in my instance of MapMint, so I studied that.
# Plans for the upcoming period-
* Continuing the study of Android development so that it will help in the main coding period.
* Learning about the tools for documentation of the project.
* Modify the Table module mm_tables.ftypes so that the sensor input can be included for MapMint4ME.
=== Official Coding Period===
Week 1 
As they say- "Just when the caterpillar thought that it's the end of the world, it became a butterfly." I feel my improvement in this week with the project was a bit slow. But, I also feel that once I gain the wings, it will get better. The community bonding period helped a lot in understanding the community and the project. I am still facing some issues in understanding the concepts and I am working on that. The consolidated points explaining this weeks work are as follows:
# What did I complete this week?
* Studied the user guide of MapMint for a complete understanding of the modules.
* Did some data mining and found workshops featuring MapMint, ZOO-project, and MapServer. Checked some of the workshops.
* The primary task, for now, is to publish the local data of my region using MapMint. 
* Rectified the error with the Distiller module. This ticket helped in solving the error.
* Continued studying Android development and concepts of JAVA. 
# What do I plan to achieve the next week?
* My primary and most important task to accomplish is to publish local data using MapMint. This is important as MapMint4ME will be using MapMint.
* I have successfully setup the MapMint in my local machine. But, there are some issues in the local instance. I will try to sort them out.
# Is there any blocking issue?
* Yes, initially, I faced some issue in understanding the different modules of the MapMint. But, after following the MapMint user guide, I started understanding their functionality. 
Week 2 
I got to read a new quote some days back- Success is about moving from failure to failure without losing enthusiasm. I was able to publish the map of Mumbai, India and IIT Bombay, India (my institute) using the MapMint. It was a pleasing experience. The consolidated points explaining this week's work are as follows:
# What did I complete this week?
* Published local data using MapMint. The local data is of Mumbai(19.07° N, 72.87° E) which is a city in India. I have tried to compile the points in the link.
* I tried to setup Tables and Importers module of MapMint in my local instance. I got a lot of help from the issues created on the MapMint Github repository. I am still trying to set it up and publish the tables. The Tables module will be helpful in importing the created tables from MapMint4ME.
* Continued studying Android development and concepts of JAVA. 
# What do I plan to achieve the next week?
* The primary task, for now, is to set up the Tables module in the MapMint successfully. 
* To start accessing Tables module from the MapMint4ME. 
# Is there any blocking issue?
* Currently, I am blocked with publishing tables using Tables and Importers module. But, I feel, I should be able to get over it as soon as possible. 
Week 3 
The consolidated points explaining this week's work are as follows:
# What did I complete this week?
* I published the tables (relations) using Tables module of the MapMint successfully. Although there are some issues, but those will be rectified soon. 
# What do I plan to achieve the next week?
* Creating and setting edition forms using Tables module which will be accessed from the MapMint4ME. The tables should be editable from both Web interface and the Android application.
* To start accessing Tables module from the MapMint4ME. 
# Is there any blocking issue?
* Currently, I am not blocked on anything.
Week 4 
The consolidated points explaining this week's work are as follows:
# What did I complete this week?
* Rectified issues in the publication of Tables module.
* Edited Forms generated using MapMint(Web interface) from Tables Management Module.
* Setup the MapMint4ME android application in Android-studio and successfully accessed MapMint software from the browser of emulated device.
* Setup and connected with the local server and started with importing data from database from the MapMint4ME application. Some issues need to be fixed for this purpose, currently, I am working on those.
# What do I plan to achieve the next week?
* To access the Tables module for the edition of forms from the MapMint4ME. 
* Moving towards adding the audio/video input capabilities in the application. 
# Is there any blocking issue?
* Currently, I am not blocked.
Week 5 
This week, I was suffering from infection because of which I was not able to work for 2 days (28th and 29th, June 2017). I utilized these 2 days to complete my blogpost describing GSoC Phase 1 experience. The consolidated points explaining the rest of the week's work are as follows:
# What did I complete this week?
* Setup the GetStatus service for my emulated Android device using the ZOO-services.
# What do I plan to achieve the next week?
* The primary aim is to connect the server of my development machine to the MapMint4ME application in the emulated device. After that only, I will be able to publish and edit the tables from MapMint4ME(application) by using MapMint(web instance). Hence, proceed with the addition of Audio, Video input capabilities in the MapMint4ME.
* Parallel to this, I have to start setting up the Sensor module for SOS input capability. This will involve setting up Temperature sensor, Humidity sensor, and Smoke Sensor. 
# Is there any blocking issue?
* I was blocked due to health issues but I am recovering fast. I will catch up from here on.
Week 6 
The consolidated points explaining this week's work are as follows:
# What did I complete this week?
* Successfully connected the server of my development machine to the MapMint4ME application in the emulated device.
* Moved a step further with the issues related to importing data from MapMint4ME. It took some time in getting acquainted with the Android Studio. 
* Studied and refreshed about the Sensors(Temperature, Humidity, Smoke) and Arduino Uno microcontroller. 
# What do I plan to achieve the next week?
* The primary task is to import data from the MapMint4ME. Using the MM4ME application publish and edit the tables. 
* Start with the Arduino microcontroller programming to interact with the Sensors. 
# Is there any blocking issue?
* Currently, I am blocked in importing data from MM4ME because of being new to the Android Studio. With time, I am getting acquainted with it and will come out of the blocking soon.
Week 7 
The consolidated points explaining this week's work are as follows:
# What did I complete this week?
* Accessed and Edited tables using MapMint4ME. More details can be found by following the link.
* Added HTML files for video input in the MapMint4ME android application. The files can be seen at the link.
* Completed functions for audio and video support in the MapMint4ME.java. Some issues need to fixed though. More details can be obtained by following the link.
# What do I plan to achieve the next week?
* Solve the issues related to Audio and Video support and store the captured media to database.
* Complete the JavaScript functions for Web View to connect the JavaScripts files to the MapMint4ME.java.
* Publish the Map from the MapMint4ME app. 
# Is there any blocking issue?
* Currently, I am not blocked.
Week 8 
This week, I worked with Arduino and different sensors. It was a great feeling. My first project in Bachelors involved designing of a real-time database management system using temperature, humidity and Gas sensor. As they say- "History repeats itself"; again I setup the DHT 11 and MQ2 sensors, this time with Bluetooth module (HC-05). 
I would like to acknowledge Mr. Tanmay Jambhekar and SYSLAB for their support.
The consolidated points explaining this week's work are as follows:
# What did I complete this week?
* Added HTML files for audio input. The files can be seen by following the link.
* Solved issue for implementing video recording from the MapMint4ME. Before this, I was not able to invoke Camera from the app. The update can be obtained by following the link.
* Setup and Calibrated the Temperature & Humidity sensor (DHT 11) [1], Gas sensor (MQ 2) [2], and Bluetooth module (HC-05) [3] for SOS input support. The HC-05 is not showing consistent outputs for AT commands, I am working on it now. The details can be obtained by following the below mentioned links.
[1]: Temperature and humidity sensor
[2]: Gas Sensor calibration
[3]: Bluetooth module setup
# What do I plan to achieve the next week?
* Access the captured video and audio files from the MapMint4ME and store it in the database. This will help in publishing the map with included details.
* Combine sensors and the Bluetooth module together as a single SOS unit. Send the sensor readings to the MapMint4ME application.
# Is there any blocking issue?
* Currently, I am not blocked. 
Week 9 
The consolidated points explaining this week's work are as follows:
# What did I complete this week?
* Made some changes to functions for audio recording in MapMint4ME.java file. Prior to this, I was getting a NullPointerException error on invoking audio recording function. Now that error is rectified. The details of the changes can be seen by following the link: link.
* Discussed about the storage format of the video/ audio files. Read about storing video/ audio files in BLOB (Binary format) and also about MediaCodec, MediaRecorder functionalities of Android. I also read a bit about SQLite databases.
* Tried to send data through Bluetooth module using AT commands but still stuck with it. Currently, I am working on this.
# What do I plan to achieve the next week?
* Store the video and audio files captured using emulated Android device to the embedded database of MapMint4ME. 
* I will continue working on combining sensors and the Bluetooth module together as a single SOS unit. Send the sensor readings to the MapMint4ME application. 
# Is there any blocking issue?
* Currently, I am not blocked.
Week 10 
The consolidated points explaining this week's work are as follows:
# What did I complete this week?
* Added the video recording capability to the Editing tables functionality. The details can be obtained by following the link
# What do I plan to achieve the next week?
* Store the video and audio files captured using emulated Android device to the embedded database of MapMint4ME. 
* I will continue working on combining sensors and the Bluetooth module together as a single SOS unit. Send the sensor readings to the MapMint4ME application. 
# Is there any blocking issue?
* Because of some academic commitments, I am blocked for sometime. But, I feel I will be able to balance everything very soon. 
Week 11 
Finally, I was able to setup the Bluetooth module's(HC-05) AT command issue. Now, I am able to pair Bluetooth module with my cell phone. The consolidated points explaining this week's work are as follows:
# What did I complete this week?
* This week, I completed the video recording functionality in the EDIT tab of MapMint4ME. The video captured using the emulated device is stored in binary format in the embedded database. More details can be obtained by following the link.
* Setup the Bluetooth module (HC-05) successfully. Now, I am able to pair the module with my cell phone. This will help me in transferring the sensor data (Temperature & humidity, and Gas & Smoke sensor values) to the MapMint4ME via Bluetooth module.
# What do I plan to achieve the next week?
* Complete the SOS input capability. The sensor readings should be visible in the MapMint4ME.
* Complete the documentation and prepare for final project submission.
# Is there any blocking issue?
* Currently, I am not blocked.
Week 12 
The consolidated points explaining this week's work are as follows:
# What did I complete this week?
* Completed GetSos.java class for getting readings from the SOS module. The details are available at the link.
* Combined Temperature and Humidity sensor, Gas and Smoke sensor, Bluetooth module and Arduino UNO as single SOS module. The details can be seen by following the link.
* Completed SOS and text data input capability in the same EDIT tab. Now, user gets option to select whether he wants to import SOS readings or enter text. The details can be obtained by following the link.
* Completed examples as documentation displaying the audio, video and SOS input capability.
The Final project report for GSoC 2017 can be obtained by following the link.
The examples displaying the audio, video, and SOS input support functionality can be seen here.
Link to the changes made in the code: Github commit history
Link to Github repository: Repo
== Student's Biography ==
My name is Rajat Chandrashekhar Shinde. I am an Electronics and Telecommunication graduate, pursuing my Master's degree in Geoinformatics and Natural Resources Engineering under Centre of Studies in Resources Engineering, Indian Institute of Technology Bombay, Mumbai, India. 
Some more information about me can be obtained by following the link: http://bighome.iitb.ac.in/~rajatshinde
Category: Google Summer of Code