-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_gprs.jl
45 lines (32 loc) · 919 Bytes
/
test_gprs.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
using LibSerialPort
using TOML
using Dates
using PiGPIO
using LoggingExtras
using URIs
using GSMHat
import GSMHat: start_modem, waitfor, enable_gnss, get_gnss, send_message, cmd, unlook
@info "starting $(Dates.now())"
confname = joinpath(dirname(@__FILE__),"drifter-diy.toml")
config =
open(confname) do f
TOML.parse(f)
end
phone_number = config["phone_number"]
local_SMS_service_center = config["local_SMS_service_center"]
pin = config["pin"]
APN = config["access_point_network"]
portname = config["portname"]
baudrate = config["baudrate"]
@info "phone number $phone_number"
sp = GSMHat.init(portname, baudrate; pin=pin)
GSMHat.enable_network(sp,APN)
data = Dict(
"longitude" => -12,
"latitude" => 12.2,
"drifter" => gethostname())
method = "get"
url = "http://139.165.57.31/upload/Alex"
#method = "post"
#url = "http://52.45.189.24/post"
out = GSMHat.http(sp,method,url,data)