62 lines
1.8 KiB
Python
62 lines
1.8 KiB
Python
import csv, requests
|
|
from instruments import Camera_Debug2 as Camera
|
|
from datahandling import Datareporter_Debug3 as Datareporter
|
|
from system import System_Debug
|
|
import serial
|
|
import sys
|
|
import logging
|
|
import base64
|
|
from requests_toolbelt import MultipartEncoder
|
|
|
|
logging.getLogger("datahandling")
|
|
|
|
data = {"temp":1,"press":3,"altitude":2,"cheetas":"just enough"}
|
|
|
|
pass
|
|
|
|
com_port_name = "/dev/ttyAMA0"
|
|
|
|
image = open("resized_image.jpg", 'rb')
|
|
# image = image.read()
|
|
|
|
# e=base64.b64encode(image)
|
|
|
|
# e=b'alksdjnfkljanslkjnaklsfnglkanlkfgnlakalksdjnaklsfnglkajnaklsfnglkanlkfgnlakalksdjnfkljanslkjnglkjnaklsfnglkanlkfgnlakalksdjnfkljanslkjnglknlkfgnlakalksdjnfkljanslkjnglkanlkfgnlakalksdjnfkljanngnlakalksdjnfkljanslkjnglkanlkfgnlakalksdjnfkljannlkanlkfgnlakalksdjnfkljannglkanlkfgnlakalksdjnfkljannglkanlkfgnlakalksdjnfkl=='
|
|
|
|
# m = MultipartEncoder(fields={'image': ('image', image, 'image/jpeg')})
|
|
|
|
report = Datareporter (
|
|
use_lan = True,
|
|
url = "http://home.ascorrea.com",
|
|
server_port = 5010,
|
|
data_path = "upload-data",
|
|
image_path = "upload-file",
|
|
com_port_name="/dev/ttyAMA0",
|
|
ping_path="ping",
|
|
baud_rate = 9600)
|
|
|
|
camera = Camera (low_quality_compression_pct=10,
|
|
low_quality_resolution=(320, 240),
|
|
high_quality_compression_pct=100,
|
|
high_quality_resolution=(2592,1944),
|
|
vflip=True,
|
|
hflip=True,
|
|
exposure_mode='sports'
|
|
)
|
|
|
|
# print (report.check())
|
|
# print (image)
|
|
# report.send(m.to_string(), message_type="image")
|
|
# report.send(data, message_type="data")
|
|
|
|
img = camera.capture()
|
|
report.send(img.get('lo'), message_type="image")
|
|
|
|
# report.send(image, message_type="image")
|
|
|
|
|
|
# execfile("test_sms.py")
|
|
|
|
# report.send("1",message_type="ping")
|
|
|
|
pass |