Skip to content

Commit 3652231

Browse files
committed
Another pass of kebabifying
1 parent f02d680 commit 3652231

30 files changed

+359
-390
lines changed

src/messages/m10008-preset-page.toit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import ..protocol as protocol
33
class PresetPage extends protocol.Data:
44
static MT := 10008
55

6-
static toMsg -> protocol.Message:
6+
static to-msg -> protocol.Message:
77
msg := protocol.Message MT
88
return msg
99

src/messages/m10009-text-page.toit

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ class TextPage extends protocol.Data:
1111
static LINE-4 := 103
1212
static LINE-5 := 104
1313

14-
static toMsg --pageId/int --pageTitle/string?=null --statusBar/bool?=false --line1/string?=null --line2/string?=null --line3/string?=null --line4/string?=null --line5/string?=null -> protocol.Message:
14+
static to-msg --page-id/int --page-title/string?=null --status-bar/bool?=false --line1/string?=null --line2/string?=null --line3/string?=null --line4/string?=null --line5/string?=null -> protocol.Message:
1515
msg := protocol.Message MT
16-
msg.data.add-data-uint PAGE-ID pageId
17-
if pageTitle:
18-
msg.data.add-data-ascii PAGE-TITLE pageTitle
19-
if statusBar:
16+
msg.data.add-data-uint PAGE-ID page-id
17+
if page-title:
18+
msg.data.add-data-ascii PAGE-TITLE page-title
19+
if status-bar:
2020
msg.data.add-data-uint8 STATUS-BAR 1
2121
if line1:
2222
msg.data.add-data-ascii LINE-1 line1
@@ -34,13 +34,13 @@ class TextPage extends protocol.Data:
3434
constructor.from-data data/protocol.Data:
3535
super.from-data data
3636

37-
pageId -> int:
37+
page-id -> int:
3838
return get-data-uint PAGE-ID
3939

40-
pageTitle -> string:
40+
page-title -> string:
4141
return get-data-ascii PAGE-TITLE
4242

43-
statusBar -> int:
43+
status-bar -> int:
4444
return get-data-uint8 STATUS-BAR
4545

4646
line1 -> string:
@@ -60,9 +60,9 @@ class TextPage extends protocol.Data:
6060

