-
Notifications
You must be signed in to change notification settings - Fork 2
/
main.tbs
138 lines (101 loc) · 3.11 KB
/
main.tbs
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
include "global.tbh"
sub on_sys_init()
sys.debugprint("DEBUG MODE: " + str(sys.debugmode))
init_stg_ble_luis()
end sub
sub init_stg_ble_luis()
dim stg_name as string(STG_MAX_SETTING_NAME_LEN)
if stg_start_no_init<>EN_STG_STATUS_OK then
pat.play("R-R-~",PL_PAT_CANINT)
sys.halt
end if
wln.boot(0)
bt.name=BT_NAME
bt.emulation=PL_WLN_BT_EMULATION_MODE_NORDIC
bt.txbuffrq(1)
bt.rxbuffrq(1)
sys.buffalloc()
bt.enable
while bt.enabled=NO
wend
bt.advertise=YES 'allow the device to be discoverable
luis_start(LUIS_BT_DEVICE_NAME)
pat.play("B-B-B-",PL_PAT_CANINT)
end sub
sub callback_stg_pre_get(byref stg_name_or_num as string,index as byte,byref stg_value as string)
select case stg_name_or_num
case "AUTO":
stg_value=wln.autoconnect
sys.debugprint("Autoconnect mode: " + stg_value + "\r\n")
case "DA":
stg_value=sys.defaultapp
sys.debugprint("Default Boot App: " + stg_value + "\r\n")
case "WAP":
stg_value=wln.autoconnectssid
sys.debugprint("WiFi Access Point: " + stg_value + "\r\n")
case "WPW":
stg_value=wln.autoconnectpassword
sys.debugprint("WiFi Password: " + stg_value + "\r\n")
case "DBM":
stg_value=sys.debugmode
sys.debugprint("Debug Mode: " + stg_value + "\r\n")
case "DOM":
stg_value=wln.domain
sys.debugprint("Domain: " + stg_value + "\r\n")
case "DHCP":
stg_value=wln.autodhcp
sys.debugprint("Auto DHCP: " + stg_value + "\r\n")
case else:
end select
end sub
sub callback_stg_post_set(byref stg_name_or_num as string, index as byte,byref stg_value as string)
select case stg_name_or_num
case "AUTO":
wln.autoconnect=stg_value
sys.debugprint("Autoconnect mode: " + stg_value + "\r\n")
case "DA":
sys.defaultapp=stg_value
sys.debugprint("Default Boot App: " + stg_value + "\r\n")
case "WAP":
wln.autoconnectssid=stg_value
sys.debugprint("WiFi Access Point: " + stg_value + "\r\n")
case "WPW":
wln.autoconnectpassword=stg_value
sys.debugprint("WiFi Password: " + stg_value + "\r\n")
case "DBM":
sys.debugmode=stg_value
sys.debugprint("Debug Mode: " + stg_value + "\r\n")
case "DOM":
wln.domain=stg_value
sys.debugprint("Domain: " + stg_value + "\r\n")
case "DHCP":
wln.autodhcp=stg_value
sys.debugprint("Auto DHCP: " + stg_value + "\r\n")
case else:
end select
end sub
sub on_bt_event(bt_event as pl_bt_events)
luis_on_bt_event(bt_event)
end sub
sub on_bt_data_sent()
luis_on_bt_data_sent()
end sub
sub on_bt_data_arrival()
luis_on_bt_data_arrival()
end sub
function callback_stg_vm_read(address as word) as byte
end function
sub callback_stg_vm_write(data_to_write as byte, address as word)
end sub
sub callback_luis_bt_connected()
end sub
sub callback_luis_bt_disconnected()
end sub
sub callback_luis_bt_enabled()
end sub
sub callback_luis_bt_disabled()
end sub
sub callback_luis_buzz_command()
end sub
sub callback_stg_error(byref stg_name_or_num as string,index as byte,status as en_stg_status_codes)
end sub