& lt; code class = & quot; bash & quot; & gt; malefic @ lepeshka: ~ $ adb devices List of devices attached 64cb5c59 recovery & lt; / code & gt; pre> Mount system:
& lt; code class = & quot; bash & quot; & gt; malefic @ lepeshka: ~ $ adb shell mount -o rw -t ext4 /dev/block/platform/msm_sdcc.1/by-name/system / system & lt; / code & gt; pre> to add the lines in /system/build.prop:
& lt; code class = & quot; bash & quot; & gt; malefic @ lepeshka: ~ $ adb shell & quot; echo \ & quot; persist.service.adb.enable = 1 \ & quot; & Gt; & gt; /system/build.prop" & Lt; / code & gt; pre> Reboot:
& lt; code class = & quot; bash & quot; & gt; malefic @ lepeshka: ~ $ adb reboot & lt; / code & gt; pre> We are waiting for loading, check the status of the terminal adb:
& lt; code class = & quot; bash & quot; & gt; malefic @ lepeshka: ~ $ adb devices List of devices attached 64cb5c59 device & lt; / code & gt; pre> Bingo! Debugging is on, let's see what we've got going on on your phone for this run AndroidScreenCast using Java Web Start and see:
This screen activation simkarty Verizon, I do not have a sim card, so I'll just skip activation, acting on the instructions:
in the selection screen language consistently touch screen lower left corner (above the emergency call), the lower right corner, bottom left, bottom right, and the volume + blockquote> Namely:
& lt; code class = & quot; bash & quot; & gt; malefic @ lepeshka: ~ $ adb shell input tap October 1150 malefic @ lepeshka: ~ $ adb shell input tap 710 1150 malefic @ lepeshka: ~ $ adb shell input tap October 1150 malefic @ lepeshka: ~ $ adb shell input tap 710 1150 & lt; / code & gt; pre> Then press the button on the smartphone Vol Up, now see:
Put a check mark and click OK:
& lt; code class = & quot; bash & quot; & gt; malefic @ lepeshka: ~ $ adb shell input tap 50,600 malefic @ lepeshka: ~ $ adb shell input tap 650 600 & lt; / code & gt; pre>
Svaypaem to unlock the screen:
& lt; code class = & quot; bash & quot; & gt; malefic @ lepeshka: ~ $ adb shell input swipe 100 100 500 100 & lt; / code & gt; pre>
Now you need to put some vnc-server for Android, for example, Android VNC Server . Install it on your smartphone:
& lt; code class = & quot; bash & quot; & gt; malefic @ lepeshka: ~ $ adb install droid + VNC + server + v1.1RC0.apk 4055 KB / s (2084419 bytes in 0.501s) pkg: / data / local /tmp/droid+VNC+server+v1.1RC0.apk Success & lt; / code & gt; pre> We awake smartphone, as it is likely to fall asleep until we installed vnc-server and svaypaem, that unlock the screen:
& lt; code class = & quot; bash & quot; & gt; malefic @ lepeshka: ~ $ adb shell input keyevent 26 malefic @ lepeshka: ~ $ adb shell input swipe 100 100 500 100 & lt; / code & gt; pre> Run vnc -server:
& lt; code class = & quot; bash & quot; & gt; malefic @ lepeshka: ~ $ adb shell am start -a android.intent.action.Main -n org.onaips.vnc / .MainActivity & lt; / code & gt; pre>
Click OK:
& lt; code class = & quot; bash & quot; & gt; malefic @ lepeshka: ~ $ adb shell input tap 50900 & lt; / code & gt; pre>
Click Start:
& lt; code class = & quot; bash & quot; & gt; malefic @ lepeshka: ~ $ adb shell input tap 350 300 & lt; / code & gt; pre>
Click to grant access:
& lt; code class = & quot; bash & quot; & gt; malefic @ lepeshka: ~ $ adb shell input tap 600 1000 & lt; / code & gt; pre>
Ok, now are forwarding ports through adb:
& lt; code class = & quot; bash & quot; & gt; malefic @ lepeshka: ~ $ adb forward tcp: 5801 tcp: 5801 malefic @ lepeshka: ~ $ adb forward tcp: 5901 tcp: 5901 & lt; / code & gt; pre > and go through the browser on your smartphone, or your favorite vnc client.
Further work as a conventional Android phone, only through a computer, it is convenient to set up WiFi connection, then we can go on vnc via WiFi, but not all the time to keep the phone connected to the computer (after gas meter is not always located in the vicinity of the computer.)
Now, when the interaction with the device is fully established, you can proceed to configure the photography and publishing data on the Internet.
Periodic photographing h6> install applications Tasker , create it with the time profile of 00:00 to 23:59 every 30 minutes to perform an action - to do the photo. Shooting Options select the most suitable location for the phone and the counter. I have this macro with the obligatory flash.
That's the way, actually, I placed my phone (top view):
Cardboard box tied with string to the counter, it is home to a smartphone, packing of eggs there to fix your smartphone in a vertical position. I then more refined design with adhesive tape and cardboard to the flash does not beat directly into the face, it gives a serious glare, preventing recognition. On top of all the closed lid to inside was dark, or in bright ambient light is not always correct autofocus works.
In the setting of the smartphone in the media developer should definitely put a check mark to the smartphone did not fall asleep at the connected charging, and then at some point he stops to photograph and only if it continues to disturb.
to spread in the Internet h6> to move the captured images of the counter in the Internet, I used the first available application - FolderSync Lite . It is able to synchronize a folder with a folder on your smartphone such as Google Drive.
Thus, I can now from anywhere in the world where there is Internet access, go to your Google drive and verify that the gas boiler is operating normally.
Part 2: Detection of indications h4> So, after sending the meter reading on the Internet, I became interested in the possibility of automatic recognition of evidence. This will allow:
- to conduct a statistical analysis of gas consumption
- automatically track shortages of gas (with a warning by e-mail or sms)
As a development language was selected python, for imaging use the library OpenCV .
Here is the code of the main program, which is run by the crown once an hour:
& lt; code class = & quot; python & quot; & gt; import sys import os from models import getImage, sess from gdrive import getImagesFromGDrive, createImageFromGDriveObject if __name__ == '__main__': # get a list of new photos from Google disk images, http = getImagesFromGDrive () # alternately process them in a loop for img_info in images: # download images img = createImageFromGDriveObject (img_info, http) file_name = img_info ['title'] # look for an entry in the database try: dbimage = getImage (os.path.basename ( file_name)) dbimage.img = img dbimage.download_url = img_info [& quot; downloadUrl & quot;] dbimage.img_link = img_info ['webContentLink']. replace ('& amp; export = download', '') except ValueError as e: print e continue # recognizes the indication dbimage.identifyDigits () # save the data into the database sess.commit () & lt; / code & gt; pre> It uses the function code which I'll post below:
-
getImagesFromGDrive code> pre> - a function that returns a list of not yet recognize the images from Google Drive -
createImageFromGDriveObject code> pre> - function, download the image itself and converts it into a format OpenCV -
getImage code> pre> - function searches for a record of the images in the database, if not, then create it -
identifyDigits code> pre> - method recognizing the testimony in this image -
http code> pre> - authorized client to access Google Drive, details about access to the API disk read < a href = "https://developers.google.com/drive/web/quickstart/quickstart-python"> here