6161
stringify -> string:
6262
return {
63-
"Page ID": pageId,
64-
"Page Title": pageTitle,
65-
"Status Bar": statusBar,
63+
"Page ID": page-id,
64+
"Page Title": page-title,
65+
"Status Bar": status-bar,
6666
"Line 1": line1,
6767
"Line 2": line2,
6868
"Line 3": line3,

src/messages/m10010-menu-page.toit

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,14 @@ class MenuPage extends protocol.Data:
2828
static ITEM-19 := 118
2929
static ITEM-20 := 119
3030

31-
static toMsg --pageId/int --pageTitle/string?=null --initialItemSelection/int?=null --items/List -> protocol.Message:
31+
static to-msg --page-id/int --page-title/string?=null --item-initial-selection/int?=null --items/List -> protocol.Message:
3232
msg := protocol.Message MT
3333
msg.data.add-data-uint8 ITEM-COUNT items.size
34-
msg.data.add-data-uint PAGE-ID pageId
35-
if pageTitle:
36-
msg.data.add-data-ascii PAGE-TITLE pageTitle
37-
if initialItemSelection:
38-
msg.data.add-data-uint8 INITIAL-ITEM-SELECTION initialItemSelection
34+
msg.data.add-data-uint PAGE-ID page-id
35+
if page-title:
36+
msg.data.add-data-ascii PAGE-TITLE page-title
37+
if item-initial-selection:
38+
msg.data.add-data-uint8 INITIAL-ITEM-SELECTION item-initial-selection
3939
i := 0
4040
items.do:
4141
msg.data.add-data-ascii (ITEM-1 + i) it
@@ -45,16 +45,16 @@ class MenuPage extends protocol.Data:
4545
constructor.from-data data/protocol.Data:
4646
super.from-data data
4747

48-
itemCount -> int:
48+
item-count -> int:
4949
return get-data-uint8 ITEM-COUNT
5050

51-
pageId -> int:
51+
page-id -> int:
5252
return get-data-uint PAGE-ID
5353

54-
pageTitle -> string:
54+
page-title -> string:
5555
return get-data-ascii PAGE-TITLE
5656

57-
initialItemSelection -> int:
57+
item-initial-selection -> int:
5858
return get-data-uint8 INITIAL-ITEM-SELECTION
5959

6060
items -> List:
@@ -68,9 +68,9 @@ class MenuPage extends protocol.Data:
6868

6969
stringify -> string:
7070
return {
71-
"Item Count": itemCount,
72-
"Page ID": pageId,
73-
"Page Title": pageTitle,
74-
"Initial Item Selection": initialItemSelection,
71+
"Item Count": item-count,
72+
"Page ID": page-id,
73+
"Page Title": page-title,
74+
"Initial Item Selection": item-initial-selection,
7575
"Items": items,
7676
}.stringify

src/messages/m10011-draw-bitmap.toit

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -11,57 +11,57 @@ class DrawBitmap extends protocol.Data:
1111
static BITMAP-OVERLAY := 26
1212
static DONT-DRAW := 27
1313

14-
static toMsg --pageId/int?=null --bitmapX/int=0 --bitmapY/int=0 --bitmapWidth/int --bitmapHeight/int --bitmapData/ByteArray --bitmapOverlay/bool=false --dontDraw/bool=false -> protocol.Message:
14+
static to-msg --page-id/int?=null --bitmap-x/int=0 --bitmap-y/int=0 --bitmap-width/int --bitmap-height/int --bitmap-data/ByteArray --bitmap-overlay/bool=false --dont-draw/bool=false -> protocol.Message:
1515
msg := protocol.Message MT
16-
if pageId:
17-
msg.data.add-data-uint PAGE-ID pageId
18-
msg.data.add-data-uint BITMAP-X bitmapX
19-
msg.data.add-data-uint BITMAP-Y bitmapY
20-
msg.data.add-data-uint BITMAP-WIDTH bitmapWidth
21-
msg.data.add-data-uint BITMAP-HEIGHT bitmapHeight
22-
msg.data.add-data BITMAP-DATA bitmapData
23-
if bitmapOverlay:
16+
if page-id:
17+
msg.data.add-data-uint PAGE-ID page-id
18+
msg.data.add-data-uint BITMAP-X bitmap-x
19+
msg.data.add-data-uint BITMAP-Y bitmap-y
20+
msg.data.add-data-uint BITMAP-WIDTH bitmap-width
21+
msg.data.add-data-uint BITMAP-HEIGHT bitmap-height
22+
msg.data.add-data BITMAP-DATA bitmap-data
23+
if bitmap-overlay:
2424
msg.data.add-data-uint8 BITMAP-OVERLAY 1
25-
if dontDraw:
25+
if dont-draw:
2626
msg.data.add-data-uint8 DONT-DRAW 1
2727
msg.header.data.add-data-uint8 protocol.Header.TYPE-MESSAGE-METHOD protocol.Header.METHOD-SET
2828
return msg
2929

3030
constructor.from-data data/protocol.Data:
3131
super.from-data data
3232

33-
pageId -> int:
33+
page-id -> int:
3434
return get-data-uint PAGE-ID
3535

36-
bitmapX -> int:
36+
bitmap-x -> int:
3737
return get-data-uint BITMAP-X
3838

39-
bitmapY -> int:
39+
bitmap-y -> int:
4040
return get-data-uint BITMAP-Y
4141

42-
bitmapWidth -> int:
42+
bitmap-width -> int:
4343
return get-data-uint BITMAP-WIDTH
4444

45-
bitmapHeight -> int:
45+
bitmap-height -> int:
4646
return get-data-uint BITMAP-HEIGHT
4747

48-
bitmapData -> ByteArray:
48+
bitmap-data -> ByteArray:
4949
return get-data BITMAP-DATA
5050

51-
bitmapOverlay -> int:
51+
bitmap-overlay -> int:
5252
return get-data-uint8 BITMAP-OVERLAY
5353

54-
dontDraw -> int:
54+
dont-draw -> int:
5555
return get-data-uint8 DONT-DRAW
5656

5757
stringify -> string:
5858
return {
59-
"Page ID": pageId,
60-
"Bitmap X": bitmapX,
61-
"Bitmap Y": bitmapY,
62-
"Bitmap Width": bitmapWidth,
63-
"Bitmap Height": bitmapHeight,
64-
"Bitmap Data": bitmapData,
65-
"Bitmap Overlay": bitmapOverlay,
66-
"Don't Draw": dontDraw,
59+
"Page ID": page-id,
60+
"Bitmap X": bitmap-x,
61+
"Bitmap Y": bitmap-y,
62+
"Bitmap Width": bitmap-width,
63+
"Bitmap Height": bitmap-height,
64+
"Bitmap Data": bitmap-data,
65+
"Bitmap Overlay": bitmap-overlay,
66+
"Don't Draw": dont-draw,
6767
}.stringify

src/messages/m10013-button-press.toit

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,18 @@ class ButtonPress extends protocol.Data:
99
constructor.from-data data/protocol.Data:
1010
super.from-data data
1111

12-
pageId -> int:
12+
page-id -> int:
1313
return get-data-uint PAGE-ID
1414

15-
buttonId -> int:
15+
button-id -> int:
1616
return get-data-uint BUTTON-ID
1717

18-
selectionId -> int:
18+
selection-id -> int:
1919
return get-data-uint SELECTION-ID
2020

2121
stringify -> string:
2222
return {
23-
"Page ID": pageId,
24-
"Button ID": buttonId,
25-
"Selection ID": selectionId,
23+
"Page ID": page-id,
24+
"Button ID": button-id,
25+
"Selection ID": selection-id,
2626
}.stringify

src/messages/m1004-lora.toit

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -13,37 +13,37 @@ class Lora extends protocol.Data:
1313
static SLEEP := 11
1414
static STATE := 12
1515

16-
static setMsg --spreadFactor/int --codingRate/int --bandwidth/int --centerFrequency/int --txPower/int --preambleLength/int --sleep/int?=null -> protocol.Message:
16+
static set-msg --spread-factor/int --coding-rate/int --bandwidth/int --center-frequency/int --tx-power/int --preamble-length/int --sleep/int?=null -> protocol.Message:
1717
msg := protocol.Message MT
18-
msg.data.add-data-uint8 SPREAD-FACTOR spreadFactor
19-
msg.data.add-data-uint8 CODING-RATE codingRate
18+
msg.data.add-data-uint8 SPREAD-FACTOR spread-factor
19+
msg.data.add-data-uint8 CODING-RATE coding-rate
2020
msg.data.add-data-uint8 BANDWIDTH bandwidth
21-
msg.data.add-data-uint32 CENTER-FREQUENCY centerFrequency
22-
msg.data.add-data-uint8 TX-POWER txPower
23-
msg.data.add-data-uint8 PREAMBLE-LENGTH preambleLength
21+
msg.data.add-data-uint32 CENTER-FREQUENCY center-frequency
22+
msg.data.add-data-uint8 TX-POWER tx-power
23+
msg.data.add-data-uint8 PREAMBLE-LENGTH preamble-length
2424
if sleep:
2525
msg.data.add-data-uint8 SLEEP sleep
2626
msg.header.data.add-data-uint8 protocol.Header.TYPE-MESSAGE-METHOD protocol.Header.METHOD-SET
2727
return msg
2828

29-
static getMsg -> protocol.Message:
29+
static get-msg -> protocol.Message:
3030
msg := protocol.Message MT
3131
msg.header.data.add-data-uint8 protocol.Header.TYPE-MESSAGE-METHOD protocol.Header.METHOD-GET
3232
return msg
3333

34-
static doMsg --payload/ByteArray --receiveMs/int -> protocol.Message:
34+
static do-msg --payload/ByteArray --receive-ms/int -> protocol.Message:
3535
msg := protocol.Message MT
3636
msg.data.add-data PAYLOAD payload
37-
msg.data.add-data-uint32 RECEIVE-MS receiveMs
37+
msg.data.add-data-uint32 RECEIVE-MS receive-ms
3838
msg.header.data.add-data-uint8 protocol.Header.TYPE-MESSAGE-METHOD protocol.Header.METHOD-DO
3939
return msg
4040

41-
static subscribeMsg -> protocol.Message:
41+
static subscribe-msg -> protocol.Message:
4242
msg := protocol.Message MT
4343
msg.header.data.add-data-uint8 protocol.Header.TYPE-MESSAGE-METHOD protocol.Header.METHOD-SUBSCRIBE
4444
return msg
4545

46-
static unsubscribeMsg -> protocol.Message:
46+
static unsubscribe-msg -> protocol.Message:
4747
msg := protocol.Message MT
4848
msg.header.data.add-data-uint8 protocol.Header.TYPE-MESSAGE-METHOD protocol.Header.METHOD-UNSUBSCRIBE
4949
return msg
@@ -54,25 +54,25 @@ class Lora extends protocol.Data:
5454
payload -> ByteArray:
5555
return get-data PAYLOAD
5656

57-
spreadFactor -> int:
57+
spread-factor -> int:
5858
return get-data-uint8 SPREAD-FACTOR
5959

60-
codingRate -> int:
60+
coding-rate -> int:
6161
return get-data-uint8 CODING-RATE
6262

6363
bandwidth -> int:
6464
return get-data-uint8 BANDWIDTH
6565

66-
centerFrequency -> int:
66+
center-frequency -> int:
6767
return get-data-uint32 CENTER-FREQUENCY
6868

69-
txPower -> int:
69+
tx-power -> int:
7070
return get-data-uint8 TX-POWER
7171

72-
preambleLength -> int:
72+
preamble-length -> int:
7373
return get-data-uint8 PREAMBLE-LENGTH
7474

75-
receiveMs -> int:
75+
receive-ms -> int:
7676
return get-data-uint32 RECEIVE-MS
7777

7878
sleep -> int:
@@ -84,13 +84,13 @@ class Lora extends protocol.Data:
8484
stringify -> string:
8585
return {
8686
"Payload": payload,
87-
"Spread Factor": spreadFactor,
88-
"Coding Rate": codingRate,
87+
"Spread Factor": spread-factor,
88+
"Coding Rate": coding-rate,
8989
"Bandwidth": bandwidth,
90-
"Center Frequency": centerFrequency,
91-
"TX Power": txPower,
92-
"Preamble Length": preambleLength,
93-
"Receive Ms": receiveMs,
90+
"Center Frequency": center-frequency,
91+
"TX Power": tx-power,
92+
"Preamble Length": preamble-length,
93+
"Receive Ms": receive-ms,
9494
"Sleep": sleep,
9595
"State": state,
9696
}.stringify

src/messages/m13-heartbeat.toit

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,9 @@ import io.byte-order show LITTLE-ENDIAN
33

44
class Heartbeat extends protocol.Data:
55
static MT := 13
6-
// static GSM-SIGNAL := 4
7-
// static FIRMWARE-VERSION := 5
8-
// static BATTERY-PERCENT := 6
96

107
constructor:
118
super
129

1310
msg -> protocol.Message:
1411
return protocol.Message.with-data MT this
15-
16-
// // First byte is CSQ [0-31]. Recommended to x4 to get a percentage. Byte 2 and 3 are uint16 LE network info.
17-
// gsmSignal -> ByteArray:
18-
// return get-data GSM-SIGNAL
19-
// csq -> int:
20-
// return gsmSignal[0]
21-
// csqAsPercent -> int:
22-
// return csq * 4
23-
// networkInfo -> int:
24-
// return LITTLE-ENDIAN.uint16 gsmSignal 1
25-
26-
// firmwareVersion -> int:
27-
// return get-data-uint16 FIRMWARE-VERSION
28-
29-
// batteryPercent -> int:
30-
// return get-data-uint8 BATTERY-PERCENT

src/messages/m15-last-position.toit

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class LastPosition extends protocol.Data:
1818

1919
static LAT-LON-RAW-ADJUSTMENT := 1e7
2020

21-
static getMsg -> protocol.Message:
21+
static get-msg -> protocol.Message:
2222
msg := protocol.Message MT
2323
msg.header.data.add-data-uint8 protocol.Header.TYPE-MESSAGE-METHOD protocol.Header.METHOD-GET
2424
return msg
@@ -29,7 +29,7 @@ class LastPosition extends protocol.Data:
2929
msg -> protocol.Message:
3030
return protocol.Message.with-data MT this
3131

32-
static subscribeMsg --intervalms/int -> protocol.Message:
32+
static subscribe-msg --intervalms/int -> protocol.Message:
3333
msg := protocol.Message MT
3434
msg.header.data.add-data-uint8 protocol.Header.TYPE-MESSAGE-METHOD protocol.Header.METHOD-SUBSCRIBE
3535
msg.header.data.add-data-uint32 protocol.Header.TYPE-SUBSCRIPTION-INTERVAL intervalms // must be uint32
@@ -44,9 +44,9 @@ class LastPosition extends protocol.Data:
4444
return latitude-float
4545
longitude -> float:
4646
return longitude-float
47-
latitudeFixed -> FixedPoint:
47+
latitude-fixed -> FixedPoint:
4848
return ( FixedPoint --decimals=7 latitude-float )
49-
longitudeFixed -> FixedPoint:
49+
longitude-fixed -> FixedPoint:
5050
return ( FixedPoint --decimals=7 longitude-float )
5151
latitude-float -> float:
5252
return ( get-data-intn LATITUDE) / LAT-LON-RAW-ADJUSTMENT

0 commit comments

Comments
 (0)