-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathmonarch.toit
More file actions
73 lines (57 loc) · 1.86 KB
/
monarch.toit
File metadata and controls
73 lines (57 loc) · 1.86 KB
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
// Copyright (C) 2022 Toitware ApS. All rights reserved.
// Use of this source code is governed by an MIT-style license that can be
// found in the LICENSE file.
import log
import uart
import gpio
import .sequans
import ...base.at as at
import ...base.base as cellular
import ...base.cellular as cellular
import ...base.service show CellularServiceProvider
/**
This is the driver and service for the Sequans Monarch module. The easiest
way to use the module is to install it in a separate container and let
it provide its network implementation as a service.
You can install the service through Jaguar:
$ jag container install cellular-monarch src/monarch.toit
and you can run the example afterwards:
$ jag run examples/monarch.toit
Happy networking!
*/
main:
service := MonarchService
service.install
// --------------------------------------------------------------------------
class MonarchService extends CellularServiceProvider:
constructor:
super "sequans/monarch" --major=0 --minor=1 --patch=0
create-driver -> cellular.Cellular
--logger/log.Logger
--port/uart.Port
--rx/gpio.Pin?
--tx/gpio.Pin?
--rts/gpio.Pin?
--cts/gpio.Pin?
--power/gpio.Pin?
--reset/gpio.Pin?
--baud-rates/List?:
// TODO(kasper): If power or reset are given, we should probably
// throw an exception.
return Monarch port logger
--uart-baud-rates=baud-rates or [921_600]
/**
Driver for Sequans Monarch, GSM communicating over NB-IoT & M1.
*/
class Monarch extends SequansCellular:
constructor port/uart.Port logger/log.Logger --uart-baud-rates/List:
super port
--logger=logger
--uart-baud-rates=uart-baud-rates
--use-psm=false
network-name -> string:
return "cellular:monarch"
on-connected_ session/at.Session:
// Do nothing.
on-reset session/at.Session:
// Do nothing.