mirror of
https://github.com/cesanta/mongoose.git
synced 2026-10-25 12:04:47 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
36a1927915 | ||
|
|
68437de416 | ||
|
|
459cd1b095 | ||
|
|
6f7f774080 | ||
|
|
fc0bf1953a | ||
|
|
c907e6c5fb | ||
|
|
29b3950ee7 | ||
|
|
0e0c6b8357 | ||
|
|
6f17f3e2c2 | ||
|
|
df107a272e | ||
|
|
b7a0748312 | ||
|
|
421b420a0c | ||
|
|
a478dc5935 | ||
|
|
4d65cb1c0f | ||
|
|
ced823cd95 | ||
|
|
79325bd219 | ||
|
|
5a19135c35 | ||
|
|
290e5f83d4 | ||
|
|
b535cb319a | ||
|
|
e3a9c6afb4 | ||
|
|
3f1a33e4b4 | ||
|
|
441eaa7f6c | ||
|
|
632153a1b4 | ||
|
|
f9d0ad9dc3 | ||
|
|
a67323fc12 | ||
|
|
1daa5e69b1 | ||
|
|
1718490982 | ||
|
|
1d4f97bb4c | ||
|
|
183fc7ced9 | ||
|
|
dcf1cedec9 | ||
|
|
845e608280 | ||
|
|
d6ecfe7f24 | ||
|
|
06b6bf6185 | ||
|
|
04a38b446f | ||
|
|
dfde5785a6 | ||
|
|
1a61455eef | ||
|
|
9f2ecb0144 | ||
|
|
3265060dc8 | ||
|
|
58b8acd68a | ||
|
|
3ec09ceedf | ||
|
|
1ce4aa81ee | ||
|
|
177e829f4b | ||
|
|
b5b672ec89 | ||
|
|
d41419c8d3 | ||
|
|
5e4d9dc17a | ||
|
|
4ac688e560 | ||
|
|
5d0a5cfe72 | ||
|
|
d4b81bb911 | ||
|
|
23122b327c | ||
|
|
f443c64341 | ||
|
|
c84af7d1e2 | ||
|
|
19a28b3c81 | ||
|
|
69944c1d3a | ||
|
|
81bf4921d4 | ||
|
|
91f6eedb24 | ||
|
|
dae150a3a5 | ||
|
|
8a81dce0c1 | ||
|
|
203d4a79e2 | ||
|
|
b04d47c3a9 | ||
|
|
8fcd1906a2 | ||
|
|
9939212379 | ||
|
|
38752f1327 | ||
|
|
6b51ec3371 | ||
|
|
5714056f9f | ||
|
|
21665e367c | ||
|
|
dff844b40a | ||
|
|
54403dfcbc | ||
|
|
61672c7805 | ||
|
|
69bb96113b | ||
|
|
51328efb22 | ||
|
|
f159666ae3 | ||
|
|
7fdb50807c | ||
|
|
890c7b42dc | ||
|
|
55398684cc | ||
|
|
c85edc38aa | ||
|
|
fa368b56ba | ||
|
|
41d7520585 | ||
|
|
0f23618324 | ||
|
|
bf9a2b45ef | ||
|
|
063c017bb7 | ||
|
|
7519a3765b | ||
|
|
56c687b39b | ||
|
|
083d398631 | ||
|
|
466183113f | ||
|
|
923c432977 | ||
|
|
e433ba8d7b | ||
|
|
848c884fff | ||
|
|
0769bbb7ff | ||
|
|
7054b09584 | ||
|
|
2633628ad1 | ||
|
|
e5ae1c2ea3 | ||
|
|
d2844580a1 | ||
|
|
42f5a3e2f7 | ||
|
|
8a62005a2d | ||
|
|
616f54c4a2 |
No files matched your search
@@ -1,16 +1,12 @@
|
|||||||
# <img src="http://www.cesanta.com/hubfs/www.cesanta.com/Images/mongoose_library.png" width="64" height="64"> Mongoose - Embedded Web Server / Embedded Networking Library
|
# Mongoose - Embedded Web Server / Embedded Networking Library
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
Mongoose is ideal for embedded environments. It has been designed
|
Mongoose is ideal for embedded environments. It has been designed
|
||||||
for connecting devices and bringing them online. Mongoose
|
for connecting devices and bringing them online. On the market since 2004,
|
||||||
is on the market since 2004, used by vast number of open source and
|
used by vast number of open source and
|
||||||
commercial products - it even runs on space stations!
|
commercial products - it even runs on space stations!
|
||||||
|
Mongoose makes embedded network programming fast, robust, and easy.
|
||||||
Mongoose provides easy to use event-driven interface that allows to implement
|
|
||||||
network protocols or scalable network applications with little effort.
|
|
||||||
Mongoose helps developers to manage the complexity of network programming
|
|
||||||
and let them concentrate on the logic, saving time and money.
|
|
||||||
|
|
||||||
If you're looking for a pre-compiled Windows or Mac binary,
|
If you're looking for a pre-compiled Windows or Mac binary,
|
||||||
- [Download pre-compiled Mongoose web server binary](https://www.cesanta.com/products/binary)
|
- [Download pre-compiled Mongoose web server binary](https://www.cesanta.com/products/binary)
|
||||||
@@ -22,11 +18,10 @@ Alternatively,
|
|||||||
- [Read User Guide and API reference](https://docs.cesanta.com/mongoose/dev)
|
- [Read User Guide and API reference](https://docs.cesanta.com/mongoose/dev)
|
||||||
- [Study mongoose example code](https://github.com/cesanta/mongoose/tree/master/examples)
|
- [Study mongoose example code](https://github.com/cesanta/mongoose/tree/master/examples)
|
||||||
|
|
||||||
If you are looking for a complete IoT platform with firmware and cloud compotent,
|
If you are looking for a complete solution with firmware and cloud components, check out [Mongoose IoT Platform](https://github.com/cesanta/mongoose-iot).
|
||||||
- [Check out Smart.js - a full stack IoT platform](https://github.com/cesanta/smart.js)
|
|
||||||
|
|
||||||
# Support
|
# Support
|
||||||
- [Support Forum - Ask your technical questions here] (http://forum.cesanta.com/index.php?p=/categories/smart-js)
|
- [Support Forum - Ask your technical questions here] (http://forum.cesanta.com/index.php?p=/categories/mongoose)
|
||||||
- [Chat - Visit www.cesanta.com for our live chat] (http://www.cesanta.com)
|
- [Chat - Visit www.cesanta.com for our live chat] (http://www.cesanta.com)
|
||||||
- [Commercial one-to-one support - Available to all commercial license holders] (https://www.cesanta.com/services-support)
|
- [Commercial one-to-one support - Available to all commercial license holders] (https://www.cesanta.com/services-support)
|
||||||
|
|
||||||
@@ -41,7 +36,6 @@ If you are looking for a complete IoT platform with firmware and cloud compotent
|
|||||||
- plain TCP, plain UDP, SSL/TLS (over TCP, one-way or two-way)
|
- plain TCP, plain UDP, SSL/TLS (over TCP, one-way or two-way)
|
||||||
- HTTP client, HTTP server
|
- HTTP client, HTTP server
|
||||||
- WebSocket client, WebSocket server
|
- WebSocket client, WebSocket server
|
||||||
- JSON-RPC client, JSON-RPC server
|
|
||||||
- MQTT client, MQTT broker
|
- MQTT client, MQTT broker
|
||||||
- CoAP client, CoAP server
|
- CoAP client, CoAP server
|
||||||
- DNS client, DNS server, async DNS resolver
|
- DNS client, DNS server, async DNS resolver
|
||||||
@@ -75,6 +69,8 @@ the functionality:
|
|||||||
|
|
||||||
# Contributions
|
# Contributions
|
||||||
|
|
||||||
People who have agreed to the [Cesanta CLA] (https://docs.cesanta.com/contributors_la.shtml) can make contributions. Note that the CLA isn't a copyright assigment but rather a copyright license. You retain the copyright on your contributions.
|
To submit contributions, sign
|
||||||
|
[Cesanta CLA](https://docs.cesanta.com/contributors_la.shtml)
|
||||||
|
and send GitHub pull request. You retain the copyright on your contributions.
|
||||||
|
|
||||||
[](https://github.com/cesanta/mongoose)
|
[](https://github.com/cesanta/mongoose)
|
||||||
@@ -7,6 +7,5 @@ title: Disabling flags
|
|||||||
- `MG_DISABLE_MQTT` disable MQTT support
|
- `MG_DISABLE_MQTT` disable MQTT support
|
||||||
- `MG_DISABLE_SHA1` disable SHA1 support (used by Websocket)
|
- `MG_DISABLE_SHA1` disable SHA1 support (used by Websocket)
|
||||||
- `MG_DISABLE_MD5` disable MD5 support (used by HTTP auth)
|
- `MG_DISABLE_MD5` disable MD5 support (used by HTTP auth)
|
||||||
- `MG_DISABLE_JSON_RPC` disable JSON-RPC support
|
|
||||||
- `MG_DISABLE_SOCKETPAIR` disable `mg_broadcast()` API
|
- `MG_DISABLE_SOCKETPAIR` disable `mg_broadcast()` API
|
||||||
- `MG_DISABLE_HTTP_KEEP_ALIVE` useful for embedded systems to save resources
|
- `MG_DISABLE_HTTP_KEEP_ALIVE` useful for embedded systems to save resources
|
||||||
@@ -1,5 +1,10 @@
|
|||||||
---
|
---
|
||||||
title: Build Options
|
title: Build Options
|
||||||
|
items:
|
||||||
|
- { type: file, name: enabling-flags.md }
|
||||||
|
- { type: file, name: disabling-flags.md }
|
||||||
|
- { type: file, name: platform-spec.md }
|
||||||
|
- { type: file, name: tunables.md }
|
||||||
---
|
---
|
||||||
|
|
||||||
Mongoose source code ships in a single .c file that contains functionality
|
Mongoose source code ships in a single .c file that contains functionality
|
||||||
@@ -9,9 +14,9 @@ flags. Also, some preprocessor flags can be used to tune internal Mongoose
|
|||||||
parameters.
|
parameters.
|
||||||
|
|
||||||
To set a preprocessor flag during compile time, use `-D <PREPROCESSOR_FLAG>`
|
To set a preprocessor flag during compile time, use `-D <PREPROCESSOR_FLAG>`
|
||||||
compiler option. For example, to disable both MQTT and JSON-RPC,
|
compiler option. For example, to disable both MQTT and COAP,
|
||||||
compile the application `my_app.c` like this (assumed UNIX system):
|
compile the application `my_app.c` like this (assumed UNIX system):
|
||||||
|
|
||||||
```
|
```
|
||||||
$ cc my_app.c mongoose.c -D MG_DISABLE_MQTT -D MG_DISABLE_JSON_RPC
|
$ cc my_app.c mongoose.c -D MG_DISABLE_MQTT -D MG_DISABLE_COAP
|
||||||
```
|
```
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
{
|
|
||||||
"items": [
|
|
||||||
{ "type": "markdown", "name": "intro.md" },
|
|
||||||
{ "type": "markdown", "name": "enabling-flags.md" },
|
|
||||||
{ "type": "markdown", "name": "disabling-flags.md" },
|
|
||||||
{ "type": "markdown", "name": "platform-spec.md" },
|
|
||||||
{ "type": "markdown", "name": "tunables.md" }
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@@ -2,6 +2,16 @@
|
|||||||
title: "CoAP"
|
title: "CoAP"
|
||||||
symbol_kind: "intro"
|
symbol_kind: "intro"
|
||||||
decl_name: "coap.h"
|
decl_name: "coap.h"
|
||||||
|
items:
|
||||||
|
- { type: file, name: mg_set_protocol_coap.md }
|
||||||
|
- { type: file, name: mg_coap_add_option.md }
|
||||||
|
- { type: file, name: mg_coap_free_options.md }
|
||||||
|
- { type: file, name: mg_coap_send_message.md }
|
||||||
|
- { type: file, name: mg_coap_send_ack.md }
|
||||||
|
- { type: file, name: mg_coap_parse.md }
|
||||||
|
- { type: file, name: mg_coap_compose.md }
|
||||||
|
- { type: file, name: struct_mg_coap_option.md }
|
||||||
|
- { type: file, name: struct_mg_coap_message.md }
|
||||||
---
|
---
|
||||||
|
|
||||||
CoAP message format:
|
CoAP message format:
|
||||||
|
|||||||
@@ -1,44 +0,0 @@
|
|||||||
{
|
|
||||||
"items": [
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "intro.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mg_set_protocol_coap.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mg_coap_add_option.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mg_coap_free_options.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mg_coap_send_message.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mg_coap_send_ack.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mg_coap_parse.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mg_coap_compose.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "struct_mg_coap_option.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "struct_mg_coap_message.md"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@@ -2,6 +2,10 @@
|
|||||||
title: "DNS server"
|
title: "DNS server"
|
||||||
symbol_kind: "intro"
|
symbol_kind: "intro"
|
||||||
decl_name: "dns-server.h"
|
decl_name: "dns-server.h"
|
||||||
|
items:
|
||||||
|
- { type: file, name: mg_dns_create_reply.md }
|
||||||
|
- { type: file, name: mg_dns_reply_record.md }
|
||||||
|
- { type: file, name: mg_dns_send_reply.md }
|
||||||
---
|
---
|
||||||
|
|
||||||
Disabled by default; enable with `-DMG_ENABLE_DNS_SERVER`.
|
Disabled by default; enable with `-DMG_ENABLE_DNS_SERVER`.
|
||||||
|
|||||||
@@ -1,20 +0,0 @@
|
|||||||
{
|
|
||||||
"items": [
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "intro.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mg_dns_create_reply.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mg_dns_reply_record.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mg_dns_send_reply.md"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@@ -2,6 +2,17 @@
|
|||||||
title: "DNS"
|
title: "DNS"
|
||||||
symbol_kind: "intro"
|
symbol_kind: "intro"
|
||||||
decl_name: "dns.h"
|
decl_name: "dns.h"
|
||||||
|
items:
|
||||||
|
- { type: file, name: mg_dns_parse_record_data.md }
|
||||||
|
- { type: file, name: mg_send_dns_query.md }
|
||||||
|
- { type: file, name: mg_dns_insert_header.md }
|
||||||
|
- { type: file, name: mg_dns_copy_questions.md }
|
||||||
|
- { type: file, name: mg_dns_encode_record.md }
|
||||||
|
- { type: file, name: mg_parse_dns.md }
|
||||||
|
- { type: file, name: mg_dns_uncompress_name.md }
|
||||||
|
- { type: file, name: mg_set_protocol_dns.md }
|
||||||
|
- { type: file, name: struct_mg_dns_resource_record.md }
|
||||||
|
- { type: file, name: struct_mg_dns_message.md }
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,48 +0,0 @@
|
|||||||
{
|
|
||||||
"items": [
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "intro.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mg_dns_parse_record_data.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mg_send_dns_query.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mg_dns_insert_header.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mg_dns_copy_body.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mg_dns_encode_record.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mg_parse_dns.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mg_dns_uncompress_name.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mg_set_protocol_dns.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "struct_mg_dns_resource_record.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "struct_mg_dns_message.md"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
---
|
|
||||||
title: "mg_dns_copy_body()"
|
|
||||||
decl_name: "mg_dns_copy_body"
|
|
||||||
symbol_kind: "func"
|
|
||||||
signature: |
|
|
||||||
int mg_dns_copy_body(struct mbuf *io, struct mg_dns_message *msg);
|
|
||||||
---
|
|
||||||
|
|
||||||
Append already encoded body from an existing message.
|
|
||||||
|
|
||||||
This is useful when generating a DNS reply message which includes
|
|
||||||
all question records.
|
|
||||||
|
|
||||||
Return number of appened bytes.
|
|
||||||
|
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
---
|
||||||
|
title: "mg_dns_copy_questions()"
|
||||||
|
decl_name: "mg_dns_copy_questions"
|
||||||
|
symbol_kind: "func"
|
||||||
|
signature: |
|
||||||
|
int mg_dns_copy_questions(struct mbuf *io, struct mg_dns_message *msg);
|
||||||
|
---
|
||||||
|
|
||||||
|
Append already encoded questions from an existing message.
|
||||||
|
|
||||||
|
This is useful when generating a DNS reply message which includes
|
||||||
|
all question records.
|
||||||
|
|
||||||
|
Return number of appened bytes.
|
||||||
|
|
||||||
@@ -2,6 +2,38 @@
|
|||||||
title: "HTTP + Websocket"
|
title: "HTTP + Websocket"
|
||||||
symbol_kind: "intro"
|
symbol_kind: "intro"
|
||||||
decl_name: "http.h"
|
decl_name: "http.h"
|
||||||
|
items:
|
||||||
|
- { type: file, name: mg_set_protocol_http_websocket.md }
|
||||||
|
- { type: file, name: mg_send_websocket_handshake.md }
|
||||||
|
- { type: file, name: mg_send_websocket_handshake2.md }
|
||||||
|
- { type: file, name: mg_connect_ws.md }
|
||||||
|
- { type: file, name: mg_connect_ws_opt.md }
|
||||||
|
- { type: file, name: mg_send_websocket_frame.md }
|
||||||
|
- { type: file, name: mg_send_websocket_framev.md }
|
||||||
|
- { type: file, name: mg_printf_websocket_frame.md }
|
||||||
|
- { type: file, name: mg_send_http_chunk.md }
|
||||||
|
- { type: file, name: mg_printf_http_chunk.md }
|
||||||
|
- { type: file, name: mg_send_response_line.md }
|
||||||
|
- { type: file, name: mg_send_head.md }
|
||||||
|
- { type: file, name: mg_printf_html_escape.md }
|
||||||
|
- { type: file, name: mg_parse_http.md }
|
||||||
|
- { type: file, name: mg_get_http_header.md }
|
||||||
|
- { type: file, name: mg_http_parse_header.md }
|
||||||
|
- { type: file, name: mg_parse_multipart.md }
|
||||||
|
- { type: file, name: mg_get_http_var.md }
|
||||||
|
- { type: file, name: mg_url_decode.md }
|
||||||
|
- { type: file, name: mg_http_create_digest_auth_header.md }
|
||||||
|
- { type: file, name: mg_connect_http.md }
|
||||||
|
- { type: file, name: mg_connect_http_opt.md }
|
||||||
|
- { type: file, name: mg_serve_http.md }
|
||||||
|
- { type: file, name: mg_register_http_endpoint.md }
|
||||||
|
- { type: file, name: mg_file_upload_handler.md }
|
||||||
|
- { type: file, name: mg_http_check_digest_auth.md }
|
||||||
|
- { type: file, name: mg_fu_fname_fn.md }
|
||||||
|
- { type: file, name: struct_http_message.md }
|
||||||
|
- { type: file, name: struct_websocket_message.md }
|
||||||
|
- { type: file, name: struct_mg_http_multipart_part.md }
|
||||||
|
- { type: file, name: struct_mg_serve_http_opts.md }
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,128 +0,0 @@
|
|||||||
{
|
|
||||||
"items": [
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "intro.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mg_set_protocol_http_websocket.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mg_send_websocket_handshake.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mg_send_websocket_handshake2.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mg_connect_ws.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mg_connect_ws_opt.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mg_send_websocket_frame.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mg_send_websocket_framev.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mg_printf_websocket_frame.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mg_send_http_chunk.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mg_printf_http_chunk.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mg_send_response_line.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mg_send_head.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mg_printf_html_escape.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mg_parse_http.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mg_get_http_header.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mg_http_parse_header.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mg_parse_multipart.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mg_get_http_var.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mg_url_decode.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mg_http_create_digest_auth_header.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mg_connect_http.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mg_connect_http_opt.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mg_serve_http.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mg_register_http_endpoint.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mg_file_upload_handler.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mg_fu_fname_fn.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "struct_http_message.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "struct_websocket_message.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "struct_mg_http_multipart_part.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "struct_mg_serve_http_opts.md"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
---
|
||||||
|
title: "mg_http_check_digest_auth()"
|
||||||
|
decl_name: "mg_http_check_digest_auth"
|
||||||
|
symbol_kind: "func"
|
||||||
|
signature: |
|
||||||
|
int mg_http_check_digest_auth(struct http_message *hm, const char *auth_domain,
|
||||||
|
FILE *fp);
|
||||||
|
---
|
||||||
|
|
||||||
|
Authenticate HTTP request against opened passwords file.
|
||||||
|
Returns 1 if authenticated, 0 otherwise.
|
||||||
|
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
---
|
||||||
|
items:
|
||||||
|
- { type: dir, name: mbuf.h }
|
||||||
|
- { type: dir, name: net.h }
|
||||||
|
- { type: dir, name: http.h }
|
||||||
|
- { type: dir, name: dns.h }
|
||||||
|
- { type: dir, name: dns-server.h }
|
||||||
|
- { type: dir, name: mqtt.h }
|
||||||
|
- { type: dir, name: mqtt-broker.h }
|
||||||
|
- { type: dir, name: coap.h }
|
||||||
|
- { type: dir, name: util.h }
|
||||||
|
---
|
||||||
@@ -1,44 +0,0 @@
|
|||||||
{
|
|
||||||
"items": [
|
|
||||||
{
|
|
||||||
"type": "section",
|
|
||||||
"name": "mbuf.h"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "section",
|
|
||||||
"name": "net.h"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "section",
|
|
||||||
"name": "http.h"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "section",
|
|
||||||
"name": "json-rpc.h"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "section",
|
|
||||||
"name": "dns.h"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "section",
|
|
||||||
"name": "dns-server.h"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "section",
|
|
||||||
"name": "mqtt.h"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "section",
|
|
||||||
"name": "mqtt-broker.h"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "section",
|
|
||||||
"name": "coap.h"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "section",
|
|
||||||
"name": "util.h"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
---
|
|
||||||
title: "JSON-RPC"
|
|
||||||
symbol_kind: "intro"
|
|
||||||
decl_name: "json-rpc.h"
|
|
||||||
---
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,44 +0,0 @@
|
|||||||
{
|
|
||||||
"items": [
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "intro.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mg_rpc_parse_reply.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mg_rpc_create_request.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mg_rpc_create_reply.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mg_rpc_create_error.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mg_rpc_create_std_error.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mg_rpc_dispatch.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "struct_mg_rpc_request.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "struct_mg_rpc_reply.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "struct_mg_rpc_error.md"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
---
|
|
||||||
title: "mg_rpc_create_error()"
|
|
||||||
decl_name: "mg_rpc_create_error"
|
|
||||||
symbol_kind: "func"
|
|
||||||
signature: |
|
|
||||||
int mg_rpc_create_error(char *buf, int len, struct mg_rpc_request *req,
|
|
||||||
int code, const char *message, const char *fmt, ...);
|
|
||||||
---
|
|
||||||
|
|
||||||
Create JSON-RPC error reply in a given buffer.
|
|
||||||
|
|
||||||
Return length of the error, which
|
|
||||||
can be larger then `len` that indicates an overflow.
|
|
||||||
`fmt` format string should conform to `json_emit()` API,
|
|
||||||
see https://github.com/cesanta/frozen
|
|
||||||
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
---
|
|
||||||
title: "mg_rpc_create_reply()"
|
|
||||||
decl_name: "mg_rpc_create_reply"
|
|
||||||
symbol_kind: "func"
|
|
||||||
signature: |
|
|
||||||
int mg_rpc_create_reply(char *buf, int len, const struct mg_rpc_request *req,
|
|
||||||
const char *result_fmt, ...);
|
|
||||||
---
|
|
||||||
|
|
||||||
Create JSON-RPC reply in a given buffer.
|
|
||||||
|
|
||||||
Return length of the reply, which
|
|
||||||
can be larger then `len` that indicates an overflow.
|
|
||||||
`result_fmt` format string should conform to `json_emit()` API,
|
|
||||||
see https://github.com/cesanta/frozen
|
|
||||||
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
---
|
|
||||||
title: "mg_rpc_create_request()"
|
|
||||||
decl_name: "mg_rpc_create_request"
|
|
||||||
symbol_kind: "func"
|
|
||||||
signature: |
|
|
||||||
int mg_rpc_create_request(char *buf, int len, const char *method,
|
|
||||||
const char *id, const char *params_fmt, ...);
|
|
||||||
---
|
|
||||||
|
|
||||||
Create JSON-RPC request in a given buffer.
|
|
||||||
|
|
||||||
Return length of the request, which
|
|
||||||
can be larger then `len` that indicates an overflow.
|
|
||||||
`params_fmt` format string should conform to `json_emit()` API,
|
|
||||||
see https://github.com/cesanta/frozen
|
|
||||||
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
---
|
|
||||||
title: "mg_rpc_create_std_error()"
|
|
||||||
decl_name: "mg_rpc_create_std_error"
|
|
||||||
symbol_kind: "func"
|
|
||||||
signature: |
|
|
||||||
int mg_rpc_create_std_error(char *buf, int len, struct mg_rpc_request *req,
|
|
||||||
int code);
|
|
||||||
---
|
|
||||||
|
|
||||||
Create JSON-RPC error in a given buffer.
|
|
||||||
|
|
||||||
Return length of the error, which
|
|
||||||
can be larger then `len` that indicates an overflow. See
|
|
||||||
JSON_RPC_*_ERROR definitions for standard error values:
|
|
||||||
|
|
||||||
- `#define JSON_RPC_PARSE_ERROR (-32700)`
|
|
||||||
- `#define JSON_RPC_INVALID_REQUEST_ERROR (-32600)`
|
|
||||||
- `#define JSON_RPC_METHOD_NOT_FOUND_ERROR (-32601)`
|
|
||||||
- `#define JSON_RPC_INVALID_PARAMS_ERROR (-32602)`
|
|
||||||
- `#define JSON_RPC_INTERNAL_ERROR (-32603)`
|
|
||||||
- `#define JSON_RPC_SERVER_ERROR (-32000)`
|
|
||||||
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
---
|
|
||||||
title: "mg_rpc_dispatch()"
|
|
||||||
decl_name: "mg_rpc_dispatch"
|
|
||||||
symbol_kind: "func"
|
|
||||||
signature: |
|
|
||||||
int mg_rpc_dispatch(const char *buf, int, char *dst, int dst_len,
|
|
||||||
const char **methods, mg_rpc_handler_t *handlers);
|
|
||||||
---
|
|
||||||
|
|
||||||
Dispatches a JSON-RPC request.
|
|
||||||
|
|
||||||
Parses JSON-RPC request contained in `buf`, `len`.
|
|
||||||
Then, dispatches the request to the correct handler method.
|
|
||||||
Valid method names should be specified in NULL
|
|
||||||
terminated array `methods`, and corresponding handlers in `handlers`.
|
|
||||||
Result is put in `dst`, `dst_len`. Return: length of the result, which
|
|
||||||
can be larger then `dst_len` that indicates an overflow.
|
|
||||||
Overflown bytes are not written to the buffer.
|
|
||||||
If method is not found, an error is automatically generated.
|
|
||||||
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
---
|
|
||||||
title: "mg_rpc_parse_reply()"
|
|
||||||
decl_name: "mg_rpc_parse_reply"
|
|
||||||
symbol_kind: "func"
|
|
||||||
signature: |
|
|
||||||
int mg_rpc_parse_reply(const char *buf, int len, struct json_token *toks,
|
|
||||||
int max_toks, struct mg_rpc_reply *,
|
|
||||||
struct mg_rpc_error *);
|
|
||||||
---
|
|
||||||
|
|
||||||
Parse JSON-RPC reply contained in `buf`, `len` into JSON tokens array
|
|
||||||
`toks`, `max_toks`. If buffer contains valid reply, `reply` structure is
|
|
||||||
populated. The result of RPC call is located in `reply.result`. On error,
|
|
||||||
`error` structure is populated. Returns: the result of calling
|
|
||||||
`parse_json(buf, len, toks, max_toks)`:
|
|
||||||
|
|
||||||
On success, an offset inside `json_string` is returned
|
|
||||||
where parsing has finished. On failure, a negative number is
|
|
||||||
returned, one of:
|
|
||||||
|
|
||||||
- `#define JSON_STRING_INVALID -1`
|
|
||||||
- `#define JSON_STRING_INCOMPLETE -2`
|
|
||||||
- `#define JSON_TOKEN_ARRAY_TOO_SMALL -3`
|
|
||||||
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
---
|
|
||||||
title: "struct mg_rpc_error"
|
|
||||||
decl_name: "struct mg_rpc_error"
|
|
||||||
symbol_kind: "struct"
|
|
||||||
signature: |
|
|
||||||
struct mg_rpc_error {
|
|
||||||
struct json_token *message; /* Whole RPC message */
|
|
||||||
struct json_token *id; /* Message ID */
|
|
||||||
struct json_token *error_code; /* error.code */
|
|
||||||
struct json_token *error_message; /* error.message */
|
|
||||||
struct json_token *error_data; /* error.data, can be NULL */
|
|
||||||
};
|
|
||||||
---
|
|
||||||
|
|
||||||
JSON-RPC error
|
|
||||||
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
---
|
|
||||||
title: "struct mg_rpc_reply"
|
|
||||||
decl_name: "struct mg_rpc_reply"
|
|
||||||
symbol_kind: "struct"
|
|
||||||
signature: |
|
|
||||||
struct mg_rpc_reply {
|
|
||||||
struct json_token *message; /* Whole RPC message */
|
|
||||||
struct json_token *id; /* Message ID */
|
|
||||||
struct json_token *result; /* Remote call result */
|
|
||||||
};
|
|
||||||
---
|
|
||||||
|
|
||||||
JSON-RPC response
|
|
||||||
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
---
|
|
||||||
title: "struct mg_rpc_request"
|
|
||||||
decl_name: "struct mg_rpc_request"
|
|
||||||
symbol_kind: "struct"
|
|
||||||
signature: |
|
|
||||||
struct mg_rpc_request {
|
|
||||||
struct json_token *message; /* Whole RPC message */
|
|
||||||
struct json_token *id; /* Message ID */
|
|
||||||
struct json_token *method; /* Method name */
|
|
||||||
struct json_token *params; /* Method params */
|
|
||||||
};
|
|
||||||
---
|
|
||||||
|
|
||||||
JSON-RPC request
|
|
||||||
|
|
||||||
@@ -2,6 +2,15 @@
|
|||||||
title: "Memory Buffers"
|
title: "Memory Buffers"
|
||||||
symbol_kind: "intro"
|
symbol_kind: "intro"
|
||||||
decl_name: "mbuf.h"
|
decl_name: "mbuf.h"
|
||||||
|
items:
|
||||||
|
- { type: file, name: mbuf_init.md }
|
||||||
|
- { type: file, name: mbuf_free.md }
|
||||||
|
- { type: file, name: mbuf_append.md }
|
||||||
|
- { type: file, name: mbuf_insert.md }
|
||||||
|
- { type: file, name: mbuf_remove.md }
|
||||||
|
- { type: file, name: mbuf_resize.md }
|
||||||
|
- { type: file, name: mbuf_trim.md }
|
||||||
|
- { type: file, name: struct_mbuf.md }
|
||||||
---
|
---
|
||||||
|
|
||||||
Mbufs are mutable/growing memory buffers, like C++ strings.
|
Mbufs are mutable/growing memory buffers, like C++ strings.
|
||||||
|
|||||||
@@ -1,40 +0,0 @@
|
|||||||
{
|
|
||||||
"items": [
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "intro.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mbuf_init.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mbuf_free.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mbuf_append.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mbuf_insert.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mbuf_remove.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mbuf_resize.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mbuf_trim.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "struct_mbuf.md"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@@ -2,6 +2,12 @@
|
|||||||
title: "MQTT Broker"
|
title: "MQTT Broker"
|
||||||
symbol_kind: "intro"
|
symbol_kind: "intro"
|
||||||
decl_name: "mqtt-broker.h"
|
decl_name: "mqtt-broker.h"
|
||||||
|
items:
|
||||||
|
- { type: file, name: mg_mqtt_broker_init.md }
|
||||||
|
- { type: file, name: mg_mqtt_broker.md }
|
||||||
|
- { type: file, name: mg_mqtt_next.md }
|
||||||
|
- { type: file, name: struct_mg_mqtt_session.md }
|
||||||
|
- { type: file, name: struct_mg_mqtt_broker.md }
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,28 +0,0 @@
|
|||||||
{
|
|
||||||
"items": [
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "intro.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mg_mqtt_broker_init.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mg_mqtt_broker.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mg_mqtt_next.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "struct_mg_mqtt_session.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "struct_mg_mqtt_broker.md"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@@ -2,6 +2,25 @@
|
|||||||
title: "MQTT"
|
title: "MQTT"
|
||||||
symbol_kind: "intro"
|
symbol_kind: "intro"
|
||||||
decl_name: "mqtt.h"
|
decl_name: "mqtt.h"
|
||||||
|
items:
|
||||||
|
- { type: file, name: mg_set_protocol_mqtt.md }
|
||||||
|
- { type: file, name: mg_send_mqtt_handshake.md }
|
||||||
|
- { type: file, name: mg_send_mqtt_handshake_opt.md }
|
||||||
|
- { type: file, name: mg_mqtt_publish.md }
|
||||||
|
- { type: file, name: mg_mqtt_subscribe.md }
|
||||||
|
- { type: file, name: mg_mqtt_unsubscribe.md }
|
||||||
|
- { type: file, name: mg_mqtt_disconnect.md }
|
||||||
|
- { type: file, name: mg_mqtt_connack.md }
|
||||||
|
- { type: file, name: mg_mqtt_puback.md }
|
||||||
|
- { type: file, name: mg_mqtt_pubrec.md }
|
||||||
|
- { type: file, name: mg_mqtt_pubrel.md }
|
||||||
|
- { type: file, name: mg_mqtt_pubcomp.md }
|
||||||
|
- { type: file, name: mg_mqtt_suback.md }
|
||||||
|
- { type: file, name: mg_mqtt_unsuback.md }
|
||||||
|
- { type: file, name: mg_mqtt_ping.md }
|
||||||
|
- { type: file, name: mg_mqtt_pong.md }
|
||||||
|
- { type: file, name: mg_mqtt_next_subscribe_topic.md }
|
||||||
|
- { type: file, name: struct_mg_mqtt_topic_expression.md }
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,80 +0,0 @@
|
|||||||
{
|
|
||||||
"items": [
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "intro.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mg_set_protocol_mqtt.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mg_send_mqtt_handshake.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mg_send_mqtt_handshake_opt.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mg_mqtt_publish.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mg_mqtt_subscribe.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mg_mqtt_unsubscribe.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mg_mqtt_disconnect.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mg_mqtt_connack.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mg_mqtt_puback.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mg_mqtt_pubrec.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mg_mqtt_pubrel.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mg_mqtt_pubcomp.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mg_mqtt_suback.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mg_mqtt_unsuback.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mg_mqtt_ping.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mg_mqtt_pong.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mg_mqtt_next_subscribe_topic.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "struct_mg_mqtt_topic_expression.md"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@@ -2,6 +2,34 @@
|
|||||||
title: "Core: TCP/UDP/SSL"
|
title: "Core: TCP/UDP/SSL"
|
||||||
symbol_kind: "intro"
|
symbol_kind: "intro"
|
||||||
decl_name: "net.h"
|
decl_name: "net.h"
|
||||||
|
items:
|
||||||
|
- { type: file, name: mg_mgr_init.md }
|
||||||
|
- { type: file, name: mg_mgr_free.md }
|
||||||
|
- { type: file, name: mg_mgr_poll.md }
|
||||||
|
- { type: file, name: mg_broadcast.md }
|
||||||
|
- { type: file, name: mg_next.md }
|
||||||
|
- { type: file, name: mg_add_sock.md }
|
||||||
|
- { type: file, name: mg_add_sock_opt.md }
|
||||||
|
- { type: file, name: mg_bind.md }
|
||||||
|
- { type: file, name: mg_bind_opt.md }
|
||||||
|
- { type: file, name: mg_connect.md }
|
||||||
|
- { type: file, name: mg_connect_opt.md }
|
||||||
|
- { type: file, name: mg_set_ssl.md }
|
||||||
|
- { type: file, name: mg_send.md }
|
||||||
|
- { type: file, name: mg_printf.md }
|
||||||
|
- { type: file, name: mg_vprintf.md }
|
||||||
|
- { type: file, name: mg_socketpair.md }
|
||||||
|
- { type: file, name: mg_check_ip_acl.md }
|
||||||
|
- { type: file, name: mg_enable_multithreading.md }
|
||||||
|
- { type: file, name: mg_enable_javascript.md }
|
||||||
|
- { type: file, name: mg_set_timer.md }
|
||||||
|
- { type: file, name: mg_time.md }
|
||||||
|
- { type: file, name: mg_event_handler_t.md }
|
||||||
|
- { type: file, name: struct_mg_mgr.md }
|
||||||
|
- { type: file, name: struct_mg_connection.md }
|
||||||
|
- { type: file, name: struct_mg_add_sock_opts.md }
|
||||||
|
- { type: file, name: struct_mg_bind_opts.md }
|
||||||
|
- { type: file, name: struct_mg_connect_opts.md }
|
||||||
---
|
---
|
||||||
|
|
||||||
NOTE: Mongoose manager is single threaded. It does not protect
|
NOTE: Mongoose manager is single threaded. It does not protect
|
||||||
|
|||||||
@@ -1,120 +0,0 @@
|
|||||||
{
|
|
||||||
"items": [
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "intro.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mg_mgr_init.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mg_mgr_free.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mg_mgr_poll.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mg_broadcast.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mg_next.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mg_add_sock.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mg_add_sock_opt.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mg_bind.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mg_bind_opt.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mg_connect.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mg_connect_opt.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mg_set_ssl.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mg_send.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mg_printf.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mg_vprintf.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mg_socketpair.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mg_check_ip_acl.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mg_enable_multithreading.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mg_enable_javascript.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mg_set_timer.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mg_time.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mg_event_handler_t.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "struct_mg_str.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "struct_mg_mgr.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "struct_mg_connection.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "struct_mg_add_sock_opts.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "struct_mg_bind_opts.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "struct_mg_connect_opts.md"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@@ -7,12 +7,14 @@ signature: |
|
|||||||
const char *ca_cert);
|
const char *ca_cert);
|
||||||
---
|
---
|
||||||
|
|
||||||
|
Note: This function is deprecated, please use SSL options in mg_connect_opt.
|
||||||
|
|
||||||
Enable SSL for a given connection.
|
Enable SSL for a given connection.
|
||||||
`cert` is a server certificate file name for a listening connection,
|
`cert` is a server certificate file name for a listening connection,
|
||||||
or a client certificate file name for an outgoing connection.
|
or a client certificate file name for an outgoing connection.
|
||||||
Certificate files must be in PEM format. Server certificate file
|
Certificate files must be in PEM format. Server certificate file
|
||||||
must contain a certificate, concatenated with a private key, optionally
|
must contain a certificate, concatenated with a private key, optionally
|
||||||
concatenated with parameters.
|
concatenated with DH parameters.
|
||||||
`ca_cert` is a CA certificate, or NULL if peer verification is not
|
`ca_cert` is a CA certificate, or NULL if peer verification is not
|
||||||
required.
|
required.
|
||||||
Return: NULL on success, or error message on error.
|
Return: NULL on success, or error message on error.
|
||||||
|
|||||||
@@ -10,6 +10,9 @@ signature: |
|
|||||||
#ifdef MG_ENABLE_SSL
|
#ifdef MG_ENABLE_SSL
|
||||||
/* SSL settings. */
|
/* SSL settings. */
|
||||||
const char *ssl_cert; /* Server certificate to present to clients */
|
const char *ssl_cert; /* Server certificate to present to clients */
|
||||||
|
const char *ssl_key; /* Private key corresponding to the certificate.
|
||||||
|
If ssl_cert is set but ssl_key is not, ssl_cert
|
||||||
|
is used. */
|
||||||
const char *ssl_ca_cert; /* Verify client certificates with this CA bundle */
|
const char *ssl_ca_cert; /* Verify client certificates with this CA bundle */
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -10,6 +10,9 @@ signature: |
|
|||||||
#ifdef MG_ENABLE_SSL
|
#ifdef MG_ENABLE_SSL
|
||||||
/* SSL settings. */
|
/* SSL settings. */
|
||||||
const char *ssl_cert; /* Client certificate to present to the server */
|
const char *ssl_cert; /* Client certificate to present to the server */
|
||||||
|
const char *ssl_key; /* Private key corresponding to the certificate.
|
||||||
|
If ssl_cert is set but ssl_key is not, ssl_cert
|
||||||
|
is used. */
|
||||||
const char *ssl_ca_cert; /* Verify server certificate using this CA bundle */
|
const char *ssl_ca_cert; /* Verify server certificate using this CA bundle */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -14,8 +14,17 @@ signature: |
|
|||||||
size_t recv_mbuf_limit; /* Max size of recv buffer */
|
size_t recv_mbuf_limit; /* Max size of recv buffer */
|
||||||
struct mbuf recv_mbuf; /* Received data */
|
struct mbuf recv_mbuf; /* Received data */
|
||||||
struct mbuf send_mbuf; /* Data scheduled for sending */
|
struct mbuf send_mbuf; /* Data scheduled for sending */
|
||||||
|
#if defined(MG_ENABLE_SSL)
|
||||||
|
#if !defined(MG_SOCKET_SIMPLELINK)
|
||||||
SSL *ssl;
|
SSL *ssl;
|
||||||
SSL_CTX *ssl_ctx;
|
SSL_CTX *ssl_ctx;
|
||||||
|
#else
|
||||||
|
char *ssl_cert;
|
||||||
|
char *ssl_key;
|
||||||
|
char *ssl_ca_cert;
|
||||||
|
char *ssl_server_name;
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
time_t last_io_time; /* Timestamp of the last socket IO */
|
time_t last_io_time; /* Timestamp of the last socket IO */
|
||||||
double ev_timer_time; /* Timestamp of the future MG_EV_TIMER */
|
double ev_timer_time; /* Timestamp of the future MG_EV_TIMER */
|
||||||
mg_event_handler_t proto_handler; /* Protocol-specific event handler */
|
mg_event_handler_t proto_handler; /* Protocol-specific event handler */
|
||||||
@@ -39,10 +48,11 @@ signature: |
|
|||||||
#define MG_F_UDP (1 << 1) /* This connection is UDP */
|
#define MG_F_UDP (1 << 1) /* This connection is UDP */
|
||||||
#define MG_F_RESOLVING (1 << 2) /* Waiting for async resolver */
|
#define MG_F_RESOLVING (1 << 2) /* Waiting for async resolver */
|
||||||
#define MG_F_CONNECTING (1 << 3) /* connect() call in progress */
|
#define MG_F_CONNECTING (1 << 3) /* connect() call in progress */
|
||||||
#define MG_F_SSL_HANDSHAKE_DONE (1 << 4) /* SSL specific */
|
#define MG_F_SSL (1 << 4) /* SSL is enabled on the connection */
|
||||||
#define MG_F_WANT_READ (1 << 5) /* SSL specific */
|
#define MG_F_SSL_HANDSHAKE_DONE (1 << 5) /* SSL hanshake has completed */
|
||||||
#define MG_F_WANT_WRITE (1 << 6) /* SSL specific */
|
#define MG_F_WANT_READ (1 << 6) /* SSL specific */
|
||||||
#define MG_F_IS_WEBSOCKET (1 << 7) /* Websocket specific */
|
#define MG_F_WANT_WRITE (1 << 7) /* SSL specific */
|
||||||
|
#define MG_F_IS_WEBSOCKET (1 << 8) /* Websocket specific */
|
||||||
|
|
||||||
/* Flags that are settable by user */
|
/* Flags that are settable by user */
|
||||||
#define MG_F_SEND_AND_CLOSE (1 << 10) /* Push remaining data and close */
|
#define MG_F_SEND_AND_CLOSE (1 << 10) /* Push remaining data and close */
|
||||||
|
|||||||
@@ -1,13 +0,0 @@
|
|||||||
---
|
|
||||||
title: "struct mg_str"
|
|
||||||
decl_name: "struct mg_str"
|
|
||||||
symbol_kind: "struct"
|
|
||||||
signature: |
|
|
||||||
struct mg_str {
|
|
||||||
const char *p; /* Memory chunk pointer */
|
|
||||||
size_t len; /* Memory chunk length */
|
|
||||||
};
|
|
||||||
---
|
|
||||||
|
|
||||||
Describes chunk of memory
|
|
||||||
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
---
|
|
||||||
title: "MG_MK_STR()"
|
|
||||||
decl_name: "MG_MK_STR"
|
|
||||||
symbol_kind: "func"
|
|
||||||
signature: |
|
|
||||||
#define MG_MK_STR(str_literal);
|
|
||||||
---
|
|
||||||
|
|
||||||
Macro for initializing mg_str.
|
|
||||||
|
|
||||||
@@ -2,6 +2,25 @@
|
|||||||
title: "Utilities"
|
title: "Utilities"
|
||||||
symbol_kind: "intro"
|
symbol_kind: "intro"
|
||||||
decl_name: "util.h"
|
decl_name: "util.h"
|
||||||
|
items:
|
||||||
|
- { type: file, name: mg_skip.md }
|
||||||
|
- { type: file, name: mg_ncasecmp.md }
|
||||||
|
- { type: file, name: mg_casecmp.md }
|
||||||
|
- { type: file, name: mg_base64_decode.md }
|
||||||
|
- { type: file, name: mg_base64_encode.md }
|
||||||
|
- { type: file, name: mg_stat.md }
|
||||||
|
- { type: file, name: mg_fopen.md }
|
||||||
|
- { type: file, name: mg_open.md }
|
||||||
|
- { type: file, name: mg_start_thread.md }
|
||||||
|
- { type: file, name: mg_conn_addr_to_str.md }
|
||||||
|
- { type: file, name: mg_sock_to_str.md }
|
||||||
|
- { type: file, name: mg_sock_addr_to_str.md }
|
||||||
|
- { type: file, name: mg_hexdump.md }
|
||||||
|
- { type: file, name: mg_hexdump_connection.md }
|
||||||
|
- { type: file, name: mg_avprintf.md }
|
||||||
|
- { type: file, name: mg_is_big_endian.md }
|
||||||
|
- { type: file, name: mg_next_comma_list_entry.md }
|
||||||
|
- { type: file, name: mg_match_prefix.md }
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,96 +0,0 @@
|
|||||||
{
|
|
||||||
"items": [
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "intro.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mg_skip.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mg_ncasecmp.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mg_casecmp.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mg_vcmp.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mg_vcasecmp.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mg_base64_decode.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mg_base64_encode.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mg_stat.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mg_fopen.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mg_open.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mg_start_thread.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mg_conn_addr_to_str.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mg_sock_to_str.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mg_sock_addr_to_str.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mg_hexdump.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mg_hexdump_connection.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mg_avprintf.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mg_is_big_endian.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mg_next_comma_list_entry.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mg_match_prefix.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "mg_mk_str.md"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "markdown",
|
|
||||||
"name": "MG_MK_STR.md"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
---
|
|
||||||
title: "mg_mk_str()"
|
|
||||||
decl_name: "mg_mk_str"
|
|
||||||
symbol_kind: "func"
|
|
||||||
signature: |
|
|
||||||
struct mg_str mg_mk_str(const char *s);
|
|
||||||
---
|
|
||||||
|
|
||||||
A helper function for creating mg_str struct from plain C string.
|
|
||||||
`NULL` is allowed and becomes `{NULL, 0}`.
|
|
||||||
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
---
|
|
||||||
title: "mg_vcasecmp()"
|
|
||||||
decl_name: "mg_vcasecmp"
|
|
||||||
symbol_kind: "func"
|
|
||||||
signature: |
|
|
||||||
int mg_vcasecmp(const struct mg_str *str2, const char *str1);
|
|
||||||
---
|
|
||||||
|
|
||||||
Cross-platform version of `strncasecmp()` where first string is
|
|
||||||
specified by `struct mg_str`.
|
|
||||||
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
---
|
|
||||||
title: "mg_vcmp()"
|
|
||||||
decl_name: "mg_vcmp"
|
|
||||||
symbol_kind: "func"
|
|
||||||
signature: |
|
|
||||||
int mg_vcmp(const struct mg_str *str2, const char *str1);
|
|
||||||
---
|
|
||||||
|
|
||||||
Cross-platform version of `strcmp()` where where first string is
|
|
||||||
specified by `struct mg_str`.
|
|
||||||
|
|
||||||
@@ -1,5 +1,10 @@
|
|||||||
---
|
---
|
||||||
title: Design Concept
|
title: Design Concept
|
||||||
|
items:
|
||||||
|
- { type: file, name: memory-buffers.md }
|
||||||
|
- { type: file, name: event-handler.md }
|
||||||
|
- { type: file, name: events.md }
|
||||||
|
- { type: file, name: conn-flags.md }
|
||||||
---
|
---
|
||||||
|
|
||||||
Mongoose is a multi-protocol networking library that implements non-blocking,
|
Mongoose is a multi-protocol networking library that implements non-blocking,
|
||||||
|
|||||||
@@ -1,9 +0,0 @@
|
|||||||
{
|
|
||||||
"items": [
|
|
||||||
{ "type": "markdown", "name": "intro.md" },
|
|
||||||
{ "type": "markdown", "name": "memory-buffers.md" },
|
|
||||||
{ "type": "markdown", "name": "event-handler.md" },
|
|
||||||
{ "type": "markdown", "name": "events.md" },
|
|
||||||
{ "type": "markdown", "name": "conn-flags.md" }
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@@ -11,5 +11,4 @@ When Mongoose successfully writes data to the socket, it discards data from
|
|||||||
`struct mg_connection::send_mbuf` and sends `MG_EV_SEND` event. When connection
|
`struct mg_connection::send_mbuf` and sends `MG_EV_SEND` event. When connection
|
||||||
is closed, `MG_EV_CLOSE` event is sent.
|
is closed, `MG_EV_CLOSE` event is sent.
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
---
|
||||||
|
title: Mongoose - a networking library
|
||||||
|
color: '#1D6482'
|
||||||
|
repo: https://github.com/cesanta/mongoose
|
||||||
|
items:
|
||||||
|
- { type: file, name: overview.md }
|
||||||
|
- { type: dir, name: usage-example }
|
||||||
|
- { type: dir, name: design-concept }
|
||||||
|
- { type: dir, name: build-options }
|
||||||
|
- { type: flat, name: c-api }
|
||||||
|
---
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
{
|
|
||||||
"items": [
|
|
||||||
{ "type": "section", "name": "usage-example" },
|
|
||||||
{ "type": "section", "name": "design-concept" },
|
|
||||||
{ "type": "section", "name": "build-options" },
|
|
||||||
{ "type": "flat_sections_set", "name": "c-api" }
|
|
||||||
]
|
|
||||||
}
|
|
||||||
File renamed without changes.
@@ -0,0 +1,28 @@
|
|||||||
|
---
|
||||||
|
title: Overview
|
||||||
|
---
|
||||||
|
|
||||||
|
Mongoose is a swiss army knife for embedded network programming.
|
||||||
|
It implements event-driven non-blocking API for TCP, UDP, HTTP,
|
||||||
|
WebSocket, CoAP, MQTT for both client and server mode.
|
||||||
|
Features include:
|
||||||
|
|
||||||
|
- Cross-platform: works on Linux/UNIX, MacOS, QNX, eCos, Windows, Android,
|
||||||
|
iPhone, FreeRTOS (TI CC3200, ESP8266), etc
|
||||||
|
- Single-threaded, asynchronous, non-blocking core with simple event-based API
|
||||||
|
- Native support for [PicoTCP embedded TCP/IP stack](http://www.picotcp.com),
|
||||||
|
[LWIP embedded TCP/IP stack](https://en.wikipedia.org/wiki/LwIP)
|
||||||
|
- Builtin protocols:
|
||||||
|
- plain TCP, plain UDP, SSL/TLS (over TCP, one-way or two-way)
|
||||||
|
- HTTP client and server
|
||||||
|
- WebSocket client and server
|
||||||
|
- MQTT client and server
|
||||||
|
- CoAP client and server
|
||||||
|
- DNS client and server
|
||||||
|
- asynchronous DNS resolver
|
||||||
|
- Tiny static and run-time footprint
|
||||||
|
- Source code is both ISO C and ISO C++ compliant
|
||||||
|
- Very easy to integrate: just copy
|
||||||
|
[mongoose.c](https://raw.githubusercontent.com/cesanta/mongoose/master/mongoose.c) and
|
||||||
|
[mongoose.h](https://raw.githubusercontent.com/cesanta/mongoose/master/mongoose.h)
|
||||||
|
files to your build tree
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
{
|
|
||||||
"items": [
|
|
||||||
{ "type": "markdown", "name": "intro.md" }
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@@ -19,9 +19,9 @@ endif
|
|||||||
flash:
|
flash:
|
||||||
docker run --rm -it --privileged -v $(SRC_DIR):/src $(SDK) /bin/bash -c "\
|
docker run --rm -it --privileged -v $(SRC_DIR):/src $(SDK) /bin/bash -c "\
|
||||||
cd /usr/local/bin; \
|
cd /usr/local/bin; \
|
||||||
./cc3200prog $(PORT) /src/smartjs/platforms/cc3200/firmware/smartjs.bin \
|
./cc3200prog $(PORT) /src/fw/platforms/cc3200/firmware/fw.bin \
|
||||||
"
|
"
|
||||||
|
|
||||||
debug:
|
debug:
|
||||||
docker run --rm -it --privileged -v $(SRC_DIR):/src $(SDK) \
|
docker run --rm -it --privileged -v $(SRC_DIR):/src $(SDK) \
|
||||||
/bin/bash -c "cd /src/smartjs/platforms/cc3200 && tools/gdb.sh"
|
/bin/bash -c "cd /src/fw/platforms/cc3200 && tools/gdb.sh"
|
||||||
@@ -5,7 +5,6 @@
|
|||||||
PLATFORM = CC3200
|
PLATFORM = CC3200
|
||||||
SDK_PATH ?= /cc3200-sdk
|
SDK_PATH ?= /cc3200-sdk
|
||||||
REPO_PATH ?= ../../..
|
REPO_PATH ?= ../../..
|
||||||
COMMON_PATH ?= $(REPO_PATH)/common
|
|
||||||
BUILD_DIR ?= ./.build
|
BUILD_DIR ?= ./.build
|
||||||
FW_DIR ?= ./out
|
FW_DIR ?= ./out
|
||||||
SLFS_PATH ?= ./slfs
|
SLFS_PATH ?= ./slfs
|
||||||
@@ -23,7 +22,7 @@ IPATH = . ../.. $(REPO_PATH)
|
|||||||
|
|
||||||
VPATH = ../..
|
VPATH = ../..
|
||||||
|
|
||||||
MONGOOSE_FEATURES = -DMG_ENABLE_HTTP_STREAMING_MULTIPART
|
MONGOOSE_FEATURES = -DMG_ENABLE_SSL -DMG_ENABLE_HTTP_STREAMING_MULTIPART
|
||||||
|
|
||||||
SDK_FLAGS = -DUSE_FREERTOS -DSL_PLATFORM_MULTI_THREADED
|
SDK_FLAGS = -DUSE_FREERTOS -DSL_PLATFORM_MULTI_THREADED
|
||||||
# -DTARGET_IS_CC3200 would reduce code size by using functions in ROM
|
# -DTARGET_IS_CC3200 would reduce code size by using functions in ROM
|
||||||
@@ -31,7 +30,6 @@ SDK_FLAGS = -DUSE_FREERTOS -DSL_PLATFORM_MULTI_THREADED
|
|||||||
|
|
||||||
CFLAGS += -Os -Wall -Werror \
|
CFLAGS += -Os -Wall -Werror \
|
||||||
$(SDK_FLAGS) -DCS_PLATFORM=4 -DCC3200_FS_SLFS \
|
$(SDK_FLAGS) -DCS_PLATFORM=4 -DCC3200_FS_SLFS \
|
||||||
-DFS_SLFS_MAX_FILE_SIZE=131072 \
|
|
||||||
$(MONGOOSE_FEATURES) $(CFLAGS_EXTRA)
|
$(MONGOOSE_FEATURES) $(CFLAGS_EXTRA)
|
||||||
|
|
||||||
FW_ELF = $(FW_DIR)/$(PROG).axf
|
FW_ELF = $(FW_DIR)/$(PROG).axf
|
||||||
@@ -60,18 +58,18 @@ $(FW_DIR):
|
|||||||
$(FW_ZIP): $(FW_ELF) $(FW_BIN) $(SLFS_FILES)
|
$(FW_ZIP): $(FW_ELF) $(FW_BIN) $(SLFS_FILES)
|
||||||
@echo " Code size: $(shell ls -l $(FW_BIN) | awk '{print $$5}')"
|
@echo " Code size: $(shell ls -l $(FW_BIN) | awk '{print $$5}')"
|
||||||
@echo " GEN $(FW_MANIFEST)"
|
@echo " GEN $(FW_MANIFEST)"
|
||||||
@$(COMMON_PATH)/tools/fw_meta.py gen_build_info \
|
@fw_meta gen_build_info \
|
||||||
--json_output=$(BUILD_INFO_JSON)
|
--json_output=$(BUILD_INFO_JSON)
|
||||||
@cp -v $(SLFS_FILES) out/
|
@cp -v $(SLFS_FILES) out/
|
||||||
@$(COMMON_PATH)/tools/fw_meta.py create_manifest \
|
@fw_meta create_manifest \
|
||||||
--name=$(PROG) --platform=$(PLATFORM) \
|
--name=$(PROG) --platform=$(PLATFORM) \
|
||||||
--build_info=$(BUILD_INFO_JSON) \
|
--build_info=$(BUILD_INFO_JSON) \
|
||||||
--output=$(FW_MANIFEST) \
|
--output=$(FW_MANIFEST) \
|
||||||
--src_dir=$(FW_DIR) \
|
--src_dir=$(FW_DIR) \
|
||||||
sys_mcuimg.bin:src=$(notdir $(FW_BIN)) \
|
/sys/mcuimg.bin:src=$(notdir $(FW_BIN)) \
|
||||||
$(foreach f,$(SLFS_FILES), $(notdir $(f)):src=$(notdir $(f)))
|
$(foreach f,$(SLFS_FILES), $(notdir $(f)):src=$(notdir $(f)))
|
||||||
@echo " ZIP $@"
|
@echo " ZIP $@"
|
||||||
@$(COMMON_PATH)/tools/fw_meta.py create_fw \
|
@fw_meta create_fw \
|
||||||
--manifest=$(FW_MANIFEST) \
|
--manifest=$(FW_MANIFEST) \
|
||||||
--src_dir=$(FW_DIR) \
|
--src_dir=$(FW_DIR) \
|
||||||
--output=$@
|
--output=$@
|
||||||
@@ -105,4 +103,3 @@ ENTRY_$(PROG) = ResetISR
|
|||||||
|
|
||||||
SDK_OBJS = $(addprefix $(OBJDIR)/,$(patsubst %.c,%.o,$(SDK_SRCS)))
|
SDK_OBJS = $(addprefix $(OBJDIR)/,$(patsubst %.c,%.o,$(SDK_SRCS)))
|
||||||
$(SDK_OBJS): CFLAGS += -include mongoose.h -Wno-missing-braces -Wno-strict-aliasing -Wno-parentheses -Wno-unused-variable
|
$(SDK_OBJS): CFLAGS += -include mongoose.h -Wno-missing-braces -Wno-strict-aliasing -Wno-parentheses -Wno-unused-variable
|
||||||
$(BUILD_DIR)/cc_pal.o: CFLAGS += -Wno-error
|
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* app.ld
|
* app.ld
|
||||||
*
|
*
|
||||||
* GCC Linker script for SmartJS. Based on TI's example "blinky.ld".
|
* GCC Linker script for Mongoose IoT. Based on TI's example "blinky.ld".
|
||||||
*
|
*
|
||||||
* Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/
|
* Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<?ccsproject version="1.0"?>
|
||||||
|
<projectOptions>
|
||||||
|
<deviceVariant value="Cortex M.CC3200"/>
|
||||||
|
<deviceFamily value="TMS470"/>
|
||||||
|
<deviceEndianness value="little"/>
|
||||||
|
<codegenToolVersion value="5.2.7"/>
|
||||||
|
<isElfFormat value="true"/>
|
||||||
|
<connection value="common/targetdb/connections/Stellaris_ICDI_Connection.xml"/>
|
||||||
|
<linkerCommandFile value="cc3200v1p32.cmd"/>
|
||||||
|
<rts value="libc.a"/>
|
||||||
|
<createSlaveProjects value=""/>
|
||||||
|
<templateProperties value="id=com.ti.common.project.core.emptyProjectWithMainTemplate,"/>
|
||||||
|
<isTargetManual value="false"/>
|
||||||
|
</projectOptions>
|
||||||
@@ -0,0 +1,214 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
|
||||||
|
<storageModule configRelations="2" moduleId="org.eclipse.cdt.core.settings">
|
||||||
|
<cconfiguration id="com.ti.ccstudio.buildDefinitions.TMS470.Debug.2139411143">
|
||||||
|
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.ti.ccstudio.buildDefinitions.TMS470.Debug.2139411143" moduleId="org.eclipse.cdt.core.settings" name="Debug">
|
||||||
|
<externalSettings/>
|
||||||
|
<extensions>
|
||||||
|
<extension id="com.ti.ccstudio.errorparser.CoffErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||||
|
<extension id="com.ti.ccstudio.errorparser.LinkErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||||
|
<extension id="com.ti.ccstudio.errorparser.AsmErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||||
|
<extension id="com.ti.ccstudio.binaryparser.CoffParser" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||||
|
</extensions>
|
||||||
|
</storageModule>
|
||||||
|
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||||
|
<configuration artifactExtension="out" artifactName="${ProjName}" buildProperties="" cleanCommand="${CG_CLEAN_CMD}" description="" id="com.ti.ccstudio.buildDefinitions.TMS470.Debug.2139411143" name="Debug" parent="com.ti.ccstudio.buildDefinitions.TMS470.Debug" postbuildStep="" prebuildStep="">
|
||||||
|
<folderInfo id="com.ti.ccstudio.buildDefinitions.TMS470.Debug.2139411143." name="/" resourcePath="">
|
||||||
|
<toolChain id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.exe.DebugToolchain.929985441" name="TI Build Tools" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.exe.DebugToolchain" targetTool="com.ti.ccstudio.buildDefinitions.TMS470_5.2.exe.linkerDebug.273728804">
|
||||||
|
<option id="com.ti.ccstudio.buildDefinitions.core.OPT_TAGS.258663176" superClass="com.ti.ccstudio.buildDefinitions.core.OPT_TAGS" valueType="stringList">
|
||||||
|
<listOptionValue builtIn="false" value="DEVICE_CONFIGURATION_ID=Cortex M.CC3200"/>
|
||||||
|
<listOptionValue builtIn="false" value="DEVICE_ENDIANNESS=little"/>
|
||||||
|
<listOptionValue builtIn="false" value="OUTPUT_FORMAT=ELF"/>
|
||||||
|
<listOptionValue builtIn="false" value="CCS_MBS_VERSION=5.5.0"/>
|
||||||
|
<listOptionValue builtIn="false" value="LINKER_COMMAND_FILE=cc3200v1p32.cmd"/>
|
||||||
|
<listOptionValue builtIn="false" value="RUNTIME_SUPPORT_LIBRARY=libc.a"/>
|
||||||
|
<listOptionValue builtIn="false" value="OUTPUT_TYPE=executable"/>
|
||||||
|
</option>
|
||||||
|
<option id="com.ti.ccstudio.buildDefinitions.core.OPT_CODEGEN_VERSION.324606890" name="Compiler version" superClass="com.ti.ccstudio.buildDefinitions.core.OPT_CODEGEN_VERSION" value="5.2.7" valueType="string"/>
|
||||||
|
<targetPlatform id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.exe.targetPlatformDebug.1595303251" name="Platform" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.exe.targetPlatformDebug"/>
|
||||||
|
<builder buildPath="${BuildDirectory}" id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.exe.builderDebug.664577987" keepEnvironmentInBuildfile="false" name="GNU Make" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.exe.builderDebug"/>
|
||||||
|
<tool id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.exe.compilerDebug.239238133" name="ARM Compiler" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.exe.compilerDebug">
|
||||||
|
<option id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.DEFINE.1334773591" name="Pre-define NAME (--define, -D)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.DEFINE" valueType="definedSymbols">
|
||||||
|
<listOptionValue builtIn="false" value="MG_ENABLE_HTTP_STREAMING_MULTIPART=1"/>
|
||||||
|
<listOptionValue builtIn="false" value="SL_PLATFORM_MULTI_THREADED=1"/>
|
||||||
|
<listOptionValue builtIn="false" value="MG_FS_SLFS=1"/>
|
||||||
|
<listOptionValue builtIn="false" value="USE_FREERTOS"/>
|
||||||
|
<listOptionValue builtIn="false" value="cc3200"/>
|
||||||
|
</option>
|
||||||
|
<option id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.SILICON_VERSION.731249297" name="Target processor version (--silicon_version, -mv)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.SILICON_VERSION" value="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.SILICON_VERSION.7M4" valueType="enumerated"/>
|
||||||
|
<option id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.CODE_STATE.1786958507" name="Designate code state, 16-bit (thumb) or 32-bit (--code_state)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.CODE_STATE" value="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.CODE_STATE.16" valueType="enumerated"/>
|
||||||
|
<option id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.ABI.1146878710" name="Application binary interface. [See 'General' page to edit] (--abi)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.ABI" value="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.ABI.eabi" valueType="enumerated"/>
|
||||||
|
<option id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.FLOAT_SUPPORT.627547538" name="Specify floating point support (--float_support)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.FLOAT_SUPPORT" value="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.FLOAT_SUPPORT.vfplib" valueType="enumerated"/>
|
||||||
|
<option id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.LITTLE_ENDIAN.1274157874" name="Little endian code [See 'General' page to edit] (--little_endian, -me)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.LITTLE_ENDIAN" value="true" valueType="boolean"/>
|
||||||
|
<option id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.INCLUDE_PATH.1258458633" name="Add dir to #include search path (--include_path, -I)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.INCLUDE_PATH" valueType="includePath">
|
||||||
|
<listOptionValue builtIn="false" value=""${CG_TOOL_ROOT}/include""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${CC3200_SDK_ROOT}/simplelink_extlib/provisioninglib""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${CC3200_SDK_ROOT}/oslib""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${CC3200_SDK_ROOT}/driverlib/""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${CC3200_SDK_ROOT}/simplelink/""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${CC3200_SDK_ROOT}/""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${CC3200_SDK_ROOT}/simplelink/include""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${CC3200_SDK_ROOT}/inc""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${CC3200_SDK_ROOT}/example/common""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${PROJECT_LOC}/../Mongoose""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${PROJECT_LOC}/../..""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${PROJECT_LOC}/../../../..""/>
|
||||||
|
</option>
|
||||||
|
<option id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.DEBUGGING_MODEL.441599099" name="Debugging model" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.DEBUGGING_MODEL" value="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.DEBUGGING_MODEL.SYMDEBUG__DWARF" valueType="enumerated"/>
|
||||||
|
<option id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.DIAG_WRAP.1882962798" name="Wrap diagnostic messages (--diag_wrap)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.DIAG_WRAP" value="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.DIAG_WRAP.off" valueType="enumerated"/>
|
||||||
|
<option id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.DISPLAY_ERROR_NUMBER.988736284" name="Emit diagnostic identifier numbers (--display_error_number, -pden)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.DISPLAY_ERROR_NUMBER" value="true" valueType="boolean"/>
|
||||||
|
<option id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.DIAG_WARNING.108721469" name="Treat diagnostic <id> as warning (--diag_warning, -pdsw)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.DIAG_WARNING" valueType="stringList">
|
||||||
|
<listOptionValue builtIn="false" value="225"/>
|
||||||
|
</option>
|
||||||
|
<option id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.OPT_LEVEL.1654856947" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.OPT_LEVEL" value="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.OPT_LEVEL.4" valueType="enumerated"/>
|
||||||
|
<option id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.OPT_FOR_SPEED.610557791" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.OPT_FOR_SPEED" value="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.OPT_FOR_SPEED.0" valueType="enumerated"/>
|
||||||
|
<inputType id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compiler.inputType__C_SRCS.1309113096" name="C Sources" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compiler.inputType__C_SRCS"/>
|
||||||
|
<inputType id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compiler.inputType__CPP_SRCS.637644727" name="C++ Sources" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compiler.inputType__CPP_SRCS"/>
|
||||||
|
<inputType id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compiler.inputType__ASM_SRCS.1237578949" name="Assembly Sources" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compiler.inputType__ASM_SRCS"/>
|
||||||
|
<inputType id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compiler.inputType__ASM2_SRCS.1197212538" name="Assembly Sources" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compiler.inputType__ASM2_SRCS"/>
|
||||||
|
</tool>
|
||||||
|
<tool id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.exe.linkerDebug.273728804" name="ARM Linker" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.exe.linkerDebug">
|
||||||
|
<option id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.linkerID.STACK_SIZE.1521937237" name="Set C system stack size (--stack_size, -stack)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.linkerID.STACK_SIZE" value="0x100" valueType="string"/>
|
||||||
|
<option id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.linkerID.HEAP_SIZE.384792165" name="Heap size for C/C++ dynamic memory allocation (--heap_size, -heap)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.linkerID.HEAP_SIZE" value="0xB000" valueType="string"/>
|
||||||
|
<option id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.linkerID.MAP_FILE.1759256980" name="Link information (map) listed into <file> (--map_file, -m)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.linkerID.MAP_FILE" value=""${ProjName}.map"" valueType="string"/>
|
||||||
|
<option id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.linkerID.OUTPUT_FILE.223170305" name="Specify output file name (--output_file, -o)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.linkerID.OUTPUT_FILE" value=""${ProjName}.out"" valueType="string"/>
|
||||||
|
<option id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.linkerID.LIBRARY.941567896" name="Include library file or command file as input (--library, -l)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.linkerID.LIBRARY" valueType="libs">
|
||||||
|
<listOptionValue builtIn="false" value=""libc.a""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${PROJECT_ROOT}/../Mongoose/Debug/Mongoose.lib""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${CC3200_SDK_ROOT}/simplelink/ccs/OS/simplelink.a""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${CC3200_SDK_ROOT}/driverlib/ccs/Release/driverlib.a""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${CC3200_SDK_ROOT}/oslib/ccs/free_rtos/free_rtos.a""/>
|
||||||
|
</option>
|
||||||
|
<option id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.linkerID.SEARCH_PATH.1487719636" name="Add <dir> to library search path (--search_path, -i)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.linkerID.SEARCH_PATH" valueType="libPaths">
|
||||||
|
<listOptionValue builtIn="false" value=""${CG_TOOL_ROOT}/lib""/>
|
||||||
|
</option>
|
||||||
|
<option id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.linkerID.DISPLAY_ERROR_NUMBER.527313065" name="Emit diagnostic identifier numbers (--display_error_number)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.linkerID.DISPLAY_ERROR_NUMBER" value="true" valueType="boolean"/>
|
||||||
|
<option id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.linkerID.DIAG_WRAP.470008330" name="Wrap diagnostic messages (--diag_wrap)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.linkerID.DIAG_WRAP" value="com.ti.ccstudio.buildDefinitions.TMS470_5.2.linkerID.DIAG_WRAP.off" valueType="enumerated"/>
|
||||||
|
<option id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.linkerID.XML_LINK_INFO.1060401668" name="Detailed link information data-base into <file> (--xml_link_info, -xml_link_info)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.linkerID.XML_LINK_INFO" value=""${ProjName}_linkInfo.xml"" valueType="string"/>
|
||||||
|
<inputType id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.exeLinker.inputType__CMD_SRCS.703137823" name="Linker Command Files" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.exeLinker.inputType__CMD_SRCS"/>
|
||||||
|
<inputType id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.exeLinker.inputType__CMD2_SRCS.1106081123" name="Linker Command Files" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.exeLinker.inputType__CMD2_SRCS"/>
|
||||||
|
<inputType id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.exeLinker.inputType__GEN_CMDS.1215238770" name="Generated Linker Command Files" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.exeLinker.inputType__GEN_CMDS"/>
|
||||||
|
</tool>
|
||||||
|
<tool id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.hex.537525921" name="ARM Hex Utility" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.hex"/>
|
||||||
|
</toolChain>
|
||||||
|
</folderInfo>
|
||||||
|
</configuration>
|
||||||
|
</storageModule>
|
||||||
|
<storageModule moduleId="org.eclipse.cdt.core.externalSettings">
|
||||||
|
<externalSettings containerId="Mongoose;com.ti.ccstudio.buildDefinitions.TMS470.Debug.491265557" factoryId="org.eclipse.cdt.core.cfg.export.settings.sipplier"/>
|
||||||
|
</storageModule>
|
||||||
|
</cconfiguration>
|
||||||
|
<cconfiguration id="com.ti.ccstudio.buildDefinitions.TMS470.Release.2030896039">
|
||||||
|
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.ti.ccstudio.buildDefinitions.TMS470.Release.2030896039" moduleId="org.eclipse.cdt.core.settings" name="Release">
|
||||||
|
<externalSettings/>
|
||||||
|
<extensions>
|
||||||
|
<extension id="com.ti.ccstudio.errorparser.CoffErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||||
|
<extension id="com.ti.ccstudio.errorparser.LinkErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||||
|
<extension id="com.ti.ccstudio.errorparser.AsmErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||||
|
<extension id="com.ti.ccstudio.binaryparser.CoffParser" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||||
|
</extensions>
|
||||||
|
</storageModule>
|
||||||
|
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||||
|
<configuration artifactExtension="out" artifactName="${ProjName}" buildProperties="" cleanCommand="${CG_CLEAN_CMD}" description="" id="com.ti.ccstudio.buildDefinitions.TMS470.Release.2030896039" name="Release" parent="com.ti.ccstudio.buildDefinitions.TMS470.Release" postbuildStep="" prebuildStep="">
|
||||||
|
<folderInfo id="com.ti.ccstudio.buildDefinitions.TMS470.Release.2030896039." name="/" resourcePath="">
|
||||||
|
<toolChain id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.exe.ReleaseToolchain.203807862" name="TI Build Tools" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.exe.ReleaseToolchain" targetTool="com.ti.ccstudio.buildDefinitions.TMS470_5.2.exe.linkerRelease.603260672">
|
||||||
|
<option id="com.ti.ccstudio.buildDefinitions.core.OPT_TAGS.1946983343" superClass="com.ti.ccstudio.buildDefinitions.core.OPT_TAGS" valueType="stringList">
|
||||||
|
<listOptionValue builtIn="false" value="DEVICE_CONFIGURATION_ID=Cortex M.CC3200"/>
|
||||||
|
<listOptionValue builtIn="false" value="DEVICE_ENDIANNESS=little"/>
|
||||||
|
<listOptionValue builtIn="false" value="OUTPUT_FORMAT=ELF"/>
|
||||||
|
<listOptionValue builtIn="false" value="CCS_MBS_VERSION=5.5.0"/>
|
||||||
|
<listOptionValue builtIn="false" value="LINKER_COMMAND_FILE=cc3200v1p32.cmd"/>
|
||||||
|
<listOptionValue builtIn="false" value="RUNTIME_SUPPORT_LIBRARY=libc.a"/>
|
||||||
|
<listOptionValue builtIn="false" value="OUTPUT_TYPE=executable"/>
|
||||||
|
</option>
|
||||||
|
<option id="com.ti.ccstudio.buildDefinitions.core.OPT_CODEGEN_VERSION.541661556" name="Compiler version" superClass="com.ti.ccstudio.buildDefinitions.core.OPT_CODEGEN_VERSION" value="5.2.7" valueType="string"/>
|
||||||
|
<targetPlatform id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.exe.targetPlatformRelease.1731528219" name="Platform" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.exe.targetPlatformRelease"/>
|
||||||
|
<builder buildPath="${BuildDirectory}" id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.exe.builderRelease.1517621311" keepEnvironmentInBuildfile="false" name="GNU Make" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.exe.builderRelease"/>
|
||||||
|
<tool id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.exe.compilerRelease.1511107079" name="ARM Compiler" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.exe.compilerRelease">
|
||||||
|
<option id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.DEFINE.709446512" name="Pre-define NAME (--define, -D)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.DEFINE" valueType="definedSymbols">
|
||||||
|
<listOptionValue builtIn="false" value="MG_ENABLE_HTTP_STREAMING_MULTIPART=1"/>
|
||||||
|
<listOptionValue builtIn="false" value="SL_PLATFORM_MULTI_THREADED=1"/>
|
||||||
|
<listOptionValue builtIn="false" value="MG_FS_SLFS=1"/>
|
||||||
|
<listOptionValue builtIn="false" value="USE_FREERTOS"/>
|
||||||
|
<listOptionValue builtIn="false" value="cc3200"/>
|
||||||
|
</option>
|
||||||
|
<option id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.SILICON_VERSION.25059129" name="Target processor version (--silicon_version, -mv)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.SILICON_VERSION" value="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.SILICON_VERSION.7M4" valueType="enumerated"/>
|
||||||
|
<option id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.CODE_STATE.1599303984" name="Designate code state, 16-bit (thumb) or 32-bit (--code_state)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.CODE_STATE" value="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.CODE_STATE.16" valueType="enumerated"/>
|
||||||
|
<option id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.ABI.462249516" name="Application binary interface. [See 'General' page to edit] (--abi)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.ABI" value="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.ABI.eabi" valueType="enumerated"/>
|
||||||
|
<option id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.FLOAT_SUPPORT.628710870" name="Specify floating point support (--float_support)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.FLOAT_SUPPORT" value="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.FLOAT_SUPPORT.vfplib" valueType="enumerated"/>
|
||||||
|
<option id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.DIAG_WARNING.1313521771" name="Treat diagnostic <id> as warning (--diag_warning, -pdsw)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.DIAG_WARNING" valueType="stringList">
|
||||||
|
<listOptionValue builtIn="false" value="225"/>
|
||||||
|
</option>
|
||||||
|
<option id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.DISPLAY_ERROR_NUMBER.1137425146" name="Emit diagnostic identifier numbers (--display_error_number, -pden)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.DISPLAY_ERROR_NUMBER" value="true" valueType="boolean"/>
|
||||||
|
<option id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.DIAG_WRAP.1217155594" name="Wrap diagnostic messages (--diag_wrap)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.DIAG_WRAP" value="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.DIAG_WRAP.off" valueType="enumerated"/>
|
||||||
|
<option id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.INCLUDE_PATH.1877995914" name="Add dir to #include search path (--include_path, -I)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.INCLUDE_PATH" valueType="includePath">
|
||||||
|
<listOptionValue builtIn="false" value=""${CG_TOOL_ROOT}/include""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${CC3200_SDK_ROOT}/simplelink_extlib/provisioninglib""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${CC3200_SDK_ROOT}/oslib""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${CC3200_SDK_ROOT}/driverlib/""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${CC3200_SDK_ROOT}/simplelink/""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${CC3200_SDK_ROOT}/""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${CC3200_SDK_ROOT}/simplelink/include""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${CC3200_SDK_ROOT}/inc""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${CC3200_SDK_ROOT}/example/common""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${PROJECT_LOC}/../Mongoose""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${PROJECT_LOC}/../..""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${PROJECT_LOC}/../../../..""/>
|
||||||
|
</option>
|
||||||
|
<option id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.LITTLE_ENDIAN.1313166043" name="Little endian code [See 'General' page to edit] (--little_endian, -me)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.LITTLE_ENDIAN" value="true" valueType="boolean"/>
|
||||||
|
<option id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.OPT_LEVEL.release.1366420658" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.OPT_LEVEL.release" value="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.OPT_LEVEL.4" valueType="enumerated"/>
|
||||||
|
<option id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.OPT_FOR_SPEED.1169603203" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.OPT_FOR_SPEED" value="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.OPT_FOR_SPEED.0" valueType="enumerated"/>
|
||||||
|
<inputType id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compiler.inputType__C_SRCS.884396305" name="C Sources" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compiler.inputType__C_SRCS"/>
|
||||||
|
<inputType id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compiler.inputType__CPP_SRCS.1552076672" name="C++ Sources" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compiler.inputType__CPP_SRCS"/>
|
||||||
|
<inputType id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compiler.inputType__ASM_SRCS.1932242817" name="Assembly Sources" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compiler.inputType__ASM_SRCS"/>
|
||||||
|
<inputType id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compiler.inputType__ASM2_SRCS.564471106" name="Assembly Sources" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compiler.inputType__ASM2_SRCS"/>
|
||||||
|
</tool>
|
||||||
|
<tool id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.exe.linkerRelease.603260672" name="ARM Linker" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.exe.linkerRelease">
|
||||||
|
<option id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.linkerID.STACK_SIZE.999455186" name="Set C system stack size (--stack_size, -stack)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.linkerID.STACK_SIZE" value="0x512" valueType="string"/>
|
||||||
|
<option id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.linkerID.HEAP_SIZE.1142745068" name="Heap size for C/C++ dynamic memory allocation (--heap_size, -heap)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.linkerID.HEAP_SIZE" value="0x0" valueType="string"/>
|
||||||
|
<option id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.linkerID.OUTPUT_FILE.592894575" name="Specify output file name (--output_file, -o)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.linkerID.OUTPUT_FILE" value=""${ProjName}.out"" valueType="string"/>
|
||||||
|
<option id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.linkerID.MAP_FILE.767606951" name="Link information (map) listed into <file> (--map_file, -m)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.linkerID.MAP_FILE" value=""${ProjName}.map"" valueType="string"/>
|
||||||
|
<option id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.linkerID.XML_LINK_INFO.88933399" name="Detailed link information data-base into <file> (--xml_link_info, -xml_link_info)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.linkerID.XML_LINK_INFO" value=""${ProjName}_linkInfo.xml"" valueType="string"/>
|
||||||
|
<option id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.linkerID.DISPLAY_ERROR_NUMBER.670906651" name="Emit diagnostic identifier numbers (--display_error_number)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.linkerID.DISPLAY_ERROR_NUMBER" value="true" valueType="boolean"/>
|
||||||
|
<option id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.linkerID.DIAG_WRAP.69171285" name="Wrap diagnostic messages (--diag_wrap)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.linkerID.DIAG_WRAP" value="com.ti.ccstudio.buildDefinitions.TMS470_5.2.linkerID.DIAG_WRAP.off" valueType="enumerated"/>
|
||||||
|
<option id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.linkerID.SEARCH_PATH.2058160037" name="Add <dir> to library search path (--search_path, -i)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.linkerID.SEARCH_PATH" valueType="libPaths">
|
||||||
|
<listOptionValue builtIn="false" value=""${CG_TOOL_ROOT}/lib""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${CG_TOOL_ROOT}/include""/>
|
||||||
|
</option>
|
||||||
|
<option id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.linkerID.LIBRARY.1140912133" name="Include library file or command file as input (--library, -l)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.linkerID.LIBRARY" valueType="libs">
|
||||||
|
<listOptionValue builtIn="false" value=""libc.a""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${PROJECT_ROOT}/../Mongoose/Release/Mongoose.lib""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${CC3200_SDK_ROOT}/simplelink/ccs/OS/simplelink.a""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${CC3200_SDK_ROOT}/driverlib/ccs/Release/driverlib.a""/>
|
||||||
|
<listOptionValue builtIn="false" value=""${CC3200_SDK_ROOT}/oslib/ccs/free_rtos/free_rtos.a""/>
|
||||||
|
</option>
|
||||||
|
<inputType id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.exeLinker.inputType__CMD_SRCS.852025912" name="Linker Command Files" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.exeLinker.inputType__CMD_SRCS"/>
|
||||||
|
<inputType id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.exeLinker.inputType__CMD2_SRCS.445406552" name="Linker Command Files" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.exeLinker.inputType__CMD2_SRCS"/>
|
||||||
|
<inputType id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.exeLinker.inputType__GEN_CMDS.1688064227" name="Generated Linker Command Files" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.exeLinker.inputType__GEN_CMDS"/>
|
||||||
|
</tool>
|
||||||
|
<tool id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.hex.1751465904" name="ARM Hex Utility" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.hex"/>
|
||||||
|
</toolChain>
|
||||||
|
</folderInfo>
|
||||||
|
</configuration>
|
||||||
|
</storageModule>
|
||||||
|
<storageModule moduleId="org.eclipse.cdt.core.externalSettings">
|
||||||
|
<externalSettings containerId="Mongoose;com.ti.ccstudio.buildDefinitions.TMS470.Release.900958360" factoryId="org.eclipse.cdt.core.cfg.export.settings.sipplier"/>
|
||||||
|
</storageModule>
|
||||||
|
</cconfiguration>
|
||||||
|
</storageModule>
|
||||||
|
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
|
||||||
|
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||||
|
<project id="MG_hello.com.ti.ccstudio.buildDefinitions.TMS470.ProjectType.218900570" name="ARM" projectType="com.ti.ccstudio.buildDefinitions.TMS470.ProjectType"/>
|
||||||
|
</storageModule>
|
||||||
|
<storageModule moduleId="scannerConfiguration"/>
|
||||||
|
<storageModule moduleId="org.eclipse.cdt.core.language.mapping">
|
||||||
|
<project-mappings>
|
||||||
|
<content-type-mapping configuration="" content-type="org.eclipse.cdt.core.asmSource" language="com.ti.ccstudio.core.TIASMLanguage"/>
|
||||||
|
<content-type-mapping configuration="" content-type="org.eclipse.cdt.core.cHeader" language="com.ti.ccstudio.core.TIGCCLanguage"/>
|
||||||
|
<content-type-mapping configuration="" content-type="org.eclipse.cdt.core.cSource" language="com.ti.ccstudio.core.TIGCCLanguage"/>
|
||||||
|
<content-type-mapping configuration="" content-type="org.eclipse.cdt.core.cxxHeader" language="com.ti.ccstudio.core.TIGPPLanguage"/>
|
||||||
|
<content-type-mapping configuration="" content-type="org.eclipse.cdt.core.cxxSource" language="com.ti.ccstudio.core.TIGPPLanguage"/>
|
||||||
|
</project-mappings>
|
||||||
|
</storageModule>
|
||||||
|
<storageModule moduleId="refreshScope"/>
|
||||||
|
</cproject>
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<projectDescription>
|
||||||
|
<name>MG_hello</name>
|
||||||
|
<comment></comment>
|
||||||
|
<projects>
|
||||||
|
<project>Mongoose</project>
|
||||||
|
</projects>
|
||||||
|
<buildSpec>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
|
||||||
|
<triggers>full,incremental,</triggers>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
</buildSpec>
|
||||||
|
<natures>
|
||||||
|
<nature>com.ti.ccstudio.core.ccsNature</nature>
|
||||||
|
<nature>org.eclipse.cdt.core.cnature</nature>
|
||||||
|
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
|
||||||
|
<nature>org.eclipse.cdt.core.ccnature</nature>
|
||||||
|
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
|
||||||
|
</natures>
|
||||||
|
<linkedResources>
|
||||||
|
<link>
|
||||||
|
<name>gpio_if.c</name>
|
||||||
|
<type>1</type>
|
||||||
|
<locationURI>CC3200_SDK_ROOT/example/common/gpio_if.c</locationURI>
|
||||||
|
</link>
|
||||||
|
<link>
|
||||||
|
<name>network_common.c</name>
|
||||||
|
<type>1</type>
|
||||||
|
<locationURI>CC3200_SDK_ROOT/example/common/network_common.c</locationURI>
|
||||||
|
</link>
|
||||||
|
<link>
|
||||||
|
<name>startup_ccs.c</name>
|
||||||
|
<type>1</type>
|
||||||
|
<locationURI>CC3200_SDK_ROOT/example/common/startup_ccs.c</locationURI>
|
||||||
|
</link>
|
||||||
|
<link>
|
||||||
|
<name>wifi.c</name>
|
||||||
|
<type>1</type>
|
||||||
|
<locationURI>PARENT-2-PROJECT_LOC/wifi.c</locationURI>
|
||||||
|
</link>
|
||||||
|
<link>
|
||||||
|
<name>wifi.h</name>
|
||||||
|
<type>1</type>
|
||||||
|
<locationURI>PARENT-2-PROJECT_LOC/wifi.h</locationURI>
|
||||||
|
</link>
|
||||||
|
</linkedResources>
|
||||||
|
<variableList>
|
||||||
|
<variable>
|
||||||
|
<name>CC3200_SDK_ROOT</name>
|
||||||
|
<value>$%7BTI_PRODUCTS_DIR%7D/CC3200SDK_1.2.0/cc3200-sdk</value>
|
||||||
|
</variable>
|
||||||
|
</variableList>
|
||||||
|
</projectDescription>
|
||||||
@@ -0,0 +1,82 @@
|
|||||||
|
//*****************************************************************************
|
||||||
|
// cc3200v1p32.cmd
|
||||||
|
//
|
||||||
|
// CCS linker configuration file for cc3200 ES 1.32.
|
||||||
|
//
|
||||||
|
// Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without
|
||||||
|
// modification, are permitted provided that the following conditions
|
||||||
|
// are met:
|
||||||
|
//
|
||||||
|
// Redistributions of source code must retain the above copyright
|
||||||
|
// notice, this list of conditions and the following disclaimer.
|
||||||
|
//
|
||||||
|
// Redistributions in binary form must reproduce the above copyright
|
||||||
|
// notice, this list of conditions and the following disclaimer in the
|
||||||
|
// documentation and/or other materials provided with the
|
||||||
|
// distribution.
|
||||||
|
//
|
||||||
|
// Neither the name of Texas Instruments Incorporated nor the names of
|
||||||
|
// its contributors may be used to endorse or promote products derived
|
||||||
|
// from this software without specific prior written permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
//
|
||||||
|
//*****************************************************************************
|
||||||
|
|
||||||
|
|
||||||
|
--retain=g_pfnVectors
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
// The following command line options are set as part of the CCS project.
|
||||||
|
// If you are building using the command line, or for some reason want to
|
||||||
|
// define them here, you can uncomment and modify these lines as needed.
|
||||||
|
// If you are using CCS for building, it is probably better to make any such
|
||||||
|
// modifications in your CCS project and leave this file alone.
|
||||||
|
//*****************************************************************************
|
||||||
|
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
// The starting address of the application. Normally the interrupt vectors
|
||||||
|
// must be located at the beginning of the application.
|
||||||
|
//*****************************************************************************
|
||||||
|
#define RAM_BASE 0x20004000
|
||||||
|
|
||||||
|
/* System memory map */
|
||||||
|
|
||||||
|
MEMORY
|
||||||
|
{
|
||||||
|
/* Application uses internal RAM for program and data */
|
||||||
|
SRAM_CODE (RWX) : origin = 0x20004000, length = 0x20000
|
||||||
|
SRAM_DATA (RWX) : origin = 0x20024000, length = 0x1C000
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Section allocation in memory */
|
||||||
|
|
||||||
|
SECTIONS
|
||||||
|
{
|
||||||
|
.intvecs: > RAM_BASE
|
||||||
|
.init_array : > SRAM_CODE
|
||||||
|
.vtable : > SRAM_CODE
|
||||||
|
.text : > SRAM_CODE
|
||||||
|
.const : > SRAM_CODE
|
||||||
|
.cinit : > SRAM_CODE
|
||||||
|
.pinit : > SRAM_CODE
|
||||||
|
.data : > SRAM_DATA
|
||||||
|
.bss : > SRAM_DATA
|
||||||
|
.sysmem : > SRAM_DATA
|
||||||
|
.stack : > SRAM_DATA(HIGH)
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,245 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2014-2016 Cesanta Software Limited
|
||||||
|
* All rights reserved
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Set up an AP or connect to existing WiFi network. */
|
||||||
|
#define WIFI_AP_SSID "Mongoose"
|
||||||
|
#define WIFI_AP_PASS ""
|
||||||
|
#define WIFI_AP_CHAN 6
|
||||||
|
// #define WIFI_STA_SSID "YourWiFi"
|
||||||
|
// #define WIFI_STA_PASS "YourPass"
|
||||||
|
|
||||||
|
#define MG_TASK_PRIORITY 3
|
||||||
|
#define MG_TASK_STACK_SIZE 8192
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <inc/hw_types.h>
|
||||||
|
#include <inc/hw_ints.h>
|
||||||
|
#include <inc/hw_memmap.h>
|
||||||
|
|
||||||
|
#include <driverlib/gpio.h>
|
||||||
|
#include <driverlib/interrupt.h>
|
||||||
|
#include <driverlib/pin.h>
|
||||||
|
#include <driverlib/prcm.h>
|
||||||
|
#include <driverlib/rom.h>
|
||||||
|
#include <driverlib/rom_map.h>
|
||||||
|
|
||||||
|
#include <example/common/gpio_if.h>
|
||||||
|
|
||||||
|
/* Mongoose.h brings in SimpleLink support. Do not include simplelink.h. */
|
||||||
|
#include <mongoose.h>
|
||||||
|
|
||||||
|
#include <simplelink/include/device.h>
|
||||||
|
|
||||||
|
#include "wifi.h"
|
||||||
|
|
||||||
|
void fs_slfs_set_new_file_size(const char *name, size_t size);
|
||||||
|
|
||||||
|
static const char *upload_form =
|
||||||
|
"\
|
||||||
|
<h1>Upload file</h1> \
|
||||||
|
<form action='/upload' method='POST' enctype='multipart/form-data'> \
|
||||||
|
<input type='file' name='file'> \
|
||||||
|
<input type='submit' value='Upload'> \
|
||||||
|
</form>";
|
||||||
|
|
||||||
|
static struct mg_str upload_fname(struct mg_connection *nc,
|
||||||
|
struct mg_str fname) {
|
||||||
|
struct mg_str lfn;
|
||||||
|
char *fn = malloc(fname.len + 4);
|
||||||
|
memcpy(fn, "SL:", 3);
|
||||||
|
memcpy(fn + 3, fname.p, fname.len);
|
||||||
|
fn[3 + fname.len] = '\0';
|
||||||
|
if (nc->user_data != NULL) {
|
||||||
|
intptr_t cl = (intptr_t) nc->user_data;
|
||||||
|
if (cl >= 0) {
|
||||||
|
fs_slfs_set_new_file_size(fn + 3, cl);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
lfn.len = fname.len + 4;
|
||||||
|
lfn.p = fn;
|
||||||
|
return lfn;
|
||||||
|
}
|
||||||
|
|
||||||
|
void mg_ev_handler(struct mg_connection *nc, int ev, void *ev_data) {
|
||||||
|
LOG(LL_DEBUG, ("%p ev %d", nc, ev));
|
||||||
|
|
||||||
|
switch (ev) {
|
||||||
|
case MG_EV_ACCEPT: {
|
||||||
|
char addr[32];
|
||||||
|
mg_sock_addr_to_str(&nc->sa, addr, sizeof(addr),
|
||||||
|
MG_SOCK_STRINGIFY_IP | MG_SOCK_STRINGIFY_PORT);
|
||||||
|
LOG(LL_INFO, ("Connection %p from %s", nc, addr));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case MG_EV_HTTP_REQUEST: {
|
||||||
|
char addr[32];
|
||||||
|
struct http_message *hm = (struct http_message *) ev_data;
|
||||||
|
cs_stat_t st;
|
||||||
|
mg_sock_addr_to_str(&nc->sa, addr, sizeof(addr),
|
||||||
|
MG_SOCK_STRINGIFY_IP | MG_SOCK_STRINGIFY_PORT);
|
||||||
|
LOG(LL_INFO,
|
||||||
|
("HTTP request from %s: %.*s %.*s", addr, (int) hm->method.len,
|
||||||
|
hm->method.p, (int) hm->uri.len, hm->uri.p));
|
||||||
|
if (mg_vcmp(&hm->uri, "/upload") == 0 ||
|
||||||
|
(mg_vcmp(&hm->uri, "/") == 0 && mg_stat("SL:index.html", &st) != 0)) {
|
||||||
|
mg_send(nc, upload_form, strlen(upload_form));
|
||||||
|
nc->flags |= MG_F_SEND_AND_CLOSE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
struct mg_serve_http_opts opts;
|
||||||
|
memset(&opts, 0, sizeof(opts));
|
||||||
|
opts.document_root = "SL:";
|
||||||
|
mg_serve_http(nc, hm, opts);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case MG_EV_CLOSE: {
|
||||||
|
LOG(LL_INFO, ("Connection %p closed", nc));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
/* SimpleLink FS requires pre-declaring max file size. We use Content-Length
|
||||||
|
* for that purpose - it will not exactly match file size, but is guaranteed
|
||||||
|
* to exceed it and should be close enough. */
|
||||||
|
case MG_EV_HTTP_MULTIPART_REQUEST: {
|
||||||
|
struct http_message *hm = (struct http_message *) ev_data;
|
||||||
|
struct mg_str *cl_header = mg_get_http_header(hm, "Content-Length");
|
||||||
|
intptr_t cl = -1;
|
||||||
|
if (cl_header != NULL && cl_header->len < 20) {
|
||||||
|
char buf[20];
|
||||||
|
memcpy(buf, cl_header->p, cl_header->len);
|
||||||
|
buf[cl_header->len] = '\0';
|
||||||
|
cl = atoi(buf);
|
||||||
|
if (cl < 0) cl = -1;
|
||||||
|
}
|
||||||
|
nc->user_data = (void *) cl;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case MG_EV_HTTP_PART_BEGIN:
|
||||||
|
case MG_EV_HTTP_PART_DATA:
|
||||||
|
case MG_EV_HTTP_PART_END: {
|
||||||
|
struct mg_http_multipart_part *mp =
|
||||||
|
(struct mg_http_multipart_part *) ev_data;
|
||||||
|
if (ev == MG_EV_HTTP_PART_BEGIN) {
|
||||||
|
LOG(LL_INFO, ("Begin file upload: %s", mp->file_name));
|
||||||
|
} else if (ev == MG_EV_HTTP_PART_END) {
|
||||||
|
LOG(LL_INFO, ("End file upload: %s", mp->file_name));
|
||||||
|
}
|
||||||
|
mg_file_upload_handler(nc, ev, ev_data, upload_fname);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void mg_init(struct mg_mgr *mgr) {
|
||||||
|
LOG(LL_INFO, ("MG task running"));
|
||||||
|
|
||||||
|
stop_nwp(); /* See function description in wifi.c */
|
||||||
|
LOG(LL_INFO, ("Starting NWP..."));
|
||||||
|
int role = sl_Start(0, 0, 0);
|
||||||
|
if (role < 0) {
|
||||||
|
LOG(LL_ERROR, ("Failed to start NWP"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
LOG(LL_INFO, ("NWP started"));
|
||||||
|
|
||||||
|
sl_fs_init();
|
||||||
|
|
||||||
|
#if defined(WIFI_STA_SSID)
|
||||||
|
if (!wifi_setup_sta(WIFI_STA_SSID, WIFI_STA_PASS)) {
|
||||||
|
LOG(LL_ERROR, ("Error setting up WiFi station"));
|
||||||
|
}
|
||||||
|
#elif defined(WIFI_AP_SSID)
|
||||||
|
if (!wifi_setup_ap(WIFI_AP_SSID, WIFI_AP_PASS, WIFI_AP_CHAN)) {
|
||||||
|
LOG(LL_ERROR, ("Error setting up WiFi AP"));
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
#error WiFi not configured
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* We don't need SimpleLink's web server. */
|
||||||
|
sl_NetAppStop(SL_NET_APP_HTTP_SERVER_ID);
|
||||||
|
|
||||||
|
const char *err = "";
|
||||||
|
struct mg_bind_opts opts;
|
||||||
|
memset(&opts, 0, sizeof(opts));
|
||||||
|
opts.error_string = &err;
|
||||||
|
|
||||||
|
struct mg_connection *nc = mg_bind(mgr, "80", mg_ev_handler);
|
||||||
|
if (nc != NULL) {
|
||||||
|
mg_set_protocol_http_websocket(nc);
|
||||||
|
} else {
|
||||||
|
LOG(LL_ERROR, ("Failed to create listener: %s", err));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifndef USE_TIRTOS
|
||||||
|
/* Int vector table, defined in startup_gcc.c */
|
||||||
|
extern void (*const g_pfnVectors[])(void);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
#ifndef USE_TIRTOS
|
||||||
|
MAP_IntVTableBaseSet((unsigned long) &g_pfnVectors[0]);
|
||||||
|
#endif
|
||||||
|
MAP_IntEnable(FAULT_SYSTICK);
|
||||||
|
MAP_IntMasterEnable();
|
||||||
|
PRCMCC3200MCUInit();
|
||||||
|
|
||||||
|
setvbuf(stdout, NULL, _IOLBF, 0);
|
||||||
|
setvbuf(stderr, NULL, _IOLBF, 0);
|
||||||
|
cs_log_set_level(LL_INFO);
|
||||||
|
cs_log_set_file(stdout);
|
||||||
|
|
||||||
|
LOG(LL_INFO, ("Hello, world!"));
|
||||||
|
|
||||||
|
/* Set up the red LED. Note that amber and green cannot be used as they share
|
||||||
|
* pins with I2C. */
|
||||||
|
MAP_PRCMPeripheralClkEnable(PRCM_GPIOA1, PRCM_RUN_MODE_CLK);
|
||||||
|
MAP_PinTypeGPIO(PIN_64, PIN_MODE_0, false);
|
||||||
|
MAP_GPIODirModeSet(GPIOA1_BASE, 0x2, GPIO_DIR_MODE_OUT);
|
||||||
|
GPIO_IF_LedConfigure(LED1);
|
||||||
|
GPIO_IF_LedOn(MCU_RED_LED_GPIO);
|
||||||
|
|
||||||
|
if (VStartSimpleLinkSpawnTask(8) != 0) {
|
||||||
|
LOG(LL_ERROR, ("Failed to create SL task"));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!mg_start_task(MG_TASK_PRIORITY, MG_TASK_STACK_SIZE, mg_init)) {
|
||||||
|
LOG(LL_ERROR, ("Failed to create MG task"));
|
||||||
|
}
|
||||||
|
|
||||||
|
osi_start();
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* These are FreeRTOS hooks for various life situations. */
|
||||||
|
void vApplicationMallocFailedHook() {
|
||||||
|
}
|
||||||
|
|
||||||
|
void vApplicationIdleHook() {
|
||||||
|
}
|
||||||
|
|
||||||
|
void vApplicationStackOverflowHook(OsiTaskHandle *th, signed char *tn) {
|
||||||
|
}
|
||||||
|
|
||||||
|
void SimpleLinkHttpServerCallback(SlHttpServerEvent_t *e,
|
||||||
|
SlHttpServerResponse_t *resp) {
|
||||||
|
}
|
||||||
|
|
||||||
|
void SimpleLinkSockEventHandler(SlSockEvent_t *e) {
|
||||||
|
}
|
||||||
|
|
||||||
|
void SimpleLinkGeneralEventHandler(SlDeviceEvent_t *e) {
|
||||||
|
LOG(LL_ERROR, ("status %d sender %d", e->EventData.deviceEvent.status,
|
||||||
|
e->EventData.deviceEvent.sender));
|
||||||
|
}
|
||||||
+14
@@ -0,0 +1,14 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<configurations XML_version="1.2" id="configurations_0">
|
||||||
|
<configuration XML_version="1.2" id="configuration_0">
|
||||||
|
<instance XML_version="1.2" desc="Stellaris In-Circuit Debug Interface" href="connections/Stellaris_ICDI_Connection.xml" id="Stellaris In-Circuit Debug Interface" xml="Stellaris_ICDI_Connection.xml" xmlpath="connections"/>
|
||||||
|
<connection XML_version="1.2" id="Stellaris In-Circuit Debug Interface">
|
||||||
|
<instance XML_version="1.2" href="drivers/cc3200_cs_icepick.xml" id="drivers" xml="cc3200_cs_icepick.xml" xmlpath="drivers"/>
|
||||||
|
<instance XML_version="1.2" href="drivers/stellaris_cs_dap.xml" id="drivers" xml="stellaris_cs_dap.xml" xmlpath="drivers"/>
|
||||||
|
<instance XML_version="1.2" href="drivers/cc3200_cortex_m4.xml" id="drivers" xml="cc3200_cortex_m4.xml" xmlpath="drivers"/>
|
||||||
|
<platform XML_version="1.2" id="platform_0">
|
||||||
|
<instance XML_version="1.2" desc="CC3200" href="devices/CC3200.xml" id="CC3200" xml="CC3200.xml" xmlpath="devices"/>
|
||||||
|
</platform>
|
||||||
|
</connection>
|
||||||
|
</configuration>
|
||||||
|
</configurations>
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
The 'targetConfigs' folder contains target-configuration (.ccxml) files, automatically generated based
|
||||||
|
on the device and connection settings specified in your project on the Properties > General page.
|
||||||
|
|
||||||
|
Please note that in automatic target-configuration management, changes to the project's device and/or
|
||||||
|
connection settings will either modify an existing or generate a new target-configuration file. Thus,
|
||||||
|
if you manually edit these auto-generated files, you may need to re-apply your changes. Alternatively,
|
||||||
|
you may create your own target-configuration file for this project and manage it manually. You can
|
||||||
|
always switch back to automatic target-configuration management by checking the "Manage the project's
|
||||||
|
target-configuration automatically" checkbox on the project's Properties > General page.
|
||||||
@@ -60,6 +60,8 @@
|
|||||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.DIAG_WARNING.108721469" name="Treat diagnostic <id> as warning (--diag_warning, -pdsw)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.DIAG_WARNING" valueType="stringList">
|
<option id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.DIAG_WARNING.108721469" name="Treat diagnostic <id> as warning (--diag_warning, -pdsw)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.DIAG_WARNING" valueType="stringList">
|
||||||
<listOptionValue builtIn="false" value="225"/>
|
<listOptionValue builtIn="false" value="225"/>
|
||||||
</option>
|
</option>
|
||||||
|
<option id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.OPT_LEVEL.1654856947" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.OPT_LEVEL" value="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.OPT_LEVEL.4" valueType="enumerated"/>
|
||||||
|
<option id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.OPT_FOR_SPEED.610557791" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.OPT_FOR_SPEED" value="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.OPT_FOR_SPEED.0" valueType="enumerated"/>
|
||||||
<inputType id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compiler.inputType__C_SRCS.1309113096" name="C Sources" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compiler.inputType__C_SRCS"/>
|
<inputType id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compiler.inputType__C_SRCS.1309113096" name="C Sources" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compiler.inputType__C_SRCS"/>
|
||||||
<inputType id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compiler.inputType__CPP_SRCS.637644727" name="C++ Sources" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compiler.inputType__CPP_SRCS"/>
|
<inputType id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compiler.inputType__CPP_SRCS.637644727" name="C++ Sources" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compiler.inputType__CPP_SRCS"/>
|
||||||
<inputType id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compiler.inputType__ASM_SRCS.1237578949" name="Assembly Sources" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compiler.inputType__ASM_SRCS"/>
|
<inputType id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compiler.inputType__ASM_SRCS.1237578949" name="Assembly Sources" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compiler.inputType__ASM_SRCS"/>
|
||||||
@@ -154,6 +156,8 @@
|
|||||||
<listOptionValue builtIn="false" value=""${PROJECT_LOC}/../../../..""/>
|
<listOptionValue builtIn="false" value=""${PROJECT_LOC}/../../../..""/>
|
||||||
</option>
|
</option>
|
||||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.LITTLE_ENDIAN.1313166043" name="Little endian code [See 'General' page to edit] (--little_endian, -me)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.LITTLE_ENDIAN" value="true" valueType="boolean"/>
|
<option id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.LITTLE_ENDIAN.1313166043" name="Little endian code [See 'General' page to edit] (--little_endian, -me)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.LITTLE_ENDIAN" value="true" valueType="boolean"/>
|
||||||
|
<option id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.OPT_LEVEL.release.1366420658" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.OPT_LEVEL.release" value="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.OPT_LEVEL.4" valueType="enumerated"/>
|
||||||
|
<option id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.OPT_FOR_SPEED.1169603203" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.OPT_FOR_SPEED" value="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.OPT_FOR_SPEED.0" valueType="enumerated"/>
|
||||||
<inputType id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compiler.inputType__C_SRCS.884396305" name="C Sources" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compiler.inputType__C_SRCS"/>
|
<inputType id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compiler.inputType__C_SRCS.884396305" name="C Sources" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compiler.inputType__C_SRCS"/>
|
||||||
<inputType id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compiler.inputType__CPP_SRCS.1552076672" name="C++ Sources" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compiler.inputType__CPP_SRCS"/>
|
<inputType id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compiler.inputType__CPP_SRCS.1552076672" name="C++ Sources" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compiler.inputType__CPP_SRCS"/>
|
||||||
<inputType id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compiler.inputType__ASM_SRCS.1932242817" name="Assembly Sources" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compiler.inputType__ASM_SRCS"/>
|
<inputType id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compiler.inputType__ASM_SRCS.1932242817" name="Assembly Sources" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compiler.inputType__ASM_SRCS"/>
|
||||||
@@ -206,4 +210,5 @@
|
|||||||
<content-type-mapping configuration="" content-type="org.eclipse.cdt.core.cxxSource" language="com.ti.ccstudio.core.TIGPPLanguage"/>
|
<content-type-mapping configuration="" content-type="org.eclipse.cdt.core.cxxSource" language="com.ti.ccstudio.core.TIGPPLanguage"/>
|
||||||
</project-mappings>
|
</project-mappings>
|
||||||
</storageModule>
|
</storageModule>
|
||||||
|
<storageModule moduleId="refreshScope"/>
|
||||||
</cproject>
|
</cproject>
|
||||||
@@ -29,22 +29,22 @@
|
|||||||
<link>
|
<link>
|
||||||
<name>bm222.c</name>
|
<name>bm222.c</name>
|
||||||
<type>1</type>
|
<type>1</type>
|
||||||
<locationURI>copy_PARENT/bm222.c</locationURI>
|
<locationURI>PARENT-2-PROJECT_LOC/bm222.c</locationURI>
|
||||||
</link>
|
</link>
|
||||||
<link>
|
<link>
|
||||||
<name>bm222.h</name>
|
<name>bm222.h</name>
|
||||||
<type>1</type>
|
<type>1</type>
|
||||||
<locationURI>copy_PARENT/bm222.h</locationURI>
|
<locationURI>PARENT-2-PROJECT_LOC/bm222.h</locationURI>
|
||||||
</link>
|
</link>
|
||||||
<link>
|
<link>
|
||||||
<name>data.c</name>
|
<name>data.c</name>
|
||||||
<type>1</type>
|
<type>1</type>
|
||||||
<locationURI>copy_PARENT/data.c</locationURI>
|
<locationURI>PARENT-2-PROJECT_LOC/data.c</locationURI>
|
||||||
</link>
|
</link>
|
||||||
<link>
|
<link>
|
||||||
<name>data.h</name>
|
<name>data.h</name>
|
||||||
<type>1</type>
|
<type>1</type>
|
||||||
<locationURI>copy_PARENT/data.h</locationURI>
|
<locationURI>PARENT-2-PROJECT_LOC/data.h</locationURI>
|
||||||
</link>
|
</link>
|
||||||
<link>
|
<link>
|
||||||
<name>gpio_if.c</name>
|
<name>gpio_if.c</name>
|
||||||
@@ -59,7 +59,7 @@
|
|||||||
<link>
|
<link>
|
||||||
<name>main.c</name>
|
<name>main.c</name>
|
||||||
<type>1</type>
|
<type>1</type>
|
||||||
<locationURI>copy_PARENT/main.c</locationURI>
|
<locationURI>PARENT-2-PROJECT_LOC/main.c</locationURI>
|
||||||
</link>
|
</link>
|
||||||
<link>
|
<link>
|
||||||
<name>network_common.c</name>
|
<name>network_common.c</name>
|
||||||
@@ -74,22 +74,22 @@
|
|||||||
<link>
|
<link>
|
||||||
<name>tmp006.c</name>
|
<name>tmp006.c</name>
|
||||||
<type>1</type>
|
<type>1</type>
|
||||||
<locationURI>copy_PARENT/tmp006.c</locationURI>
|
<locationURI>PARENT-2-PROJECT_LOC/tmp006.c</locationURI>
|
||||||
</link>
|
</link>
|
||||||
<link>
|
<link>
|
||||||
<name>tmp006.h</name>
|
<name>tmp006.h</name>
|
||||||
<type>1</type>
|
<type>1</type>
|
||||||
<locationURI>copy_PARENT/tmp006.h</locationURI>
|
<locationURI>PARENT-2-PROJECT_LOC/tmp006.h</locationURI>
|
||||||
</link>
|
</link>
|
||||||
<link>
|
<link>
|
||||||
<name>wifi.c</name>
|
<name>wifi.c</name>
|
||||||
<type>1</type>
|
<type>1</type>
|
||||||
<locationURI>copy_PARENT/wifi.c</locationURI>
|
<locationURI>PARENT-2-PROJECT_LOC/wifi.c</locationURI>
|
||||||
</link>
|
</link>
|
||||||
<link>
|
<link>
|
||||||
<name>wifi.h</name>
|
<name>wifi.h</name>
|
||||||
<type>1</type>
|
<type>1</type>
|
||||||
<locationURI>copy_PARENT/wifi.h</locationURI>
|
<locationURI>PARENT-2-PROJECT_LOC/wifi.h</locationURI>
|
||||||
</link>
|
</link>
|
||||||
</linkedResources>
|
</linkedResources>
|
||||||
<variableList>
|
<variableList>
|
||||||
@@ -97,9 +97,5 @@
|
|||||||
<name>CC3200_SDK_ROOT</name>
|
<name>CC3200_SDK_ROOT</name>
|
||||||
<value>$%7BTI_PRODUCTS_DIR%7D/CC3200SDK_1.2.0/cc3200-sdk</value>
|
<value>$%7BTI_PRODUCTS_DIR%7D/CC3200SDK_1.2.0/cc3200-sdk</value>
|
||||||
</variable>
|
</variable>
|
||||||
<variable>
|
|
||||||
<name>copy_PARENT</name>
|
|
||||||
<value>file:/Z:/cesanta/dev/mongoose/examples/CC3200</value>
|
|
||||||
</variable>
|
|
||||||
</variableList>
|
</variableList>
|
||||||
</projectDescription>
|
</projectDescription>
|
||||||
@@ -52,6 +52,8 @@
|
|||||||
<listOptionValue builtIn="false" value=""${PROJECT_LOC}/../../../..""/>
|
<listOptionValue builtIn="false" value=""${PROJECT_LOC}/../../../..""/>
|
||||||
</option>
|
</option>
|
||||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.LITTLE_ENDIAN.2146523713" name="Little endian code [See 'General' page to edit] (--little_endian, -me)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.LITTLE_ENDIAN" value="true" valueType="boolean"/>
|
<option id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.LITTLE_ENDIAN.2146523713" name="Little endian code [See 'General' page to edit] (--little_endian, -me)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.LITTLE_ENDIAN" value="true" valueType="boolean"/>
|
||||||
|
<option id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.OPT_LEVEL.1654856947" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.OPT_LEVEL" value="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.OPT_LEVEL.4" valueType="enumerated"/>
|
||||||
|
<option id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.OPT_FOR_SPEED.610557791" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.OPT_FOR_SPEED" value="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.OPT_FOR_SPEED.0" valueType="enumerated"/>
|
||||||
<inputType id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compiler.inputType__C_SRCS.677106420" name="C Sources" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compiler.inputType__C_SRCS"/>
|
<inputType id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compiler.inputType__C_SRCS.677106420" name="C Sources" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compiler.inputType__C_SRCS"/>
|
||||||
<inputType id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compiler.inputType__CPP_SRCS.844089326" name="C++ Sources" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compiler.inputType__CPP_SRCS"/>
|
<inputType id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compiler.inputType__CPP_SRCS.844089326" name="C++ Sources" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compiler.inputType__CPP_SRCS"/>
|
||||||
<inputType id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compiler.inputType__ASM_SRCS.512556736" name="Assembly Sources" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compiler.inputType__ASM_SRCS"/>
|
<inputType id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compiler.inputType__ASM_SRCS.512556736" name="Assembly Sources" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compiler.inputType__ASM_SRCS"/>
|
||||||
@@ -116,6 +118,8 @@
|
|||||||
<listOptionValue builtIn="false" value=""${PROJECT_LOC}/../../../..""/>
|
<listOptionValue builtIn="false" value=""${PROJECT_LOC}/../../../..""/>
|
||||||
</option>
|
</option>
|
||||||
<option id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.LITTLE_ENDIAN.1988330306" name="Little endian code [See 'General' page to edit] (--little_endian, -me)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.LITTLE_ENDIAN" value="true" valueType="boolean"/>
|
<option id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.LITTLE_ENDIAN.1988330306" name="Little endian code [See 'General' page to edit] (--little_endian, -me)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.LITTLE_ENDIAN" value="true" valueType="boolean"/>
|
||||||
|
<option id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.OPT_LEVEL.library.release.1366420658" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.OPT_LEVEL.library.release" value="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.OPT_LEVEL.4" valueType="enumerated"/>
|
||||||
|
<option id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.OPT_FOR_SPEED.1169603203" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.OPT_FOR_SPEED" value="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.OPT_FOR_SPEED.0" valueType="enumerated"/>
|
||||||
<inputType id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compiler.inputType__C_SRCS.2007627314" name="C Sources" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compiler.inputType__C_SRCS"/>
|
<inputType id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compiler.inputType__C_SRCS.2007627314" name="C Sources" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compiler.inputType__C_SRCS"/>
|
||||||
<inputType id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compiler.inputType__CPP_SRCS.800017124" name="C++ Sources" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compiler.inputType__CPP_SRCS"/>
|
<inputType id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compiler.inputType__CPP_SRCS.800017124" name="C++ Sources" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compiler.inputType__CPP_SRCS"/>
|
||||||
<inputType id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compiler.inputType__ASM_SRCS.198177467" name="Assembly Sources" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compiler.inputType__ASM_SRCS"/>
|
<inputType id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compiler.inputType__ASM_SRCS.198177467" name="Assembly Sources" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compiler.inputType__ASM_SRCS"/>
|
||||||
|
|||||||
@@ -1,11 +1,57 @@
|
|||||||
This directory contains Code Composer Studio projects for Mongoose.
|
# Code Composer Studio example projects
|
||||||
|
|
||||||
- Mongoose: the library project, produces a static library (`Mongoose.a`).
|
To run them you will need:
|
||||||
|
- [CC3200-LAUNCHXL](http://www.ti.com/tool/cc3200-launchxl) dev board.
|
||||||
|
- [CC3200SDK 1.2.0](http://www.ti.com/tool/cc3200sdk) installed in `TI_PRODUCTS_DIR/CC3200SDK_1.2.0` (typically `C:\ti\CC3200SDK_1.2.0` on Windows, `/home/USER/ti/CC3200SDK_1.2.0` on Linux).
|
||||||
|
- The latest CC3200SDK-SERVICEPACK should also be installed and flashed to the device
|
||||||
|
- Code Composer Studio 6 IDE
|
||||||
|
- Mongoose source code. Either clone the [Git repo](https://github.com/cesanta/mongoose.git) or download the [ZIP archive](https://github.com/cesanta/mongoose/archive/master.zip).
|
||||||
|
|
||||||
- MG_sensor_demo: a demo application that serves files from SLFS and outputs
|
## Mongoose - The library project
|
||||||
sensor data to the WebSocket connection. It uses the Mongoose library project,
|
This project produces `Mongoose.lib` - a static library meant to be used by other projects.
|
||||||
so you'll need to import both.
|
Feel free to use it as a dependency for your own projects or just copy `mongoose.c` and `mongoose.h`.
|
||||||
|
Note that by default a lot of features are enabled, including file serving (which we use in our examples).
|
||||||
|
You can trim a lot of fat by turning various build options off.
|
||||||
|
A minimal HTTP serving configuration is about 25 K (compiled for ARM® Cortex®M4 with GCC 4.9 with size optimization on).
|
||||||
|
|
||||||
CC3200SDK_1.2.0 needs to be installed in ${TI_PRODUCTS_DIR} (`C:\TI` on Windows, `~/ti` on Linux).
|
## MG_hello - A simple demo
|
||||||
|
MG_hello project is a simple web server that serves files from the SimpleLink file system and allows them to be uploaded.
|
||||||
|
This project depends on the Mongoose library project, make sure you import them both.
|
||||||
|
When importing, ensure the “copy project to workspace” checkbox is *unchecked*, otherwise file references will be broken.
|
||||||
|
|
||||||
*Note:* When importing projects, make sure the `Copy projects into workspace` checkbox is *not* checked.
|
When built and run on the device, by default, the example will set up a Wi-Fi network called “Mongoose” (no password).
|
||||||
|
|
||||||
|
Assuming everything works, you should see the following output in CIO:
|
||||||
|
|
||||||
|
```
|
||||||
|
main Hello, world!
|
||||||
|
mg_init MG task running
|
||||||
|
mg_init Starting NWP...
|
||||||
|
mg_init NWP started
|
||||||
|
wifi_setup_ap WiFi: AP Mongoose configured
|
||||||
|
```
|
||||||
|
|
||||||
|
Note: If the demo does not proceed past “Starting NWP…”, please reset the board (possibly related to [this](https://e2e.ti.com/support/wireless_connectivity/simplelink_wifi_cc31xx_cc32xx/f/968/p/499123/1806610#1806610) and our [workaround](https://github.com/cesanta/mongoose/commit/848c884fff80de03051344e230392a68d4b51b84) is not always effective).
|
||||||
|
|
||||||
|
And after connecting to Wi-Fi network Mongoose, the following page on http://192.168.4.1/:
|
||||||
|
|
||||||
|
<img src="upload_form.png" width="364" height="239">
|
||||||
|
|
||||||
|
Pick a small file (say favicon.ico) and upload.
|
||||||
|
You should get “Ok, favicon.ico - 16958 bytes.” and it will be served back to you ([link](http://192.168.4.1/)).
|
||||||
|
If you upload index.html, it will be served instead of the form (but the form will be accessible at [/upload](http://192.168.4.1/upload)).
|
||||||
|
|
||||||
|
## MG_sensor_demo - A more elaborate demo project
|
||||||
|
|
||||||
|
This demo shows the use of [timers](https://docs.cesanta.com/mongoose/latest/#/c-api/net.h/mg_set_timer/) and serving a WebSocket data stream to (potentially) multiple subscribers.
|
||||||
|
Data from the on-board temperature sensors and accelerometer is streamed to any clients connected over WebSocket, which allows building of responsive, near-real time dashboards.
|
||||||
|
|
||||||
|
The main [event handler function](https://github.com/cesanta/mongoose/blob/master/examples/CC3200/main.c#L81) in main.c does everything MG_hello’s function does, but also handles the websocket connection event - when `MG_EV_WEBSOCKET_HANDSHAKE_DONE` arrives, it switches the event handler to a different one - data_conn_handler (defined [here](https://github.com/cesanta/mongoose/blob/master/examples/CC3200/data.c#L144) in data.c). Doing this is not required, but it keeps the code modular and function size manageable.
|
||||||
|
|
||||||
|
Data acquisition is performed at regular intervals by a timer. Mongoose timers are not very accurate (remember - everything is executed in single thread), but good enough for this case.The timer is first set [in mg_init()](https://github.com/cesanta/mongoose/blob/master/examples/CC3200/main.c#L200), and the `MG_EV_TIMER` event is handled [in the main handler](https://github.com/cesanta/mongoose/blob/master/examples/CC3200/main.c#L123). Mongoose timers must be re-armed manually.
|
||||||
|
|
||||||
|
To try this demo from Code Composer Studio IDE, follow the steps above for MG_hello. Same as for MG_hello, you will only see an upload for initially. Please upload `main.js` and `index.html` from the [slfs directory](https://github.com/cesanta/mongoose/tree/master/examples/CC3200/slfs) and reload the page. You should see something like this:
|
||||||
|
|
||||||
|
<img src="sensor_demo.png" width="770" height="856">
|
||||||
|
|
||||||
|
[This short video](https://youtu.be/T0aFUKIBZxk) shows the demo in action.
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 137 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 31 KiB |
+11
-21
@@ -95,27 +95,19 @@ static double send_acc_data_since(struct mg_connection *nc,
|
|||||||
|
|
||||||
static void process_command(struct mg_connection *nc, unsigned char *data,
|
static void process_command(struct mg_connection *nc, unsigned char *data,
|
||||||
size_t len) {
|
size_t len) {
|
||||||
struct json_token *toks = parse_json2((const char *) data, len);
|
// TODO(lsm): use proper JSON parser
|
||||||
if (toks == NULL) {
|
int cmd, n, val;
|
||||||
|
double t;
|
||||||
|
if (sscanf((char *) data, "{\t\": %d, \"ts\": %lf, %n", &cmd, &t, &n) != 2) {
|
||||||
LOG(LL_ERROR, ("Invalid command: %.*s", (int) len, data));
|
LOG(LL_ERROR, ("Invalid command: %.*s", (int) len, data));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
struct json_token *t = find_json_token(toks, "t");
|
if (t == 1) {
|
||||||
if (t == NULL) {
|
if (sscanf((char *) data + n, "\"v\": %d", &val) != 1) {
|
||||||
LOG(LL_ERROR, ("Missing type field: %.*s", (int) len, data));
|
|
||||||
goto out_free;
|
|
||||||
}
|
|
||||||
if (t->len == 1 && *t->ptr == '1') {
|
|
||||||
struct json_token *v = find_json_token(toks, "v");
|
|
||||||
if (v == NULL) {
|
|
||||||
LOG(LL_ERROR, ("Missing value: %.*s", (int) len, data));
|
LOG(LL_ERROR, ("Missing value: %.*s", (int) len, data));
|
||||||
goto out_free;
|
return;
|
||||||
}
|
}
|
||||||
if (v->len != 1) {
|
switch (val) {
|
||||||
LOG(LL_ERROR, ("Invalid value: %.*s", (int) len, data));
|
|
||||||
goto out_free;
|
|
||||||
}
|
|
||||||
switch (*v->ptr) {
|
|
||||||
case '0': {
|
case '0': {
|
||||||
GPIO_IF_LedOff(MCU_RED_LED_GPIO);
|
GPIO_IF_LedOff(MCU_RED_LED_GPIO);
|
||||||
break;
|
break;
|
||||||
@@ -130,15 +122,13 @@ static void process_command(struct mg_connection *nc, unsigned char *data,
|
|||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
LOG(LL_ERROR, ("Invalid value: %.*s", (int) len, data));
|
LOG(LL_ERROR, ("Invalid value: %.*s", (int) len, data));
|
||||||
goto out_free;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
LOG(LL_ERROR, ("Unknown command: %.*s", (int) t->len, t->ptr));
|
LOG(LL_ERROR, ("Unknown command: %.*s", (int) len, data));
|
||||||
goto out_free;
|
return;
|
||||||
}
|
}
|
||||||
out_free:
|
|
||||||
free(toks);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void data_conn_handler(struct mg_connection *nc, int ev, void *ev_data) {
|
void data_conn_handler(struct mg_connection *nc, int ev, void *ev_data) {
|
||||||
|
|||||||
+89
-26
@@ -8,29 +8,28 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
/* Driverlib includes */
|
#include <inc/hw_types.h>
|
||||||
#include "hw_types.h"
|
#include <inc/hw_ints.h>
|
||||||
|
#include <inc/hw_memmap.h>
|
||||||
|
|
||||||
#include "hw_ints.h"
|
#include <driverlib/gpio.h>
|
||||||
#include "hw_memmap.h"
|
#include <driverlib/interrupt.h>
|
||||||
#include "interrupt.h"
|
#include <driverlib/pin.h>
|
||||||
#include "pin.h"
|
#include <driverlib/prcm.h>
|
||||||
#include "prcm.h"
|
#include <driverlib/rom.h>
|
||||||
#include "rom.h"
|
#include <driverlib/rom_map.h>
|
||||||
#include "rom_map.h"
|
#include <driverlib/uart.h>
|
||||||
#include "uart.h"
|
#include <driverlib/utils.h>
|
||||||
#include "utils.h"
|
|
||||||
|
|
||||||
#include "gpio.h"
|
#include <example/common/gpio_if.h>
|
||||||
#include "gpio_if.h"
|
#include <example/common/i2c_if.h>
|
||||||
#include "i2c_if.h"
|
|
||||||
|
|
||||||
#include "mongoose.h"
|
/* Mongoose.h brings in SimpleLink support. Do not include simplelink.h. */
|
||||||
#include "simplelink.h"
|
#include <mongoose.h>
|
||||||
#include "device.h"
|
|
||||||
|
#include <simplelink/include/device.h>
|
||||||
|
|
||||||
#include "data.h"
|
#include "data.h"
|
||||||
#include "mongoose.h"
|
|
||||||
#include "wifi.h"
|
#include "wifi.h"
|
||||||
|
|
||||||
/* Set up an AP or connect to existing WiFi network. */
|
/* Set up an AP or connect to existing WiFi network. */
|
||||||
@@ -51,13 +50,31 @@
|
|||||||
#define BM222_ADDR 0x18
|
#define BM222_ADDR 0x18
|
||||||
#define TMP006_ADDR 0x41
|
#define TMP006_ADDR 0x41
|
||||||
|
|
||||||
|
void fs_slfs_set_new_file_size(const char *name, size_t size);
|
||||||
|
|
||||||
|
static const char *upload_form =
|
||||||
|
"\
|
||||||
|
<h1>Upload file</h1> \
|
||||||
|
<form action='/upload' method='POST' enctype='multipart/form-data'> \
|
||||||
|
<input type='file' name='file'> \
|
||||||
|
<input type='submit' value='Upload'> \
|
||||||
|
</form>";
|
||||||
|
|
||||||
static struct mg_str upload_fname(struct mg_connection *nc,
|
static struct mg_str upload_fname(struct mg_connection *nc,
|
||||||
struct mg_str fname) {
|
struct mg_str fname) {
|
||||||
struct mg_str lfn;
|
struct mg_str lfn;
|
||||||
lfn.len = fname.len + 3;
|
char *fn = malloc(fname.len + 4);
|
||||||
lfn.p = malloc(lfn.len);
|
memcpy(fn, "SL:", 3);
|
||||||
memcpy((char *) lfn.p, "SL:", 3);
|
memcpy(fn + 3, fname.p, fname.len);
|
||||||
memcpy((char *) lfn.p + 3, fname.p, fname.len);
|
fn[3 + fname.len] = '\0';
|
||||||
|
if (nc->user_data != NULL) {
|
||||||
|
intptr_t cl = (intptr_t) nc->user_data;
|
||||||
|
if (cl >= 0) {
|
||||||
|
fs_slfs_set_new_file_size(fn + 3, cl);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
lfn.len = fname.len + 4;
|
||||||
|
lfn.p = fn;
|
||||||
return lfn;
|
return lfn;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -74,12 +91,19 @@ static void mg_ev_handler(struct mg_connection *nc, int ev, void *ev_data) {
|
|||||||
case MG_EV_HTTP_REQUEST: {
|
case MG_EV_HTTP_REQUEST: {
|
||||||
char addr[32];
|
char addr[32];
|
||||||
struct http_message *hm = (struct http_message *) ev_data;
|
struct http_message *hm = (struct http_message *) ev_data;
|
||||||
|
cs_stat_t st;
|
||||||
mg_conn_addr_to_str(nc, addr, sizeof(addr), MG_SOCK_STRINGIFY_REMOTE |
|
mg_conn_addr_to_str(nc, addr, sizeof(addr), MG_SOCK_STRINGIFY_REMOTE |
|
||||||
MG_SOCK_STRINGIFY_IP |
|
MG_SOCK_STRINGIFY_IP |
|
||||||
MG_SOCK_STRINGIFY_PORT);
|
MG_SOCK_STRINGIFY_PORT);
|
||||||
LOG(LL_INFO,
|
LOG(LL_INFO,
|
||||||
("HTTP request from %s: %.*s %.*s", addr, (int) hm->method.len,
|
("HTTP request from %s: %.*s %.*s", addr, (int) hm->method.len,
|
||||||
hm->method.p, (int) hm->uri.len, hm->uri.p));
|
hm->method.p, (int) hm->uri.len, hm->uri.p));
|
||||||
|
if (mg_vcmp(&hm->uri, "/upload") == 0 ||
|
||||||
|
(mg_vcmp(&hm->uri, "/") == 0 && mg_stat("SL:index.html", &st) != 0)) {
|
||||||
|
mg_send(nc, upload_form, strlen(upload_form));
|
||||||
|
nc->flags |= MG_F_SEND_AND_CLOSE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
struct mg_serve_http_opts opts;
|
struct mg_serve_http_opts opts;
|
||||||
memset(&opts, 0, sizeof(opts));
|
memset(&opts, 0, sizeof(opts));
|
||||||
opts.document_root = "SL:";
|
opts.document_root = "SL:";
|
||||||
@@ -99,6 +123,24 @@ static void mg_ev_handler(struct mg_connection *nc, int ev, void *ev_data) {
|
|||||||
case MG_EV_TIMER: {
|
case MG_EV_TIMER: {
|
||||||
data_collect();
|
data_collect();
|
||||||
nc->ev_timer_time = mg_time() + (DATA_COLLECTION_INTERVAL_MS * 0.001);
|
nc->ev_timer_time = mg_time() + (DATA_COLLECTION_INTERVAL_MS * 0.001);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
/* SimpleLink FS requires pre-declaring max file size. We use Content-Length
|
||||||
|
* for that purpose - it will not exactly match file size, but is guaranteed
|
||||||
|
* to exceed it and should be close enough. */
|
||||||
|
case MG_EV_HTTP_MULTIPART_REQUEST: {
|
||||||
|
struct http_message *hm = (struct http_message *) ev_data;
|
||||||
|
struct mg_str *cl_header = mg_get_http_header(hm, "Content-Length");
|
||||||
|
intptr_t cl = -1;
|
||||||
|
if (cl_header != NULL && cl_header->len < 20) {
|
||||||
|
char buf[20];
|
||||||
|
memcpy(buf, cl_header->p, cl_header->len);
|
||||||
|
buf[cl_header->len] = '\0';
|
||||||
|
cl = atoi(buf);
|
||||||
|
if (cl < 0) cl = -1;
|
||||||
|
}
|
||||||
|
nc->user_data = (void *) cl;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
case MG_EV_HTTP_PART_BEGIN:
|
case MG_EV_HTTP_PART_BEGIN:
|
||||||
case MG_EV_HTTP_PART_DATA:
|
case MG_EV_HTTP_PART_DATA:
|
||||||
@@ -117,14 +159,35 @@ static void mg_ev_handler(struct mg_connection *nc, int ev, void *ev_data) {
|
|||||||
|
|
||||||
static void mg_init(struct mg_mgr *mgr) {
|
static void mg_init(struct mg_mgr *mgr) {
|
||||||
LOG(LL_INFO, ("MG task running"));
|
LOG(LL_INFO, ("MG task running"));
|
||||||
|
|
||||||
|
stop_nwp(); /* See function description in wifi.c */
|
||||||
|
LOG(LL_INFO, ("Starting NWP..."));
|
||||||
|
int role = sl_Start(0, 0, 0);
|
||||||
|
if (role < 0) {
|
||||||
|
LOG(LL_ERROR, ("Failed to start NWP"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
SlVersionFull ver;
|
||||||
|
unsigned char opt = SL_DEVICE_GENERAL_VERSION;
|
||||||
|
unsigned char len = sizeof(ver);
|
||||||
|
|
||||||
|
memset(&ver, 0, sizeof(ver));
|
||||||
|
sl_DevGet(SL_DEVICE_GENERAL_CONFIGURATION, &opt, &len,
|
||||||
|
(unsigned char *) (&ver));
|
||||||
|
LOG(LL_INFO, ("NWP v%d.%d.%d.%d started, host v%d.%d.%d.%d",
|
||||||
|
ver.NwpVersion[0], ver.NwpVersion[1], ver.NwpVersion[2],
|
||||||
|
ver.NwpVersion[3], SL_MAJOR_VERSION_NUM, SL_MINOR_VERSION_NUM,
|
||||||
|
SL_VERSION_NUM, SL_SUB_VERSION_NUM));
|
||||||
|
}
|
||||||
|
|
||||||
GPIO_IF_LedToggle(MCU_RED_LED_GPIO);
|
GPIO_IF_LedToggle(MCU_RED_LED_GPIO);
|
||||||
|
|
||||||
data_init_sensors(TMP006_ADDR, BM222_ADDR);
|
data_init_sensors(TMP006_ADDR, BM222_ADDR);
|
||||||
|
|
||||||
sl_fs_init();
|
sl_fs_init();
|
||||||
|
|
||||||
sl_Start(NULL, NULL, NULL);
|
|
||||||
|
|
||||||
#if defined(WIFI_STA_SSID)
|
#if defined(WIFI_STA_SSID)
|
||||||
if (!wifi_setup_sta(WIFI_STA_SSID, WIFI_STA_PASS)) {
|
if (!wifi_setup_sta(WIFI_STA_SSID, WIFI_STA_PASS)) {
|
||||||
LOG(LL_ERROR, ("Error setting up WiFi station"));
|
LOG(LL_ERROR, ("Error setting up WiFi station"));
|
||||||
@@ -145,7 +208,7 @@ static void mg_init(struct mg_mgr *mgr) {
|
|||||||
memset(&opts, 0, sizeof(opts));
|
memset(&opts, 0, sizeof(opts));
|
||||||
opts.error_string = &err;
|
opts.error_string = &err;
|
||||||
|
|
||||||
struct mg_connection *nc = mg_bind(mgr, "80", mg_ev_handler);
|
struct mg_connection *nc = mg_bind_opt(mgr, "80", mg_ev_handler, opts);
|
||||||
if (nc != NULL) {
|
if (nc != NULL) {
|
||||||
mg_set_protocol_http_websocket(nc);
|
mg_set_protocol_http_websocket(nc);
|
||||||
nc->ev_timer_time = mg_time(); /* Start data collection */
|
nc->ev_timer_time = mg_time(); /* Start data collection */
|
||||||
@@ -195,7 +258,7 @@ int main() {
|
|||||||
MAP_PinTypeGPIO(PIN_64, PIN_MODE_0, false);
|
MAP_PinTypeGPIO(PIN_64, PIN_MODE_0, false);
|
||||||
MAP_GPIODirModeSet(GPIOA1_BASE, 0x2, GPIO_DIR_MODE_OUT);
|
MAP_GPIODirModeSet(GPIOA1_BASE, 0x2, GPIO_DIR_MODE_OUT);
|
||||||
GPIO_IF_LedConfigure(LED1);
|
GPIO_IF_LedConfigure(LED1);
|
||||||
GPIO_IF_LedToggle(MCU_RED_LED_GPIO);
|
GPIO_IF_LedOn(MCU_RED_LED_GPIO);
|
||||||
|
|
||||||
if (VStartSimpleLinkSpawnTask(8) != 0) {
|
if (VStartSimpleLinkSpawnTask(8) != 0) {
|
||||||
LOG(LL_ERROR, ("Failed to create SL task"));
|
LOG(LL_ERROR, ("Failed to create SL task"));
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
docker.cesanta.com:5000/cc3200-build:1.2.0-r1
|
docker.cesanta.com:5000/cc3200-build:1.2.0-r3
|
||||||
@@ -1,7 +1,83 @@
|
|||||||
<!DOCTYPE HTML>
|
l<!DOCTYPE html>
|
||||||
<html>
|
<html lang="en">
|
||||||
<head></head>
|
<head>
|
||||||
<body>
|
<meta charset="utf-8" />
|
||||||
<h1>Hello, world!</h1>
|
<title>CC3200 Mongoose sensor demo</title>
|
||||||
</body>
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
|
<script type="text/javascript" src="main.js"></script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
* {
|
||||||
|
outline: none;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
background: #7cf;
|
||||||
|
color: #555;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
font: 16px/1.4 Helvetica, Arial, sans-serif;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.content {
|
||||||
|
width: 800px;
|
||||||
|
margin: 1em auto;
|
||||||
|
padding: 2em;
|
||||||
|
background-color: #fff;
|
||||||
|
border-radius: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
a:link, a:visited {
|
||||||
|
color: #69c;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
#graphs {
|
||||||
|
margin-top: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.graph {
|
||||||
|
min-height: 12em;
|
||||||
|
border: 0px solid #ccc;
|
||||||
|
position: relative;
|
||||||
|
margin: 0;
|
||||||
|
padding-right: 5px;
|
||||||
|
width: 100%;
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.graph_title {
|
||||||
|
position: absolute;
|
||||||
|
top: 0.5em; left: 1em;
|
||||||
|
color: #ccc;
|
||||||
|
font-weight: bold;
|
||||||
|
z-index: 999;
|
||||||
|
}
|
||||||
|
|
||||||
|
button { font-size: 100%; }
|
||||||
|
|
||||||
|
</style>
|
||||||
|
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="content">
|
||||||
|
<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEYAAABECAYAAAA85kOPAAAWc0lEQVR42u1bCXxU1dUPiAKCpUqxlYqKYmttq1W6fLbWtVXR2vpVsbQfS5pltrfct81kI2TYioKoiBtFFAHZFAVUrCwiFMQKik0IW1YgBBKEBJIQssyc73/ezIRJMkCA4Jev+n7en8Pkvjf3/u85//M/594XF/f19fX19fWfcqU4HL1cuv5dlyvUNE27TNf17l95YLzeFKHq+nuq0N9TVO19oemLTNMc9JUGZdCgQV3TMjLfBSgkNMNu+NygGVaW3+/v8h81WUyoszs19eK29LUscQNAyHG5pYDbIxM3WRF1iqK96PMlXHSq+wcPHnyex+Pp2eFBcVnWpYqmJWi6Oc1U1YGn6i/L2kOSLMoASPA4MFoAbQl45pJT3N7ZMLy/A7CTFEX5jX+w/4IOB0hCQsJFqqrer2r6LKz4XrhEQNeN9+SEhL4t+4I/voWJ3IT+d3tk8ZJHUmoioHCTZJXbDkXosiSJ22RZvi4WGeMZt8OytghhsIVl67o5Gv1+7HA4zu8wwGBA9+jC/EyW1cbwxEhRRYNheuckhF2CgZBVMUFV9cWq0D6RhZYHa6mMtpZIA1j1sqLuwzNyFU1fi/tew31CMozvhZ91rSyLj0HWdPz3tKOqpi2VdP2HHQYYhNibVc3IgbU0myD+fVRR1fdgQfN1wyrEv6vxfSODgclHQIjZ3BKeEerDfRtUYRwyTCsHAEyXJHUlntX0DG4MEixniSSZV3YYYB50+C/EQOeiNbZcff6OIw1/Bsk2TUINR6Hwqgfw/zr0rZcw4egoFQ02A4FwXof+jS3dD1ZVDddM7VCuFDJvU8HkKqJXseXgwRtBEHOl0MzNsjAWAoAJumm6oGP+IrzGw5ppPgLOGA7XBHcbzwqhLQNvFQjdrGWATvRs/pusalvBX7d2OALGoG4DdxQwACHrCJu4ooX8X2ibMemnNM26Q5Kk3qfSKRz2hw0b1kNRvNcI4R0OEBeCc3YBhEAMl8Vv6IuThPh2hwJFUczrEWLnww2OHh+sGuCVxqqvklQtCTx0FfdlU5dlX18hxBUcbRiAtvxGfHx8N48QP5NVdYwitO0AqjGap8A7+xD+fW532zTUOb+EMH+mqmINc0WEOPG5UbALGFZyRI8wAADjVo9HneN2qzlut5wLTpiLyd6K0Nu1rb9HRJ0cCOH43eckWamBhQabXBU8he8nsCT4kixC6RrL9BE2B8JS1sKMm3gEYbUWofQNt7BuiPTz+D09XR6P0yMZJeP+NolmzZlNs+fMowmPTeTJlEOvqKebOEL1XgArGQZu2QzijQanXgj9MYy5Tyz3bKuFtuXqJAuRCK6Ix49dwyZtg2Uq18Ok/wEyDZmyPSj9EAY1Cj/eM9oFXJKUoArfwVdffY5Kd2QQHXQQ1a2iffv30auz5hDuQWgWI88kPxJucQPc9S3WTVERqhGAZTkcKb24z7BhVg9Y0XVYsIcNw7ipnaKN8Uuswl4mOIDwEbjCAlD3os2Gu0SRn7ZfVTWlxYp0gtsM9Ki+nJmvTKIjxX8mKj2PqAAeUfpromA+1R2ro5kzZ7JmqZVU/dEz1FFXqULMAzh1YVfmRToIsnfquvc+VbOykD5sYNkACTA3ljWdXkLI+kTVXwPSNtGxdbC20HSjGCtT32QpilYG1StacEWnhATfRYrqnf7EExlU9O8H6WBuHyre0JsaCjpREC1wcAwoo5YqKytoypRnyOmSP3c43A+wFXg82g+wuv18Pt9FbRmrLFv9Acgc1kI8Lpm1ktBLNN3aZRg+e+y8gFi8A/DbEWenaA0jHtqjzONRKCLQbB6B6Ue5z2FYVYYFc201WGH8yevTj61eeg/VFFxMC2bcShPHDqadG75LweI4Cuy6nujYZuIrJyeXkpLdAYdTKnA63esSEpPf/2tCwtzExOTHk5I8wxmoU4IDd2H3joRzJQQO8fgj4tK2bqGtlpFXnXH5ACbqw4OYTClGPsOWwiH5ZQtZdcv7h0OrYACfTn5sOH2xpRf9e1V/rJaLho7w0Yxn76Wq7d1DLlU5kWqPEa1d9ym9vugdWrN+Ey17fx3NmfcuTZk6g7KyxtcpwihzOF1rHG4pXVGMG082bgk5GQDZ0VLrRBoDhYBRjNB+5sUwnjBMMhM/dCSWqIJZbgZ4t8QWfGqSBHH3/qKBdCTvQpoy8SGQrJNGpg+nx8c9SgXr+4aA2TuQyoufpvzNbqo9MIqoajI1HH6Fqg8tp4MHtlFh8R7a8K9cmv3aIsoYOara4fRsTHJ5xqSm+q86UbAAt6iw9MqI2DyeT+lsRTsBHnRV/DfPyp0c4BlJ0pIA0N5oQYUfqMb3abHuSU39y8UeyftBVmYCVed1p88/6E8LX/k1bV1zJe39rDflb7iMDuX0pEAh3KmwC9XlX0zBoovQelGwEK34UgruvhoEfTvRFzI1HplFVVU7aWdeCc1fuJj5ojoxybkS3HF3zAV1WZdCW70ZnbsBpAZY8DronN+2Wz7FlTIkfYbpTSGXjTz7qf5RRM22CqGyGByfkFL90Ts/JtodRyWf9KbDuRdiwp2IiuIAAIi3EA0W06zlh1oQn4OF3EDShV0pUPRNCu65kYKHRlHt0a2UnZNP/tGPBZKSHMVQwi4eX+toqj/KkTK8mEHZjpre+89Bkmi8yxHJI8mITGaF0C05thgc0DXRMXL+OH881eWdbwMRQASiwrjWQMRo3J/b0R1xuD/OBpaKQ2AF+Hm7r6dg1XTavSeHpk59gbgC6PHIvvh4f7dm40hL68PFdc7cw0R8hGs67QoKiyKoTLvSxmUBEO4GSQoVjVoDYz3oktLKPnzrJntSbQEj0hrzO9MeWNe6ZbfT5vUSrVo6hN5bcDMVbOhLdTvPD4Gbz5bWHdZj0BeV1bRgwVIEAfWg2y2lsbxoVkAzfQ7wYHXY/Rs50Wxr+I9rm0ZQfZz/hJE/hh97JlZ+o/h8lyclp659fNz/BCq29AhbS9tbff55tHbJD+jJJycgfOfRrNlz4QaCZs/Mom3rb6GarV2P999zM1H1HDpypJxef+MfHI7LYTmJnEs1pSK6PgBRaCuTMIAJqsLIQdj/SfvlSkLM53TfjkaqKFcUMbx1eB98gdttTYYCrdv4/nW2+Z8OKHaDRZRu6kXPT4mnZxCq09NGwkJ9tGhuAh3c0pdqdlxAjU39macuINp3F1WUL6cXpr0KHeTcpERJfiZZSIpFkYgKkMp13Xq0XUCBnrkED9/IiNuoq9p2SYhfxMiy73W5rd3zZ/yWGnafZ5PnaQPDpAuC3rmuL02d9CCNHT2C/v7M72jXx71DPBPDAoP5nF4MoLzc6ZSZNS6Y5JAzoxNSkK4vErYRlWosy5fl98edVSJpm6Tu8/0USd4uZna7BKmI9Q6HuKLZNmtKSq9EV9q8v40d0ViefXFoAvlnBgxbDZWAb3Z1oortPRC2OxPtCX3fsm9d3nloXWzQ6kDKS9/IRGBIXeN0qtc2CT4hfqeEas2svepV3ZzXhq2Z1rUORUnrI8v6jzl5NFNS7hWm90k8+EhYCzRCPC3U9Se7N+eg9EGQ/7tWLx5IgeLOJ594fttAo11xNiC2S8bqj5BfAD303oKf0rY1fWFVfejteYPI6/UecSspDzTRgKHcyGE7wjMAJ1e3fImQGr9SVfVHHuRjpyx5QOn2kFXDAkl9AivJRrK4Gw+tiarE1yG5fir6Ht4JTHakvTjxb0MbSz//VgvC5QjSJRRqI6AUfgufe565RUVcCMBs+2c/8IaLLDORxmQOoRTvCIg/PajrPjMyWQSJy5HSNJVcOTox1zApgyLW8Q6GrGl3xNJCTVdion4JYv1s0/KFCswhlKMldS2E3pgWRfCBLk/KZ4tn30HH8s9vxi2NBZ2peucAOlZ4gy3/A4g6dHAkBcsd+Nz5rIDhVrW9G8164S47/4pPMCnZgTRFGGQYFheqvsHjc7vdF0uKsj06pbFrNqFSCVcLjsJDIBJPspPJDwG5zuQU/QQJ2FGh6yOj73F6vMNNUzmweeX3Q4q2hS4p3zKQSnY8Dd64GX+/Atn0RgJiFCy966yB4UU4kPMNWvjyrylr5FDyWkmkG5is7h2bENYrbNHQOTmxkkpedBhCNajCyVH1ZDuKl2iaMceC9OcHSS0shoGBxWRF9e+e6EgdN3pUfP3uTX1ihuiKLb3p0w1PUcW+JUSHM6nmSB7tL6ui+prVFNx7y1m7FHPRsaLzqQRuvOrNmygzw93oljOaLIAtB5af23J/KlwGZQurl1RNOmndObQHrY2Dy+zjPSKEOnvzqwkYiDsA93ikf1qa1DshOeWlqZMfoUN5V2KQ3WJEjs60aeUt9OGHy6mhvpIqK7+gefMXISEsImr4GODcBqkfd1YA8YLQvjj6dPn1lJqifOHwjLrzeGnV8x2AkB8BhgGxN/qg4PFdFeZXhHzrLydNLLkGw3VdkBGijBiqaIYm7G1PpTYS7uBmMyO1WcjryxOTfIvmvDyEDuQ9RPWFl7bWL/j3oZxu9O7CP9Db766hQxVVNPW5F2jM+ClUUnoAbrWFaP8QCuw4c3Ds3GpnV3r9lUEYY8oKruYdpwfxfeRTJSHrh7XISqkQ2osILibcaATm+yAs/7vRivmE+oUZmhFkoHQ99R6guj+8hxyACl4VKUwpyshrXJK2fOrTKr01789wm14x0wAGqwLZ9YKXBwGQaZTlH02mNpTGjHmM9paWYUyH8J+fAjvPDBzOybavv4rSU52NSY6U1Gi3QEi+U1a0SrvcqYhGRKJlsiz35/nxTkN4kTudQQKZ0Q+mlxNRvgh92ViFG8LJ5feQAnzgcln01ON/xOQvOmF+xOA0FJ9Haxb/kCaMeYQ+XHwjPT/5LjINi7JzYDXUQFS7FATd77TAYTc6CAJ+dvKjlOjwfiyEuKFF+cGBBLgxbPG1UL6Line truncated
|
||||||
|
" style="float:right; height: 50px; border-radius: 3px;">
|
||||||
|
<h1>Mongoose on CC3200 LaunchPad</h1>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
This web page demonstrates how Mongoose embedded networking library can be
|
||||||
|
used to implement real-time data exchange. Here, a TI CC3200 board pushes
|
||||||
|
JSON-encoded WebSocket frames to the connected browser, which in turn
|
||||||
|
graphs the data. Also, the browser can send commands to the device wrapped
|
||||||
|
into a WebSocket frame to turn an LED on/off.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<button id="on_off_button">Switch LED off</button>
|
||||||
|
|
||||||
|
<div id="graphs"></div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
</html>
|
</html>
|
||||||
@@ -0,0 +1,587 @@
|
|||||||
|
/*! jQuery v1.11.3 | (c) 2005, 2015 jQuery Foundation, Inc. | jquery.org/license */
|
||||||
|
!function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){var c=[],d=c.slice,e=c.concat,f=c.push,g=c.indexOf,h={},i=h.toString,j=h.hasOwnProperty,k={},l="1.11.3",m=function(a,b){return new m.fn.init(a,b)},n=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,o=/^-ms-/,p=/-([\da-z])/gi,q=function(a,b){return b.toUpperCase()};m.fn=m.prototype={jquery:l,constructor:m,selector:"",length:0,toArray:function(){return d.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:d.call(this)},pushStack:function(a){var b=m.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a,b){return m.each(this,a,b)},map:function(a){return this.pushStack(m.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(d.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor(null)},push:f,sort:c.sort,splice:c.splice},m.extend=m.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||m.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(e=arguments[h]))for(d in e)a=g[d],c=e[d],g!==c&&(j&&c&&(m.isPlainObject(c)||(b=m.isArray(c)))?(b?(b=!1,f=a&&m.isArray(a)?a:[]):f=a&&m.isPlainObject(a)?a:{},g[d]=m.extend(j,f,c)):void 0!==c&&(g[d]=c));return g},m.extend({expando:"jQuery"+(l+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===m.type(a)},isArray:Array.isArray||function(a){return"array"===m.type(a)},isWindow:function(a){return null!=a&&a==a.window},isNumeric:function(a){return!m.isArray(a)&&a-parseFloat(a)+1>=0},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},isPlainObject:function(a){var b;if(!a||"object"!==m.type(a)||a.nodeType||m.isWindow(a))return!1;try{if(a.constructor&&!j.call(a,"constructor")&&!j.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}if(k.ownLast)for(b in a)return j.call(a,b);for(b in a);return void 0===b||j.call(a,b)},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?h[i.call(a)]||"object":typeof a},globalEval:function(b){b&&m.trim(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(o,"ms-").replace(p,q)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b,c){var d,e=0,f=a.length,g=r(a);if(c){if(g){for(;f>e;e++)if(d=b.apply(a[e],c),d===!1)break}else for(e in a)if(d=b.apply(a[e],c),d===!1)break}else if(g){for(;f>e;e++)if(d=b.call(a[e],e,a[e]),d===!1)break}else for(e in a)if(d=b.call(a[e],e,a[e]),d===!1)break;return a},trim:function(a){return null==a?"":(a+"").replace(n,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(r(Object(a))?m.merge(c,"string"==typeof a?[a]:a):f.call(c,a)),c},inArray:function(a,b,c){var d;if(b){if(g)return g.call(b,a,c);for(d=b.length,c=c?0>c?Math.max(0,d+c):c:0;d>c;c++)if(c in b&&b[c]===a)return c}return-1},merge:function(a,b){var c=+b.length,d=0,e=a.length;while(c>d)a[e++]=b[d++];if(c!==c)while(void 0!==b[d])a[e++]=b[d++];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;g>f;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,f=0,g=a.length,h=r(a),i=[];if(h)for(;g>f;f++)d=b(a[f],f,c),null!=d&&i.push(d);else for(f in a)d=b(a[f],f,c),null!=d&&i.push(d);return e.apply([],i)},guid:1,proxy:function(a,b){var c,e,f;return"string"==typeof b&&(f=a[b],b=a,a=f),m.isFunction(a)?(c=d.call(arguments,2),e=function(){return a.apply(b||this,c.concat(d.call(arguments)))},e.guid=a.guid=a.guid||m.guid++,e):void 0},now:function(){return+new Date},support:k}),m.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(a,b){h["[object "+b+"]"]=b.toLowerCase()});function r(a){var b="length"in a&&a.length,c=m.type(a);return"function"===c||m.isWindow(a)?!1:1===a.nodeType&&b?!0:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}var s=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+1*new Date,v=a.document,w=0,x=0,y=ha(),z=ha(),A=ha(),B=function(a,b){return a===b&&(l=!0),0},C=1<<31,D={}.hasOwnProperty,E=[],F=E.pop,G=E.push,H=E.push,I=E.slice,J=function(a,b){for(var c=0,d=a.length;d>c;c++)if(a[c]===b)return c;return-1},K="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",L="[\\x20\\t\\r\\n\\f]",M="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",N=M.replace("w","w#"),O="\\["+L+"*("+M+")(?:"+L+"*([*^$|!~]?=)"+L+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^Line truncated
|
||||||
|
|
||||||
|
return!0}function Q(a,b,d,e){if(m.acceptData(a)){var f,g,h=m.expando,i=a.nodeType,j=i?m.cache:a,k=i?a[h]:a[h]&&h;if(k&&j[k]&&(e||j[k].data)||void 0!==d||"string"!=typeof b)return k||(k=i?a[h]=c.pop()||m.guid++:h),j[k]||(j[k]=i?{}:{toJSON:m.noop}),("object"==typeof b||"function"==typeof b)&&(e?j[k]=m.extend(j[k],b):j[k].data=m.extend(j[k].data,b)),g=j[k],e||(g.data||(g.data={}),g=g.data),void 0!==d&&(g[m.camelCase(b)]=d),"string"==typeof b?(f=g[b],null==f&&(f=g[m.camelCase(b)])):f=g,f}}function R(a,b,c){if(m.acceptData(a)){var d,e,f=a.nodeType,g=f?m.cache:a,h=f?a[m.expando]:m.expando;if(g[h]){if(b&&(d=c?g[h]:g[h].data)){m.isArray(b)?b=b.concat(m.map(b,m.camelCase)):b in d?b=[b]:(b=m.camelCase(b),b=b in d?[b]:b.split(" ")),e=b.length;while(e--)delete d[b[e]];if(c?!P(d):!m.isEmptyObject(d))return}(c||(delete g[h].data,P(g[h])))&&(f?m.cleanData([a],!0):k.deleteExpando||g!=g.window?delete g[h]:g[h]=null)}}}m.extend({cache:{},noData:{"applet ":!0,"embed ":!0,"object ":"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(a){return a=a.nodeType?m.cache[a[m.expando]]:a[m.expando],!!a&&!P(a)},data:function(a,b,c){return Q(a,b,c)},removeData:function(a,b){return R(a,b)},_data:function(a,b,c){return Q(a,b,c,!0)},_removeData:function(a,b){return R(a,b,!0)}}),m.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=m.data(f),1===f.nodeType&&!m._data(f,"parsedAttrs"))){c=g.length;while(c--)g[c]&&(d=g[c].name,0===d.indexOf("data-")&&(d=m.camelCase(d.slice(5)),O(f,d,e[d])));m._data(f,"parsedAttrs",!0)}return e}return"object"==typeof a?this.each(function(){m.data(this,a)}):arguments.length>1?this.each(function(){m.data(this,a,b)}):f?O(f,a,m.data(f,a)):void 0},removeData:function(a){return this.each(function(){m.removeData(this,a)})}}),m.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=m._data(a,b),c&&(!d||m.isArray(c)?d=m._data(a,b,m.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=m.queue(a,b),d=c.length,e=c.shift(),f=m._queueHooks(a,b),g=function(){m.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return m._data(a,c)||m._data(a,c,{empty:m.Callbacks("once memory").add(function(){m._removeData(a,b+"queue"),m._removeData(a,c)})})}}),m.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.length<c?m.queue(this[0],a):void 0===b?this:this.each(function(){var c=m.queue(this,a,b);m._queueHooks(this,a),"fx"===a&&"inprogress"!==c[0]&&m.dequeue(this,a)})},dequeue:function(a){return this.each(function(){m.dequeue(this,a)})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,b){var c,d=1,e=m.Deferred(),f=this,g=this.length,h=function(){--d||e.resolveWith(f,[f])};"string"!=typeof a&&(b=a,a=void 0),a=a||"fx";while(g--)c=m._data(f[g],a+"queueHooks"),c&&c.empty&&(d++,c.empty.add(h));return h(),e.promise(b)}});var S=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,T=["Top","Right","Bottom","Left"],U=function(a,b){return a=b||a,"none"===m.css(a,"display")||!m.contains(a.ownerDocument,a)},V=m.access=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===m.type(c)){e=!0;for(h in c)m.access(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,m.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(m(a),c)})),b))for(;i>h;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f},W=/^(?:checkbox|radio)$/i;!function(){var a=y.createElement("input"),b=y.createElement("div"),c=y.createDocumentFragment();if(b.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",k.leadingWhitespace=3===b.firstChild.nodeType,k.tbody=!b.getElementsByTagName("tbody").length,k.htmlSerialize=!!b.getElementsByTagName("link").length,k.html5Clone="<:nav></:nav>"!==y.createElement("nav").cloneNode(!0).outerHTML,a.type="checkbox",a.checked=!0,c.appendChild(a),k.appendChecked=a.checked,b.innerHTML="<textarea>x</textarea>",k.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue,c.appendChild(b),b.innerHTML="<input type='radio' checked='checked' name='t'/>",k.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,k.noCloneEvent=!0,b.attachEvent&&(b.attachEvent("onclick",function(){k.noCloneEvent=!1}),b.cloneNode(!0).click()),null==k.deleteExpando){k.deleteExpando=!0;try{delete b.test}catch(d){k.deleteExpando=!1}}}(),function(){var b,c,d=y.createElement("div");for(b in{submit:!0,change:!0,focusin:!0})c="on"+b,(k[b+"Bubbles"]=c in a)||(d.setAttribute(c,"t"),k[b+"Bubbles"]=d.attributes[c].expando===!1);d=null}();var X=/^(?:input|select|textarea)$/i,Y=/^key/,Z=/^(?:mouse|pointer|contextmenu)|click/,$=/^(?:focusinfocus|focusoutblur)$/,_=/^([^.]*)(?:\.(.+)|)$/;function aa(){return!0}function ba(){return!1}function ca(){try{return y.activeElement}catch(a){}}m.event={global:{},add:function(a,b,c,d,e){var
Line truncated
|
||||||
|
return new Za.prototype.init(a,b,c,d,e)}m.Tween=Za,Za.prototype={constructor:Za,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||"swing",this.options=b,this.start=this.now=this.cur(),this.end=d,this.unit=f||(m.cssNumber[c]?"":"px")},cur:function(){var a=Za.propHooks[this.prop];return a&&a.get?a.get(this):Za.propHooks._default.get(this)},run:function(a){var b,c=Za.propHooks[this.prop];return this.options.duration?this.pos=b=m.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration):this.pos=b=a,this.now=(this.end-this.start)*b+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),c&&c.set?c.set(this):Za.propHooks._default.set(this),this}},Za.prototype.init.prototype=Za.prototype,Za.propHooks={_default:{get:function(a){var b;return null==a.elem[a.prop]||a.elem.style&&null!=a.elem.style[a.prop]?(b=m.css(a.elem,a.prop,""),b&&"auto"!==b?b:0):a.elem[a.prop]},set:function(a){m.fx.step[a.prop]?m.fx.step[a.prop](a):a.elem.style&&(null!=a.elem.style[m.cssProps[a.prop]]||m.cssHooks[a.prop])?m.style(a.elem,a.prop,a.now+a.unit):a.elem[a.prop]=a.now}}},Za.propHooks.scrollTop=Za.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}},m.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2}},m.fx=Za.prototype.init,m.fx.step={};var $a,_a,ab=/^(?:toggle|show|hide)$/,bb=new RegExp("^(?:([+-])=|)("+S+")([a-z%]*)$","i"),cb=/queueHooks$/,db=[ib],eb={"*":[function(a,b){var c=this.createTween(a,b),d=c.cur(),e=bb.exec(b),f=e&&e[3]||(m.cssNumber[a]?"":"px"),g=(m.cssNumber[a]||"px"!==f&&+d)&&bb.exec(m.css(c.elem,a)),h=1,i=20;if(g&&g[3]!==f){f=f||g[3],e=e||[],g=+d||1;do h=h||".5",g/=h,m.style(c.elem,a,g+f);while(h!==(h=c.cur()/d)&&1!==h&&--i)}return e&&(g=c.start=+g||+d||0,c.unit=f,c.end=e[1]?g+(e[1]+1)*e[2]:+e[2]),c}]};function fb(){return setTimeout(function(){$a=void 0}),$a=m.now()}function gb(a,b){var c,d={height:a},e=0;for(b=b?1:0;4>e;e+=2-b)c=T[e],d["margin"+c]=d["padding"+c]=a;return b&&(d.opacity=d.width=a),d}function hb(a,b,c){for(var d,e=(eb[b]||[]).concat(eb["*"]),f=0,g=e.length;g>f;f++)if(d=e[f].call(c,b,a))return d}function ib(a,b,c){var d,e,f,g,h,i,j,l,n=this,o={},p=a.style,q=a.nodeType&&U(a),r=m._data(a,"fxshow");c.queue||(h=m._queueHooks(a,"fx"),null==h.unqueued&&(h.unqueued=0,i=h.empty.fire,h.empty.fire=function(){h.unqueued||i()}),h.unqueued++,n.always(function(){n.always(function(){h.unqueued--,m.queue(a,"fx").length||h.empty.fire()})})),1===a.nodeType&&("height"in b||"width"in b)&&(c.overflow=[p.overflow,p.overflowX,p.overflowY],j=m.css(a,"display"),l="none"===j?m._data(a,"olddisplay")||Fa(a.nodeName):j,"inline"===l&&"none"===m.css(a,"float")&&(k.inlineBlockNeedsLayout&&"inline"!==Fa(a.nodeName)?p.zoom=1:p.display="inline-block")),c.overflow&&(p.overflow="hidden",k.shrinkWrapBlocks()||n.always(function(){p.overflow=c.overflow[0],p.overflowX=c.overflow[1],p.overflowY=c.overflow[2]}));for(d in b)if(e=b[d],ab.exec(e)){if(delete b[d],f=f||"toggle"===e,e===(q?"hide":"show")){if("show"!==e||!r||void 0===r[d])continue;q=!0}o[d]=r&&r[d]||m.style(a,d)}else j=void 0;if(m.isEmptyObject(o))"inline"===("none"===j?Fa(a.nodeName):j)&&(p.display=j);else{r?"hidden"in r&&(q=r.hidden):r=m._data(a,"fxshow",{}),f&&(r.hidden=!q),q?m(a).show():n.done(function(){m(a).hide()}),n.done(function(){var b;m._removeData(a,"fxshow");for(b in o)m.style(a,b,o[b])});for(d in o)g=hb(q?r[d]:0,d,n),d in r||(r[d]=g.start,q&&(g.end=g.start,g.start="width"===d||"height"===d?1:0))}}function jb(a,b){var c,d,e,f,g;for(c in a)if(d=m.camelCase(c),e=b[d],f=a[c],m.isArray(f)&&(e=f[1],f=a[c]=f[0]),c!==d&&(a[d]=f,delete a[c]),g=m.cssHooks[d],g&&"expand"in g){f=g.expand(f),delete a[d];for(c in f)c in a||(a[c]=f[c],b[c]=e)}else b[d]=e}function kb(a,b,c){var d,e,f=0,g=db.length,h=m.Deferred().always(function(){delete i.elem}),i=function(){if(e)return!1;for(var b=$a||fb(),c=Math.max(0,j.startTime+j.duration-b),d=c/j.duration||0,f=1-d,g=0,i=j.tweens.length;i>g;g++)j.tweens[g].run(f);return h.notifyWith(a,[j,f,c]),1>f&&i?c:(h.resolveWith(a,[j]),!1)},j=h.promise({elem:a,props:m.extend({},b),opts:m.extend(!0,{specialEasing:{}},c),originalProperties:b,originalOptions:c,startTime:$a||fb(),duration:c.duration,tweens:[],createTween:function(b,c){var d=m.Tween(a,j.opts,b,c,j.opts.specialEasing[b]||j.opts.easing);return j.tweens.push(d),d},stop:function(b){var c=0,d=b?j.tweens.length:0;if(e)return this;for(e=!0;d>c;c++)j.tweens[c].run(1);return b?h.resolveWith(a,[j,b]):h.rejectWith(a,[j,b]),this}}),k=j.props;for(jb(k,j.opts.specialEasing);g>f;f++)if(d=db[f].call(j,a,k,j.opts))return d;return m.map(k,hb,j),m.isFunction(j.opts.start)&&j.opts.start.call(a,j),m.fx.timer(m.extend(i,{elem:a,anim:j,queue:j.opts.queue})),j.progress(j.opts.progress).done(j.opts.done,j.opts.complete).fail(j.opts.fail).always(j.opts.always)}m.Animation=m.extend(kb,{tweener:function(a,b){m.isFunction(a)?(b=a,a=["*"]):a=a.split(" ");for(var c,d=0,e=a.length;e>d;d++)c=a[d],eb[cLine truncated
|
||||||
|
|
||||||
|
/* Javascript plotting library for jQuery, version 0.8.3.
|
||||||
|
|
||||||
|
Copyright (c) 2007-2014 IOLA and Ole Laursen.
|
||||||
|
Licensed under the MIT license.
|
||||||
|
|
||||||
|
*/
|
||||||
|
(function($){$.color={};$.color.make=function(r,g,b,a){var o={};o.r=r||0;o.g=g||0;o.b=b||0;o.a=a!=null?a:1;o.add=function(c,d){for(var i=0;i<c.length;++i)o[c.charAt(i)]+=d;return o.normalize()};o.scale=function(c,f){for(var i=0;i<c.length;++i)o[c.charAt(i)]*=f;return o.normalize()};o.toString=function(){if(o.a>=1){return"rgb("+[o.r,o.g,o.b].join(",")+")"}else{return"rgba("+[o.r,o.g,o.b,o.a].join(",")+")"}};o.normalize=function(){function clamp(min,value,max){return value<min?min:value>max?max:value}o.r=clamp(0,parseInt(o.r),255);o.g=clamp(0,parseInt(o.g),255);o.b=clamp(0,parseInt(o.b),255);o.a=clamp(0,o.a,1);return o};o.clone=function(){return $.color.make(o.r,o.b,o.g,o.a)};return o.normalize()};$.color.extract=function(elem,css){var c;do{c=elem.css(css).toLowerCase();if(c!=""&&c!="transparent")break;elem=elem.parent()}while(elem.length&&!$.nodeName(elem.get(0),"body"));if(c=="rgba(0, 0, 0, 0)")c="transparent";return $.color.parse(c)};$.color.parse=function(str){var res,m=$.color.make;if(res=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(str))return m(parseInt(res[1],10),parseInt(res[2],10),parseInt(res[3],10));if(res=/rgba\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]+(?:\.[0-9]+)?)\s*\)/.exec(str))return m(parseInt(res[1],10),parseInt(res[2],10),parseInt(res[3],10),parseFloat(res[4]));if(res=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(str))return m(parseFloat(res[1])*2.55,parseFloat(res[2])*2.55,parseFloat(res[3])*2.55);if(res=/rgba\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\s*\)/.exec(str))return m(parseFloat(res[1])*2.55,parseFloat(res[2])*2.55,parseFloat(res[3])*2.55,parseFloat(res[4]));if(res=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(str))return m(parseInt(res[1],16),parseInt(res[2],16),parseInt(res[3],16));if(res=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(str))return m(parseInt(res[1]+res[1],16),parseInt(res[2]+res[2],16),parseInt(res[3]+res[3],16));var name=$.trim(str).toLowerCase();if(name=="transparent")return m(255,255,255,0);else{res=lookupColors[name]||[0,0,0];return m(res[0],res[1],res[2])}};var lookupColors={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0,0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0]}})(jQuery);(function($){var hasOwnProperty=Object.prototype.hasOwnProperty;if(!$.fn.detach){$.fn.detach=function(){return this.each(function(){if(this.parentNode){this.parentNode.removeChild(this)}})}}function Canvas(cls,container){var element=container.children("."+cls)[0];if(element==null){element=document.createElement("canvas");element.className=cls;$(element).css({direction:"ltr",position:"absolute",left:0,top:0}).appendTo(container);if(!element.getContext){if(window.G_vmlCanvasManager){element=window.G_vmlCanvasManager.initElement(element)}else{throw new Error("Canvas is not available. If you're using IE with a fall-back such as Excanvas, then there's either a mistake in your conditional include, or the page has no DOCTYPE and is rendering in Quirks Mode.")}}}this.element=element;var context=this.context=element.getContext("2d");var devicePixelRatio=window.devicePixelRatio||1,backingStoreRatio=context.webkitBackingStorePixelRatio||context.mozBackingStorePixelRatio||context.msBackingStorePixelRatio||context.oBackingStorePixelRatio||context.backingStorePixelRatio||1;this.pixelRatio=devicePixelRatio/backingStoreRatio;this.resize(container.width(),container.height());this.textContainer=null;this.text={};this._textCache={}}Canvas.prototype.resize=function(width,height){if(width<=0||height<=0){throw new Error("Invalid dimensions for plot, width = "+width+", height = "+height)}var element=this.element,context=this.context,pixelRatio=this.pixelRatio;if(this.width!=width){element.width=width*pixelRatio;element.style.width=width+"px";this.width=width}if(this.height!=height){element.height=height*pixelRatio;element.style.height=height+"px";this.height=height}context.restore();context.save();context.scale(pixelRatio,pixelRatio)};Canvas.prototype.clear=function(){this.context.clearRect(0,0,this.width,this.height)};Canvas.prototype.render=function(){vaLine truncated
|
||||||
|
if(yrange.from==null)yrange.from=yrange.axis.min;if(yrange.to==null)yrange.to=yrange.axis.max;if(xrange.to<xrange.axis.min||xrange.from>xrange.axis.max||yrange.to<yrange.axis.min||yrange.from>yrange.axis.max)continue;xrange.from=Math.max(xrange.from,xrange.axis.min);xrange.to=Math.min(xrange.to,xrange.axis.max);yrange.from=Math.max(yrange.from,yrange.axis.min);yrange.to=Math.min(yrange.to,yrange.axis.max);var xequal=xrange.from===xrange.to,yequal=yrange.from===yrange.to;if(xequal&&yequal){continue}xrange.from=Math.floor(xrange.axis.p2c(xrange.from));xrange.to=Math.floor(xrange.axis.p2c(xrange.to));yrange.from=Math.floor(yrange.axis.p2c(yrange.from));yrange.to=Math.floor(yrange.axis.p2c(yrange.to));if(xequal||yequal){var lineWidth=m.lineWidth||options.grid.markingsLineWidth,subPixel=lineWidth%2?.5:0;ctx.beginPath();ctx.strokeStyle=m.color||options.grid.markingsColor;ctx.lineWidth=lineWidth;if(xequal){ctx.moveTo(xrange.to+subPixel,yrange.from);ctx.lineTo(xrange.to+subPixel,yrange.to)}else{ctx.moveTo(xrange.from,yrange.to+subPixel);ctx.lineTo(xrange.to,yrange.to+subPixel)}ctx.stroke()}else{ctx.fillStyle=m.color||options.grid.markingsColor;ctx.fillRect(xrange.from,yrange.to,xrange.to-xrange.from,yrange.from-yrange.to)}}}axes=allAxes();bw=options.grid.borderWidth;for(var j=0;j<axes.length;++j){var axis=axes[j],box=axis.box,t=axis.tickLength,x,y,xoff,yoff;if(!axis.show||axis.ticks.length==0)continue;ctx.lineWidth=1;if(axis.direction=="x"){x=0;if(t=="full")y=axis.position=="top"?0:plotHeight;else y=box.top-plotOffset.top+(axis.position=="top"?box.height:0)}else{y=0;if(t=="full")x=axis.position=="left"?0:plotWidth;else x=box.left-plotOffset.left+(axis.position=="left"?box.width:0)}if(!axis.innermost){ctx.strokeStyle=axis.options.color;ctx.beginPath();xoff=yoff=0;if(axis.direction=="x")xoff=plotWidth+1;else yoff=plotHeight+1;if(ctx.lineWidth==1){if(axis.direction=="x"){y=Math.floor(y)+.5}else{x=Math.floor(x)+.5}}ctx.moveTo(x,y);ctx.lineTo(x+xoff,y+yoff);ctx.stroke()}ctx.strokeStyle=axis.options.tickColor;ctx.beginPath();for(i=0;i<axis.ticks.length;++i){var v=axis.ticks[i].v;xoff=yoff=0;if(isNaN(v)||v<axis.min||v>axis.max||t=="full"&&(typeof bw=="object"&&bw[axis.position]>0||bw>0)&&(v==axis.min||v==axis.max))continue;if(axis.direction=="x"){x=axis.p2c(v);yoff=t=="full"?-plotHeight:t;if(axis.position=="top")yoff=-yoff}else{y=axis.p2c(v);xoff=t=="full"?-plotWidth:t;if(axis.position=="left")xoff=-xoff}if(ctx.lineWidth==1){if(axis.direction=="x")x=Math.floor(x)+.5;else y=Math.floor(y)+.5}ctx.moveTo(x,y);ctx.lineTo(x+xoff,y+yoff)}ctx.stroke()}if(bw){bc=options.grid.borderColor;if(typeof bw=="object"||typeof bc=="object"){if(typeof bw!=="object"){bw={top:bw,right:bw,bottom:bw,left:bw}}if(typeof bc!=="object"){bc={top:bc,right:bc,bottom:bc,left:bc}}if(bw.top>0){ctx.strokeStyle=bc.top;ctx.lineWidth=bw.top;ctx.beginPath();ctx.moveTo(0-bw.left,0-bw.top/2);ctx.lineTo(plotWidth,0-bw.top/2);ctx.stroke()}if(bw.right>0){ctx.strokeStyle=bc.right;ctx.lineWidth=bw.right;ctx.beginPath();ctx.moveTo(plotWidth+bw.right/2,0-bw.top);ctx.lineTo(plotWidth+bw.right/2,plotHeight);ctx.stroke()}if(bw.bottom>0){ctx.strokeStyle=bc.bottom;ctx.lineWidth=bw.bottom;ctx.beginPath();ctx.moveTo(plotWidth+bw.right,plotHeight+bw.bottom/2);ctx.lineTo(0,plotHeight+bw.bottom/2);ctx.stroke()}if(bw.left>0){ctx.strokeStyle=bc.left;ctx.lineWidth=bw.left;ctx.beginPath();ctx.moveTo(0-bw.left/2,plotHeight+bw.bottom);ctx.lineTo(0-bw.left/2,0);ctx.stroke()}}else{ctx.lineWidth=bw;ctx.strokeStyle=options.grid.borderColor;ctx.strokeRect(-bw/2,-bw/2,plotWidth+bw,plotHeight+bw)}}ctx.restore()}function drawAxisLabels(){$.each(allAxes(),function(_,axis){var box=axis.box,legacyStyles=axis.direction+"Axis "+axis.direction+axis.n+"Axis",layer="flot-"+axis.direction+"-axis flot-"+axis.direction+axis.n+"-axis "+legacyStyles,font=axis.options.font||"flot-tick-label tickLabel",tick,x,y,halign,valign;surface.removeText(layer);if(!axis.show||axis.ticks.length==0)return;for(var i=0;i<axis.ticks.length;++i){tick=axis.ticks[i];if(!tick.label||tick.v<axis.min||tick.v>axis.max)continue;if(axis.direction=="x"){halign="center";x=plotOffset.left+axis.p2c(tick.v);if(axis.position=="bottom"){y=box.top+box.padding}else{y=box.top+box.height-box.padding;valign="bottom"}}else{valign="middle";y=plotOffset.top+axis.p2c(tick.v);if(axis.position=="left"){x=box.left+box.width-box.padding;halign="right"}else{x=box.left+box.padding}}surface.addText(layer,x,y,tick.label,font,null,null,halign,valign)}})}function drawSeries(series){if(series.lines.show)drawSeriesLines(series);if(series.bars.show)drawSeriesBars(series);if(series.points.show)drawSeriesPoints(series)}function drawSeriesLines(series){function plotLine(datapoints,xoffset,yoffset,axisx,axisy){var points=datapoints.points,ps=datapoints.pointsize,prevx=null,prevy=null;ctx.beginPath();for(var i=ps;i<points.length;i+=ps){var x1=points[i-ps],y1=points[i-ps+1],x2=points[i],y2=points[i+1];if(x1==null||x2==null)continue;if(y1<=y2&&y1<axisy.min){if(y2<axLine truncated
|
||||||
|
|
||||||
|
|
||||||
|
/* Pretty handling of time axes.
|
||||||
|
|
||||||
|
Copyright (c) 2007-2014 IOLA and Ole Laursen.
|
||||||
|
Licensed under the MIT license.
|
||||||
|
|
||||||
|
Set axis.mode to "time" to enable. See the section "Time series data" in
|
||||||
|
API.txt for details.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
(function($) {
|
||||||
|
|
||||||
|
var options = {
|
||||||
|
xaxis: {
|
||||||
|
timezone: null, // "browser" for local to the client or timezone for timezone-js
|
||||||
|
timeformat: null, // format string to use
|
||||||
|
twelveHourClock: false, // 12 or 24 time in time mode
|
||||||
|
monthNames: null // list of names of months
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// round to nearby lower multiple of base
|
||||||
|
|
||||||
|
function floorInBase(n, base) {
|
||||||
|
return base * Math.floor(n / base);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Returns a string with the date d formatted according to fmt.
|
||||||
|
// A subset of the Open Group's strftime format is supported.
|
||||||
|
|
||||||
|
function formatDate(d, fmt, monthNames, dayNames) {
|
||||||
|
|
||||||
|
if (typeof d.strftime == "function") {
|
||||||
|
return d.strftime(fmt);
|
||||||
|
}
|
||||||
|
|
||||||
|
var leftPad = function(n, pad) {
|
||||||
|
n = "" + n;
|
||||||
|
pad = "" + (pad == null ? "0" : pad);
|
||||||
|
return n.length == 1 ? pad + n : n;
|
||||||
|
};
|
||||||
|
|
||||||
|
var r = [];
|
||||||
|
var escape = false;
|
||||||
|
var hours = d.getHours();
|
||||||
|
var isAM = hours < 12;
|
||||||
|
|
||||||
|
if (monthNames == null) {
|
||||||
|
monthNames = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dayNames == null) {
|
||||||
|
dayNames = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
|
||||||
|
}
|
||||||
|
|
||||||
|
var hours12;
|
||||||
|
|
||||||
|
if (hours > 12) {
|
||||||
|
hours12 = hours - 12;
|
||||||
|
} else if (hours == 0) {
|
||||||
|
hours12 = 12;
|
||||||
|
} else {
|
||||||
|
hours12 = hours;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (var i = 0; i < fmt.length; ++i) {
|
||||||
|
|
||||||
|
var c = fmt.charAt(i);
|
||||||
|
|
||||||
|
if (escape) {
|
||||||
|
switch (c) {
|
||||||
|
case 'a': c = "" + dayNames[d.getDay()]; break;
|
||||||
|
case 'b': c = "" + monthNames[d.getMonth()]; break;
|
||||||
|
case 'd': c = leftPad(d.getDate()); break;
|
||||||
|
case 'e': c = leftPad(d.getDate(), " "); break;
|
||||||
|
case 'h': // For back-compat with 0.7; remove in 1.0
|
||||||
|
case 'H': c = leftPad(hours); break;
|
||||||
|
case 'I': c = leftPad(hours12); break;
|
||||||
|
case 'l': c = leftPad(hours12, " "); break;
|
||||||
|
case 'm': c = leftPad(d.getMonth() + 1); break;
|
||||||
|
case 'M': c = leftPad(d.getMinutes()); break;
|
||||||
|
// quarters not in Open Group's strftime specification
|
||||||
|
case 'q':
|
||||||
|
c = "" + (Math.floor(d.getMonth() / 3) + 1); break;
|
||||||
|
case 'S': c = leftPad(d.getSeconds()); break;
|
||||||
|
case 'y': c = leftPad(d.getFullYear() % 100); break;
|
||||||
|
case 'Y': c = "" + d.getFullYear(); break;
|
||||||
|
case 'p': c = (isAM) ? ("" + "am") : ("" + "pm"); break;
|
||||||
|
case 'P': c = (isAM) ? ("" + "AM") : ("" + "PM"); break;
|
||||||
|
case 'w': c = "" + d.getDay(); break;
|
||||||
|
}
|
||||||
|
r.push(c);
|
||||||
|
escape = false;
|
||||||
|
} else {
|
||||||
|
if (c == "%") {
|
||||||
|
escape = true;
|
||||||
|
} else {
|
||||||
|
r.push(c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return r.join("");
|
||||||
|
}
|
||||||
|
|
||||||
|
// To have a consistent view of time-based data independent of which time
|
||||||
|
// zone the client happens to be in we need a date-like object independent
|
||||||
|
// of time zones. This is done through a wrapper that only calls the UTC
|
||||||
|
// versions of the accessor methods.
|
||||||
|
|
||||||
|
function makeUtcWrapper(d) {
|
||||||
|
|
||||||
|
function addProxyMethod(sourceObj, sourceMethod, targetObj, targetMethod) {
|
||||||
|
sourceObj[sourceMethod] = function() {
|
||||||
|
return targetObj[targetMethod].apply(targetObj, arguments);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
var utc = {
|
||||||
|
date: d
|
||||||
|
};
|
||||||
|
|
||||||
|
// support strftime, if found
|
||||||
|
|
||||||
|
if (d.strftime != undefined) {
|
||||||
|
addProxyMethod(utc, "strftime", d, "strftime");
|
||||||
|
}
|
||||||
|
|
||||||
|
addProxyMethod(utc, "getTime", d, "getTime");
|
||||||
|
addProxyMethod(utc, "setTime", d, "setTime");
|
||||||
|
|
||||||
|
var props = ["Date", "Day", "FullYear", "Hours", "Milliseconds", "Minutes", "Month", "Seconds"];
|
||||||
|
|
||||||
|
for (var p = 0; p < props.length; p++) {
|
||||||
|
addProxyMethod(utc, "get" + props[p], d, "getUTC" + props[p]);
|
||||||
|
addProxyMethod(utc, "set" + props[p], d, "setUTC" + props[p]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return utc;
|
||||||
|
};
|
||||||
|
|
||||||
|
// select time zone strategy. This returns a date-like object tied to the
|
||||||
|
// desired timezone
|
||||||
|
|
||||||
|
function dateGenerator(ts, opts) {
|
||||||
|
if (opts.timezone == "browser") {
|
||||||
|
return new Date(ts);
|
||||||
|
} else if (!opts.timezone || opts.timezone == "utc") {
|
||||||
|
return makeUtcWrapper(new Date(ts));
|
||||||
|
} else if (typeof timezoneJS != "undefined" && typeof timezoneJS.Date != "undefined") {
|
||||||
|
var d = new timezoneJS.Date();
|
||||||
|
// timezone-js is fickle, so be sure to set the time zone before
|
||||||
|
// setting the time.
|
||||||
|
d.setTimezone(opts.timezone);
|
||||||
|
d.setTime(ts);
|
||||||
|
return d;
|
||||||
|
} else {
|
||||||
|
return makeUtcWrapper(new Date(ts));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// map of app. size of time units in milliseconds
|
||||||
|
|
||||||
|
var timeUnitSize = {
|
||||||
|
"second": 1000,
|
||||||
|
"minute": 60 * 1000,
|
||||||
|
"hour": 60 * 60 * 1000,
|
||||||
|
"day": 24 * 60 * 60 * 1000,
|
||||||
|
"month": 30 * 24 * 60 * 60 * 1000,
|
||||||
|
"quarter": 3 * 30 * 24 * 60 * 60 * 1000,
|
||||||
|
"year": 365.2425 * 24 * 60 * 60 * 1000
|
||||||
|
};
|
||||||
|
|
||||||
|
// the allowed tick sizes, after 1 year we use
|
||||||
|
// an integer algorithm
|
||||||
|
|
||||||
|
var baseSpec = [
|
||||||
|
[1, "second"], [2, "second"], [5, "second"], [10, "second"],
|
||||||
|
[30, "second"],
|
||||||
|
[1, "minute"], [2, "minute"], [5, "minute"], [10, "minute"],
|
||||||
|
[30, "minute"],
|
||||||
|
[1, "hour"], [2, "hour"], [4, "hour"],
|
||||||
|
[8, "hour"], [12, "hour"],
|
||||||
|
[1, "day"], [2, "day"], [3, "day"],
|
||||||
|
[0.25, "month"], [0.5, "month"], [1, "month"],
|
||||||
|
[2, "month"]
|
||||||
|
];
|
||||||
|
|
||||||
|
// we don't know which variant(s) we'll need yet, but generating both is
|
||||||
|
// cheap
|
||||||
|
|
||||||
|
var specMonths = baseSpec.concat([[3, "month"], [6, "month"],
|
||||||
|
[1, "year"]]);
|
||||||
|
var specQuarters = baseSpec.concat([[1, "quarter"], [2, "quarter"],
|
||||||
|
[1, "year"]]);
|
||||||
|
|
||||||
|
function init(plot) {
|
||||||
|
plot.hooks.processOptions.push(function (plot, options) {
|
||||||
|
$.each(plot.getAxes(), function(axisName, axis) {
|
||||||
|
|
||||||
|
var opts = axis.options;
|
||||||
|
|
||||||
|
if (opts.mode == "time") {
|
||||||
|
axis.tickGenerator = function(axis) {
|
||||||
|
|
||||||
|
var ticks = [];
|
||||||
|
var d = dateGenerator(axis.min, opts);
|
||||||
|
var minSize = 0;
|
||||||
|
|
||||||
|
// make quarter use a possibility if quarters are
|
||||||
|
// mentioned in either of these options
|
||||||
|
|
||||||
|
var spec = (opts.tickSize && opts.tickSize[1] ===
|
||||||
|
"quarter") ||
|
||||||
|
(opts.minTickSize && opts.minTickSize[1] ===
|
||||||
|
"quarter") ? specQuarters : specMonths;
|
||||||
|
|
||||||
|
if (opts.minTickSize != null) {
|
||||||
|
if (typeof opts.tickSize == "number") {
|
||||||
|
minSize = opts.tickSize;
|
||||||
|
} else {
|
||||||
|
minSize = opts.minTickSize[0] * timeUnitSize[opts.minTickSize[1]];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (var i = 0; i < spec.length - 1; ++i) {
|
||||||
|
if (axis.delta < (spec[i][0] * timeUnitSize[spec[i][1]]
|
||||||
|
+ spec[i + 1][0] * timeUnitSize[spec[i + 1][1]]) / 2
|
||||||
|
&& spec[i][0] * timeUnitSize[spec[i][1]] >= minSize) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var size = spec[i][0];
|
||||||
|
var unit = spec[i][1];
|
||||||
|
|
||||||
|
// special-case the possibility of several years
|
||||||
|
|
||||||
|
if (unit == "year") {
|
||||||
|
|
||||||
|
// if given a minTickSize in years, just use it,
|
||||||
|
// ensuring that it's an integer
|
||||||
|
|
||||||
|
if (opts.minTickSize != null && opts.minTickSize[1] == "year") {
|
||||||
|
size = Math.floor(opts.minTickSize[0]);
|
||||||
|
} else {
|
||||||
|
|
||||||
|
var magn = Math.pow(10, Math.floor(Math.log(axis.delta / timeUnitSize.year) / Math.LN10));
|
||||||
|
var norm = (axis.delta / timeUnitSize.year) / magn;
|
||||||
|
|
||||||
|
if (norm < 1.5) {
|
||||||
|
size = 1;
|
||||||
|
} else if (norm < 3) {
|
||||||
|
size = 2;
|
||||||
|
} else if (norm < 7.5) {
|
||||||
|
size = 5;
|
||||||
|
} else {
|
||||||
|
size = 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
size *= magn;
|
||||||
|
}
|
||||||
|
|
||||||
|
// minimum size for years is 1
|
||||||
|
|
||||||
|
if (size < 1) {
|
||||||
|
size = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
axis.tickSize = opts.tickSize || [size, unit];
|
||||||
|
var tickSize = axis.tickSize[0];
|
||||||
|
unit = axis.tickSize[1];
|
||||||
|
|
||||||
|
var step = tickSize * timeUnitSize[unit];
|
||||||
|
|
||||||
|
if (unit == "second") {
|
||||||
|
d.setSeconds(floorInBase(d.getSeconds(), tickSize));
|
||||||
|
} else if (unit == "minute") {
|
||||||
|
d.setMinutes(floorInBase(d.getMinutes(), tickSize));
|
||||||
|
} else if (unit == "hour") {
|
||||||
|
d.setHours(floorInBase(d.getHours(), tickSize));
|
||||||
|
} else if (unit == "month") {
|
||||||
|
d.setMonth(floorInBase(d.getMonth(), tickSize));
|
||||||
|
} else if (unit == "quarter") {
|
||||||
|
d.setMonth(3 * floorInBase(d.getMonth() / 3,
|
||||||
|
tickSize));
|
||||||
|
} else if (unit == "year") {
|
||||||
|
d.setFullYear(floorInBase(d.getFullYear(), tickSize));
|
||||||
|
}
|
||||||
|
|
||||||
|
// reset smaller components
|
||||||
|
|
||||||
|
d.setMilliseconds(0);
|
||||||
|
|
||||||
|
if (step >= timeUnitSize.minute) {
|
||||||
|
d.setSeconds(0);
|
||||||
|
}
|
||||||
|
if (step >= timeUnitSize.hour) {
|
||||||
|
d.setMinutes(0);
|
||||||
|
}
|
||||||
|
if (step >= timeUnitSize.day) {
|
||||||
|
d.setHours(0);
|
||||||
|
}
|
||||||
|
if (step >= timeUnitSize.day * 4) {
|
||||||
|
d.setDate(1);
|
||||||
|
}
|
||||||
|
if (step >= timeUnitSize.month * 2) {
|
||||||
|
d.setMonth(floorInBase(d.getMonth(), 3));
|
||||||
|
}
|
||||||
|
if (step >= timeUnitSize.quarter * 2) {
|
||||||
|
d.setMonth(floorInBase(d.getMonth(), 6));
|
||||||
|
}
|
||||||
|
if (step >= timeUnitSize.year) {
|
||||||
|
d.setMonth(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
var carry = 0;
|
||||||
|
var v = Number.NaN;
|
||||||
|
var prev;
|
||||||
|
|
||||||
|
do {
|
||||||
|
|
||||||
|
prev = v;
|
||||||
|
v = d.getTime();
|
||||||
|
ticks.push(v);
|
||||||
|
|
||||||
|
if (unit == "month" || unit == "quarter") {
|
||||||
|
if (tickSize < 1) {
|
||||||
|
|
||||||
|
// a bit complicated - we'll divide the
|
||||||
|
// month/quarter up but we need to take
|
||||||
|
// care of fractions so we don't end up in
|
||||||
|
// the middle of a day
|
||||||
|
|
||||||
|
d.setDate(1);
|
||||||
|
var start = d.getTime();
|
||||||
|
d.setMonth(d.getMonth() +
|
||||||
|
(unit == "quarter" ? 3 : 1));
|
||||||
|
var end = d.getTime();
|
||||||
|
d.setTime(v + carry * timeUnitSize.hour + (end - start) * tickSize);
|
||||||
|
carry = d.getHours();
|
||||||
|
d.setHours(0);
|
||||||
|
} else {
|
||||||
|
d.setMonth(d.getMonth() +
|
||||||
|
tickSize * (unit == "quarter" ? 3 : 1));
|
||||||
|
}
|
||||||
|
} else if (unit == "year") {
|
||||||
|
d.setFullYear(d.getFullYear() + tickSize);
|
||||||
|
} else {
|
||||||
|
d.setTime(v + step);
|
||||||
|
}
|
||||||
|
} while (v < axis.max && v != prev);
|
||||||
|
|
||||||
|
return ticks;
|
||||||
|
};
|
||||||
|
|
||||||
|
axis.tickFormatter = function (v, axis) {
|
||||||
|
|
||||||
|
var d = dateGenerator(v, axis.options);
|
||||||
|
|
||||||
|
// first check global format
|
||||||
|
|
||||||
|
if (opts.timeformat != null) {
|
||||||
|
return formatDate(d, opts.timeformat, opts.monthNames, opts.dayNames);
|
||||||
|
}
|
||||||
|
|
||||||
|
// possibly use quarters if quarters are mentioned in
|
||||||
|
// any of these places
|
||||||
|
|
||||||
|
var useQuarters = (axis.options.tickSize &&
|
||||||
|
axis.options.tickSize[1] == "quarter") ||
|
||||||
|
(axis.options.minTickSize &&
|
||||||
|
axis.options.minTickSize[1] == "quarter");
|
||||||
|
|
||||||
|
var t = axis.tickSize[0] * timeUnitSize[axis.tickSize[1]];
|
||||||
|
var span = axis.max - axis.min;
|
||||||
|
var suffix = (opts.twelveHourClock) ? " %p" : "";
|
||||||
|
var hourCode = (opts.twelveHourClock) ? "%I" : "%H";
|
||||||
|
var fmt;
|
||||||
|
|
||||||
|
if (t < timeUnitSize.minute) {
|
||||||
|
fmt = hourCode + ":%M:%S" + suffix;
|
||||||
|
} else if (t < timeUnitSize.day) {
|
||||||
|
if (span < 2 * timeUnitSize.day) {
|
||||||
|
fmt = hourCode + ":%M" + suffix;
|
||||||
|
} else {
|
||||||
|
fmt = "%b %d " + hourCode + ":%M" + suffix;
|
||||||
|
}
|
||||||
|
} else if (t < timeUnitSize.month) {
|
||||||
|
fmt = "%b %d";
|
||||||
|
} else if ((useQuarters && t < timeUnitSize.quarter) ||
|
||||||
|
(!useQuarters && t < timeUnitSize.year)) {
|
||||||
|
if (span < timeUnitSize.year) {
|
||||||
|
fmt = "%b";
|
||||||
|
} else {
|
||||||
|
fmt = "%b %Y";
|
||||||
|
}
|
||||||
|
} else if (useQuarters && t < timeUnitSize.year) {
|
||||||
|
if (span < timeUnitSize.year) {
|
||||||
|
fmt = "Q%q";
|
||||||
|
} else {
|
||||||
|
fmt = "Q%q %Y";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
fmt = "%Y";
|
||||||
|
}
|
||||||
|
|
||||||
|
var rt = formatDate(d, fmt, opts.monthNames, opts.dayNames);
|
||||||
|
|
||||||
|
return rt;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
$.plot.plugins.push({
|
||||||
|
init: init,
|
||||||
|
options: options,
|
||||||
|
name: 'time',
|
||||||
|
version: '1.0'
|
||||||
|
});
|
||||||
|
|
||||||
|
// Time-axis support used to be in Flot core, which exposed the
|
||||||
|
// formatDate function on the plot object. Various plugins depend
|
||||||
|
// on the function, so we need to re-expose it here.
|
||||||
|
|
||||||
|
$.plot.formatDate = formatDate;
|
||||||
|
$.plot.dateGenerator = dateGenerator;
|
||||||
|
|
||||||
|
})(jQuery);
|
||||||
|
|
||||||
|
var ws = null;
|
||||||
|
var connected = false;
|
||||||
|
|
||||||
|
$(document).ready(function() {
|
||||||
|
var startTime = Date.now();
|
||||||
|
var graphDurationSeconds = 30;
|
||||||
|
|
||||||
|
// Initialize graph
|
||||||
|
var createGraph = function(title) {
|
||||||
|
var $c = $('<div class="graph"/>').appendTo('#graphs');
|
||||||
|
var past = Date.now() - graphDurationSeconds * 1000;
|
||||||
|
var options = {
|
||||||
|
lines: {
|
||||||
|
xfill: true,
|
||||||
|
lineWidth: 1,
|
||||||
|
xfillColor: {colors: [ { opacity: 0 }, { opacity: 1 } ] }
|
||||||
|
},
|
||||||
|
grid: { borderWidth: 1, borderColor: '#ccc'},
|
||||||
|
xaxis: { mode: 'time', ticks: 5 },
|
||||||
|
legend: { labelBoxBorderColor: '#fff' },
|
||||||
|
xcolors: [ '#fec', '#396', '#e39', '#9e2' ],
|
||||||
|
hooks: {
|
||||||
|
draw: [function(plot, canvas) {
|
||||||
|
canvas.font = '15px sans-serif';
|
||||||
|
canvas.fillStyle = '#999';
|
||||||
|
canvas.fillText(title, 35, 25);
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
};
|
||||||
|
return $.plot($c, [], options);
|
||||||
|
};
|
||||||
|
|
||||||
|
var updateGraph = function(g) {
|
||||||
|
if (!connected) return;
|
||||||
|
var now = Date.now();
|
||||||
|
//if (now - g.lastUpdateTime < 50) return;
|
||||||
|
g.lastUpdateTime = now;
|
||||||
|
var oldest = now - graphDurationSeconds * 1000;
|
||||||
|
g.data[0].data = [[oldest, null], [now, null]];
|
||||||
|
|
||||||
|
// Remove old points
|
||||||
|
$.each(g.data, function(di, d) {
|
||||||
|
while (d.data.length > 0 && d.data[0][0] < oldest) {
|
||||||
|
d.data.shift();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
g.plot.setData(g.data);
|
||||||
|
g.plot.setupGrid();
|
||||||
|
g.plot.draw();
|
||||||
|
};
|
||||||
|
|
||||||
|
var graphs = {
|
||||||
|
led: {
|
||||||
|
title: 'LED state',
|
||||||
|
plot: null,
|
||||||
|
lastUpdateTime: null,
|
||||||
|
data: [
|
||||||
|
{ show: false, data: [] },
|
||||||
|
{ label: "LED state", color: '#36c', data: [] },
|
||||||
|
]
|
||||||
|
},
|
||||||
|
accel: {
|
||||||
|
title: 'Accelerometer',
|
||||||
|
plot: null,
|
||||||
|
lastUpdateTime: null,
|
||||||
|
data: [
|
||||||
|
{ show: false, data: [] },
|
||||||
|
{ label: "x", color: '#f00', data: [] },
|
||||||
|
{ label: "y", color: '#0f0', data: [] },
|
||||||
|
{ label: "z", color: '#00f', data: [] },
|
||||||
|
]
|
||||||
|
},
|
||||||
|
temp: {
|
||||||
|
title: 'Sensor die temperature',
|
||||||
|
plot: null,
|
||||||
|
lastUpdateTime: null,
|
||||||
|
data: [
|
||||||
|
{ show: false, data: [] },
|
||||||
|
{ label: 'Celsius', color: '#36c', data: []},
|
||||||
|
]
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
$.each(graphs, function(k, v) {
|
||||||
|
v.plot = createGraph(v.title);
|
||||||
|
setInterval(function() { updateGraph(v); }, 100);
|
||||||
|
});
|
||||||
|
|
||||||
|
function wsConnect() {
|
||||||
|
if (ws != null) return;
|
||||||
|
var wsAddr = 'ws://' + location.host;
|
||||||
|
console.log('Connecting to', wsAddr);
|
||||||
|
ws = new WebSocket(wsAddr);
|
||||||
|
ws.onopen = function() {
|
||||||
|
console.log('Connected');
|
||||||
|
connected = true;
|
||||||
|
};
|
||||||
|
ws.onclose = function() {
|
||||||
|
console.log('Disconnected');
|
||||||
|
connected = false;
|
||||||
|
ws = null;
|
||||||
|
};
|
||||||
|
ws.onmessage = handleWsMessage;
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleWsMessage(ev) {
|
||||||
|
try {
|
||||||
|
var obj = JSON.parse(ev.data);
|
||||||
|
//var timestamp = startTime + parseInt(obj.ts * 1000);
|
||||||
|
var timestamp = Date.now();
|
||||||
|
|
||||||
|
if (obj.t == 0) {
|
||||||
|
graphs.temp.data[1].data.push([timestamp, obj.dt]);
|
||||||
|
updateGraph(graphs.temp);
|
||||||
|
} else if (obj.t == 1) {
|
||||||
|
graphs.led.data[1].data.push([timestamp, obj.v]);
|
||||||
|
updateGraph(graphs.led);
|
||||||
|
} else if (obj.t == 2) {
|
||||||
|
graphs.accel.data[1].data.push([timestamp, obj.x]);
|
||||||
|
graphs.accel.data[2].data.push([timestamp, obj.y]);
|
||||||
|
graphs.accel.data[3].data.push([timestamp, obj.z]);
|
||||||
|
updateGraph(graphs.accel);
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.log(e, ev.data);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
$(document).on('click', '#on_off_button', function() {
|
||||||
|
var state = $(this).text().match(/off/) ? 0 : 1;
|
||||||
|
$(this).text(state ? 'Switch LED off' : 'Switch LED on');
|
||||||
|
ws.send(JSON.stringify({ t: 1, v: state }));
|
||||||
|
});
|
||||||
|
|
||||||
|
wsConnect();
|
||||||
|
setInterval(wsConnect, 1000);
|
||||||
|
});
|
||||||
+57
-7
@@ -1,15 +1,21 @@
|
|||||||
#include "wifi.h"
|
#include "wifi.h"
|
||||||
|
|
||||||
#include "mongoose.h"
|
#include "mongoose.h"
|
||||||
#include "simplelink.h"
|
|
||||||
#include "wlan.h"
|
|
||||||
|
|
||||||
#include "gpio_if.h"
|
#include <simplelink/cc_pal.h>
|
||||||
|
#include <simplelink/include/wlan.h>
|
||||||
|
|
||||||
|
#include <inc/hw_types.h>
|
||||||
|
|
||||||
|
#include <driverlib/gpio.h>
|
||||||
|
#include <driverlib/utils.h>
|
||||||
|
|
||||||
|
#include <example/common/gpio_if.h>
|
||||||
|
|
||||||
void SimpleLinkWlanEventHandler(SlWlanEvent_t *e) {
|
void SimpleLinkWlanEventHandler(SlWlanEvent_t *e) {
|
||||||
switch (e->Event) {
|
switch (e->Event) {
|
||||||
case SL_WLAN_CONNECT_EVENT:
|
case SL_WLAN_CONNECT_EVENT:
|
||||||
LOG(LL_INFO, ("WiFi: connected"));
|
LOG(LL_INFO, ("WiFi: connected, getting IP"));
|
||||||
break;
|
break;
|
||||||
case SL_WLAN_STA_CONNECTED_EVENT:
|
case SL_WLAN_STA_CONNECTED_EVENT:
|
||||||
LOG(LL_INFO, ("WiFi: station connected"));
|
LOG(LL_INFO, ("WiFi: station connected"));
|
||||||
@@ -22,8 +28,6 @@ void SimpleLinkWlanEventHandler(SlWlanEvent_t *e) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int ip_acquired = 0;
|
|
||||||
|
|
||||||
void SimpleLinkNetAppEventHandler(SlNetAppEvent_t *e) {
|
void SimpleLinkNetAppEventHandler(SlNetAppEvent_t *e) {
|
||||||
if (e->Event == SL_NETAPP_IPV4_IPACQUIRED_EVENT) {
|
if (e->Event == SL_NETAPP_IPV4_IPACQUIRED_EVENT) {
|
||||||
SlIpV4AcquiredAsync_t *ed = &e->EventData.ipAcquiredV4;
|
SlIpV4AcquiredAsync_t *ed = &e->EventData.ipAcquiredV4;
|
||||||
@@ -31,7 +35,6 @@ void SimpleLinkNetAppEventHandler(SlNetAppEvent_t *e) {
|
|||||||
SL_IPV4_BYTE(ed->ip, 2), SL_IPV4_BYTE(ed->ip, 1),
|
SL_IPV4_BYTE(ed->ip, 2), SL_IPV4_BYTE(ed->ip, 1),
|
||||||
SL_IPV4_BYTE(ed->ip, 0)));
|
SL_IPV4_BYTE(ed->ip, 0)));
|
||||||
GPIO_IF_LedToggle(MCU_RED_LED_GPIO);
|
GPIO_IF_LedToggle(MCU_RED_LED_GPIO);
|
||||||
ip_acquired = 1;
|
|
||||||
} else if (e->Event == SL_NETAPP_IP_LEASED_EVENT) {
|
} else if (e->Event == SL_NETAPP_IP_LEASED_EVENT) {
|
||||||
LOG(LL_INFO, ("IP leased"));
|
LOG(LL_INFO, ("IP leased"));
|
||||||
} else {
|
} else {
|
||||||
@@ -113,3 +116,50 @@ bool wifi_setup_sta(const char *ssid, const char *pass) {
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* In SDK 1.2.0 TI decided to stop resetting NWP before sl_Start, which in
|
||||||
|
* practice means that sl_start will hang on subsequent runs after the first.
|
||||||
|
*
|
||||||
|
* See this post for details and suggested solution:
|
||||||
|
* https://e2e.ti.com/support/wireless_connectivity/simplelink_wifi_cc31xx_cc32xx/f/968/p/499123/1806610#1806610
|
||||||
|
*
|
||||||
|
* However, since they don't provide OS_debug variant of simplelink.a and
|
||||||
|
* adding another project dependency will complicate our demo even more,
|
||||||
|
* we just take the required bit of code.
|
||||||
|
*
|
||||||
|
* This is a copy-paste of NwpPowerOnPreamble from cc_pal.c.
|
||||||
|
*/
|
||||||
|
void stop_nwp(void) {
|
||||||
|
#define MAX_RETRY_COUNT 1000
|
||||||
|
unsigned int sl_stop_ind, apps_int_sts_raw, nwp_lpds_wake_cfg;
|
||||||
|
unsigned int retry_count;
|
||||||
|
/* Perform the sl_stop equivalent to ensure network services
|
||||||
|
are turned off if active */
|
||||||
|
HWREG(0x400F70B8) = 1; /* APPs to NWP interrupt */
|
||||||
|
UtilsDelay(800000 / 5);
|
||||||
|
|
||||||
|
retry_count = 0;
|
||||||
|
nwp_lpds_wake_cfg = HWREG(0x4402D404);
|
||||||
|
sl_stop_ind = HWREG(0x4402E16C);
|
||||||
|
|
||||||
|
if ((nwp_lpds_wake_cfg != 0x20) && /* Check for NWP POR condition */
|
||||||
|
!(sl_stop_ind & 0x2)) /* Check if sl_stop was executed */
|
||||||
|
{
|
||||||
|
/* Loop until APPs->NWP interrupt is cleared or timeout */
|
||||||
|
while (retry_count < MAX_RETRY_COUNT) {
|
||||||
|
apps_int_sts_raw = HWREG(0x400F70C0);
|
||||||
|
if (apps_int_sts_raw & 0x1) {
|
||||||
|
UtilsDelay(800000 / 5);
|
||||||
|
retry_count++;
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
HWREG(0x400F70B0) = 1; /* Clear APPs to NWP interrupt */
|
||||||
|
UtilsDelay(800000 / 5);
|
||||||
|
|
||||||
|
/* Stop the networking services */
|
||||||
|
NwpPowerOff();
|
||||||
|
}
|
||||||
@@ -10,5 +10,6 @@
|
|||||||
|
|
||||||
bool wifi_setup_ap(const char *ssid, const char *pass, int channel);
|
bool wifi_setup_ap(const char *ssid, const char *pass, int channel);
|
||||||
bool wifi_setup_sta(const char *ssid, const char *pass);
|
bool wifi_setup_sta(const char *ssid, const char *pass);
|
||||||
|
void stop_nwp();
|
||||||
|
|
||||||
#endif /* CS_MONGOOSE_EXAMPLES_CC3200_WIFI_H_ */
|
#endif /* CS_MONGOOSE_EXAMPLES_CC3200_WIFI_H_ */
|
||||||
@@ -29,7 +29,7 @@ _ssize_t _write_r(struct _reent *r, int fd, void *buf, size_t len) {
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* You'll need to implement _open_r and friends if you want file operations. See
|
* You'll need to implement _open_r and friends if you want file operations. See
|
||||||
* https://github.com/cesanta/smart.js/blob/master/platforms/esp8266/user/esp_fs.c
|
* https://github.com/cesanta/mongoose-iot/blob/master/fw/platforms/esp8266/user/esp_fs.c
|
||||||
* for SPIFFS-based implementation.
|
* for SPIFFS-based implementation.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@@ -70,7 +70,9 @@
|
|||||||
<option id="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compilerID.LITTLE_ENDIAN.1189300180" name="Little endian code [See 'General' page to edit] (--little_endian, -me)" superClass="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compilerID.LITTLE_ENDIAN" value="true" valueType="boolean"/>
|
<option id="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compilerID.LITTLE_ENDIAN.1189300180" name="Little endian code [See 'General' page to edit] (--little_endian, -me)" superClass="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compilerID.LITTLE_ENDIAN" value="true" valueType="boolean"/>
|
||||||
<option id="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compilerID.ADVICE__POWER_SEVERITY.1104211376" name="Set error category for ULP power rules (--advice:power_severity)" superClass="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compilerID.ADVICE__POWER_SEVERITY" value="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compilerID.ADVICE__POWER_SEVERITY.suppress" valueType="enumerated"/>
|
<option id="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compilerID.ADVICE__POWER_SEVERITY.1104211376" name="Set error category for ULP power rules (--advice:power_severity)" superClass="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compilerID.ADVICE__POWER_SEVERITY" value="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compilerID.ADVICE__POWER_SEVERITY.suppress" valueType="enumerated"/>
|
||||||
<option id="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compilerID.GEN_FUNC_SUBSECTIONS.716853038" name="Place each function in a separate subsection (--gen_func_subsections, -ms)" superClass="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compilerID.GEN_FUNC_SUBSECTIONS" value="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compilerID.GEN_FUNC_SUBSECTIONS.on" valueType="enumerated"/>
|
<option id="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compilerID.GEN_FUNC_SUBSECTIONS.716853038" name="Place each function in a separate subsection (--gen_func_subsections, -ms)" superClass="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compilerID.GEN_FUNC_SUBSECTIONS" value="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compilerID.GEN_FUNC_SUBSECTIONS.on" valueType="enumerated"/>
|
||||||
<option id="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compilerID.C_DIALECT.1816905062" superClass="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compilerID.C_DIALECT" value="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compilerID.C_DIALECT.C99" valueType="enumerated"/>
|
<option id="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compilerID.C_DIALECT.1816905062" name="C Dialect" superClass="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compilerID.C_DIALECT" value="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compilerID.C_DIALECT.C99" valueType="enumerated"/>
|
||||||
|
<option id="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compilerID.OPT_LEVEL.1322192402" superClass="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compilerID.OPT_LEVEL" value="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compilerID.OPT_LEVEL.4" valueType="enumerated"/>
|
||||||
|
<option id="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compilerID.OPT_FOR_SPEED.2121942912" superClass="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compilerID.OPT_FOR_SPEED" value="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compilerID.OPT_FOR_SPEED.0" valueType="enumerated"/>
|
||||||
<inputType id="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compiler.inputType__C_SRCS.1163073582" name="C Sources" superClass="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compiler.inputType__C_SRCS"/>
|
<inputType id="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compiler.inputType__C_SRCS.1163073582" name="C Sources" superClass="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compiler.inputType__C_SRCS"/>
|
||||||
<inputType id="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compiler.inputType__CPP_SRCS.147603670" name="C++ Sources" superClass="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compiler.inputType__CPP_SRCS"/>
|
<inputType id="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compiler.inputType__CPP_SRCS.147603670" name="C++ Sources" superClass="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compiler.inputType__CPP_SRCS"/>
|
||||||
<inputType id="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compiler.inputType__ASM_SRCS.145022476" name="Assembly Sources" superClass="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compiler.inputType__ASM_SRCS"/>
|
<inputType id="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compiler.inputType__ASM_SRCS.145022476" name="Assembly Sources" superClass="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compiler.inputType__ASM_SRCS"/>
|
||||||
@@ -194,6 +196,8 @@
|
|||||||
<option id="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compilerID.ADVICE__POWER_SEVERITY.350731145" name="Set error category for ULP power rules (--advice:power_severity)" superClass="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compilerID.ADVICE__POWER_SEVERITY" value="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compilerID.ADVICE__POWER_SEVERITY.suppress" valueType="enumerated"/>
|
<option id="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compilerID.ADVICE__POWER_SEVERITY.350731145" name="Set error category for ULP power rules (--advice:power_severity)" superClass="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compilerID.ADVICE__POWER_SEVERITY" value="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compilerID.ADVICE__POWER_SEVERITY.suppress" valueType="enumerated"/>
|
||||||
<option id="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compilerID.DEBUGGING_MODEL.1651881817" name="Debugging model" superClass="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compilerID.DEBUGGING_MODEL" value="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compilerID.DEBUGGING_MODEL.SYMDEBUG__DWARF" valueType="enumerated"/>
|
<option id="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compilerID.DEBUGGING_MODEL.1651881817" name="Debugging model" superClass="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compilerID.DEBUGGING_MODEL" value="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compilerID.DEBUGGING_MODEL.SYMDEBUG__DWARF" valueType="enumerated"/>
|
||||||
<option id="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compilerID.GEN_FUNC_SUBSECTIONS.1299449598" name="Place each function in a separate subsection (--gen_func_subsections, -ms)" superClass="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compilerID.GEN_FUNC_SUBSECTIONS" value="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compilerID.GEN_FUNC_SUBSECTIONS.on" valueType="enumerated"/>
|
<option id="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compilerID.GEN_FUNC_SUBSECTIONS.1299449598" name="Place each function in a separate subsection (--gen_func_subsections, -ms)" superClass="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compilerID.GEN_FUNC_SUBSECTIONS" value="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compilerID.GEN_FUNC_SUBSECTIONS.on" valueType="enumerated"/>
|
||||||
|
<option id="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compilerID.OPT_FOR_SPEED.1661888405" name="Speed vs. size trade-offs (--opt_for_speed, -mf)" superClass="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compilerID.OPT_FOR_SPEED" value="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compilerID.OPT_FOR_SPEED.0" valueType="enumerated"/>
|
||||||
|
<option id="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compilerID.OPT_LEVEL.release.728484093" name="Optimization level (--opt_level, -O)" superClass="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compilerID.OPT_LEVEL.release" value="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compilerID.OPT_LEVEL.4" valueType="enumerated"/>
|
||||||
<inputType id="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compiler.inputType__C_SRCS.1687182342" name="C Sources" superClass="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compiler.inputType__C_SRCS"/>
|
<inputType id="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compiler.inputType__C_SRCS.1687182342" name="C Sources" superClass="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compiler.inputType__C_SRCS"/>
|
||||||
<inputType id="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compiler.inputType__CPP_SRCS.1421282679" name="C++ Sources" superClass="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compiler.inputType__CPP_SRCS"/>
|
<inputType id="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compiler.inputType__CPP_SRCS.1421282679" name="C++ Sources" superClass="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compiler.inputType__CPP_SRCS"/>
|
||||||
<inputType id="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compiler.inputType__ASM_SRCS.1396461343" name="Assembly Sources" superClass="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compiler.inputType__ASM_SRCS"/>
|
<inputType id="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compiler.inputType__ASM_SRCS.1396461343" name="Assembly Sources" superClass="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compiler.inputType__ASM_SRCS"/>
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
/* clang-format off */
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2015, Texas Instruments Incorporated
|
* Copyright (c) 2015, Texas Instruments Incorporated
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
@@ -30,8 +31,8 @@
|
|||||||
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __BOARD_H
|
#ifndef CS_MONGOOSE_EXAMPLES_MSP432_CCS_MG_HELLO_BOARD_H_
|
||||||
#define __BOARD_H
|
#define CS_MONGOOSE_EXAMPLES_MSP432_CCS_MG_HELLO_BOARD_H_
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@@ -96,4 +97,4 @@ extern "C" {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* __BOARD_H */
|
#endif /* CS_MONGOOSE_EXAMPLES_MSP432_CCS_MG_HELLO_BOARD_H_ */
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
/* clang-format off */
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2015-2016, Texas Instruments Incorporated
|
* Copyright (c) 2015-2016, Texas Instruments Incorporated
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
/* clang-format off */
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2015, Texas Instruments Incorporated
|
* Copyright (c) 2015, Texas Instruments Incorporated
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
@@ -42,8 +43,8 @@
|
|||||||
*
|
*
|
||||||
* ============================================================================
|
* ============================================================================
|
||||||
*/
|
*/
|
||||||
#ifndef __MSP_EXP432P401R_H
|
#ifndef CS_MONGOOSE_EXAMPLES_MSP432_CCS_MG_HELLO_MSP_EXP432P401R_H_
|
||||||
#define __MSP_EXP432P401R_H
|
#define CS_MONGOOSE_EXAMPLES_MSP432_CCS_MG_HELLO_MSP_EXP432P401R_H_
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@@ -249,4 +250,4 @@ extern void MSP_EXP432P401R_initWiFi(void);
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* __MSP_EXP432P401R_H */
|
#endif /* CS_MONGOOSE_EXAMPLES_MSP432_CCS_MG_HELLO_MSP_EXP432P401R_H_ */
|
||||||
@@ -7,8 +7,8 @@
|
|||||||
#define WIFI_AP_SSID "Mongoose"
|
#define WIFI_AP_SSID "Mongoose"
|
||||||
#define WIFI_AP_PASS ""
|
#define WIFI_AP_PASS ""
|
||||||
#define WIFI_AP_CHAN 6
|
#define WIFI_AP_CHAN 6
|
||||||
//#define WIFI_STA_SSID "YourWiFi"
|
// #define WIFI_STA_SSID "YourWiFi"
|
||||||
//#define WIFI_STA_PASS "YourPass"
|
// #define WIFI_STA_PASS "YourPass"
|
||||||
|
|
||||||
#define MG_TASK_PRIORITY 3
|
#define MG_TASK_PRIORITY 3
|
||||||
#define MG_TASK_STACK_SIZE 8192
|
#define MG_TASK_STACK_SIZE 8192
|
||||||
@@ -37,14 +37,26 @@
|
|||||||
|
|
||||||
#include "wifi.h"
|
#include "wifi.h"
|
||||||
|
|
||||||
void mg_ev_handler(struct mg_connection *nc, int ev, void *p) {
|
static const char *upload_form =
|
||||||
static const char *reply_fmt =
|
"\
|
||||||
"HTTP/1.0 200 OK\r\n"
|
<h1>Upload file</h1> \
|
||||||
"Connection: close\r\n"
|
<form action='/upload' method='POST' enctype='multipart/form-data'> \
|
||||||
"Content-Type: text/plain\r\n"
|
<input type='file' name='file'> \
|
||||||
"\r\n"
|
<input type='submit' value='Upload'> \
|
||||||
"Hello %s\n";
|
</form>";
|
||||||
LOG(LL_DEBUG, ("conn %p ev %d", nc, ev));
|
|
||||||
|
static struct mg_str upload_fname(struct mg_connection *nc,
|
||||||
|
struct mg_str fname) {
|
||||||
|
struct mg_str lfn;
|
||||||
|
lfn.len = fname.len + 3;
|
||||||
|
lfn.p = malloc(lfn.len);
|
||||||
|
memcpy((char *) lfn.p, "SL:", 3);
|
||||||
|
memcpy((char *) lfn.p + 3, fname.p, fname.len);
|
||||||
|
return lfn;
|
||||||
|
}
|
||||||
|
|
||||||
|
void mg_ev_handler(struct mg_connection *nc, int ev, void *ev_data) {
|
||||||
|
LOG(LL_DEBUG, ("%p ev %d", nc, ev));
|
||||||
|
|
||||||
switch (ev) {
|
switch (ev) {
|
||||||
case MG_EV_ACCEPT: {
|
case MG_EV_ACCEPT: {
|
||||||
@@ -56,26 +68,47 @@ void mg_ev_handler(struct mg_connection *nc, int ev, void *p) {
|
|||||||
}
|
}
|
||||||
case MG_EV_HTTP_REQUEST: {
|
case MG_EV_HTTP_REQUEST: {
|
||||||
char addr[32];
|
char addr[32];
|
||||||
struct http_message *hm = (struct http_message *) p;
|
struct http_message *hm = (struct http_message *) ev_data;
|
||||||
|
cs_stat_t st;
|
||||||
mg_sock_addr_to_str(&nc->sa, addr, sizeof(addr),
|
mg_sock_addr_to_str(&nc->sa, addr, sizeof(addr),
|
||||||
MG_SOCK_STRINGIFY_IP | MG_SOCK_STRINGIFY_PORT);
|
MG_SOCK_STRINGIFY_IP | MG_SOCK_STRINGIFY_PORT);
|
||||||
LOG(LL_INFO,
|
LOG(LL_INFO,
|
||||||
("HTTP request from %s: %.*s %.*s", addr, (int) hm->method.len,
|
("HTTP request from %s: %.*s %.*s", addr, (int) hm->method.len,
|
||||||
hm->method.p, (int) hm->uri.len, hm->uri.p));
|
hm->method.p, (int) hm->uri.len, hm->uri.p));
|
||||||
mg_printf(nc, reply_fmt, addr);
|
if (mg_vcmp(&hm->uri, "/upload") == 0 ||
|
||||||
nc->flags |= MG_F_SEND_AND_CLOSE;
|
(mg_vcmp(&hm->uri, "/") == 0 && mg_stat("SL:index.html", &st) != 0)) {
|
||||||
|
mg_send(nc, upload_form, strlen(upload_form));
|
||||||
|
nc->flags |= MG_F_SEND_AND_CLOSE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
struct mg_serve_http_opts opts;
|
||||||
|
memset(&opts, 0, sizeof(opts));
|
||||||
|
opts.document_root = "SL:";
|
||||||
|
mg_serve_http(nc, hm, opts);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case MG_EV_CLOSE: {
|
case MG_EV_CLOSE: {
|
||||||
LOG(LL_INFO, ("Connection %p closed", nc));
|
LOG(LL_INFO, ("Connection %p closed", nc));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case MG_EV_HTTP_PART_BEGIN:
|
||||||
|
case MG_EV_HTTP_PART_DATA:
|
||||||
|
case MG_EV_HTTP_PART_END: {
|
||||||
|
struct mg_http_multipart_part *mp =
|
||||||
|
(struct mg_http_multipart_part *) ev_data;
|
||||||
|
if (ev == MG_EV_HTTP_PART_BEGIN) {
|
||||||
|
LOG(LL_INFO, ("Begin file upload: %s", mp->file_name));
|
||||||
|
} else if (ev == MG_EV_HTTP_PART_END) {
|
||||||
|
LOG(LL_INFO, ("End file upload: %s", mp->file_name));
|
||||||
|
}
|
||||||
|
mg_file_upload_handler(nc, ev, ev_data, upload_fname);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void mg_init(struct mg_mgr *mgr) {
|
static void mg_init(struct mg_mgr *mgr) {
|
||||||
WiFi_Params wifiParams;
|
WiFi_Params wifiParams;
|
||||||
WiFi_Handle handle;
|
WiFi_Handle handle;
|
||||||
|
|
||||||
LOG(LL_INFO, ("MG task running"));
|
LOG(LL_INFO, ("MG task running"));
|
||||||
|
|
||||||
@@ -120,25 +153,23 @@ static void mg_init(struct mg_mgr *mgr) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int main(void) {
|
int main(void) {
|
||||||
Board_initGeneral();
|
Board_initGeneral();
|
||||||
Board_initGPIO();
|
Board_initGPIO();
|
||||||
Board_initWiFi();
|
Board_initWiFi();
|
||||||
|
|
||||||
setvbuf(stdout, NULL, _IOLBF, 0);
|
setvbuf(stdout, NULL, _IOLBF, 0);
|
||||||
setvbuf(stderr, NULL, _IOLBF, 0);
|
setvbuf(stderr, NULL, _IOLBF, 0);
|
||||||
cs_log_set_level(LL_INFO);
|
cs_log_set_level(LL_INFO);
|
||||||
cs_log_set_file(stdout);
|
cs_log_set_file(stdout);
|
||||||
|
|
||||||
if (!mg_start_task(MG_TASK_PRIORITY, MG_TASK_STACK_SIZE, mg_init)) {
|
if (!mg_start_task(MG_TASK_PRIORITY, MG_TASK_STACK_SIZE, mg_init)) {
|
||||||
LOG(LL_ERROR, ("Error starting Mongoose task"));
|
LOG(LL_ERROR, ("Error starting Mongoose task"));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG(LL_INFO, ("OK"));
|
osi_start();
|
||||||
|
|
||||||
osi_start();
|
return 0;
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SimpleLinkHttpServerCallback(SlHttpServerEvent_t *e,
|
void SimpleLinkHttpServerCallback(SlHttpServerEvent_t *e,
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
void SimpleLinkWlanEventHandler(SlWlanEvent_t *e) {
|
void SimpleLinkWlanEventHandler(SlWlanEvent_t *e) {
|
||||||
switch (e->Event) {
|
switch (e->Event) {
|
||||||
case SL_WLAN_CONNECT_EVENT:
|
case SL_WLAN_CONNECT_EVENT:
|
||||||
LOG(LL_INFO, ("WiFi: connected"));
|
LOG(LL_INFO, ("WiFi: connected, getting IP"));
|
||||||
break;
|
break;
|
||||||
case SL_WLAN_STA_CONNECTED_EVENT:
|
case SL_WLAN_STA_CONNECTED_EVENT:
|
||||||
LOG(LL_INFO, ("WiFi: station connected"));
|
LOG(LL_INFO, ("WiFi: station connected"));
|
||||||
@@ -88,8 +88,8 @@ bool wifi_setup_ap(const char *ssid, const char *pass, int channel) {
|
|||||||
sl_Stop(0);
|
sl_Stop(0);
|
||||||
int role = sl_Start(NULL, NULL, NULL);
|
int role = sl_Start(NULL, NULL, NULL);
|
||||||
if (role != ROLE_AP) {
|
if (role != ROLE_AP) {
|
||||||
LOG(LL_ERROR, ("Expected ROLE_AP (%d), got %d", ROLE_AP, role));
|
LOG(LL_ERROR, ("Expected ROLE_AP (%d), got %d", ROLE_AP, role));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (sl_NetAppStart(SL_NET_APP_DHCP_SERVER_ID) != 0) {
|
if (sl_NetAppStart(SL_NET_APP_DHCP_SERVER_ID) != 0) {
|
||||||
LOG(LL_ERROR, ("DHCP server failed to start"));
|
LOG(LL_ERROR, ("DHCP server failed to start"));
|
||||||
|
|||||||
@@ -3,12 +3,12 @@
|
|||||||
* All rights reserved
|
* All rights reserved
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef CS_MONGOOSE_EXAMPLES_CC3200_WIFI_H_
|
#ifndef CS_MONGOOSE_EXAMPLES_MSP432_CCS_MG_HELLO_WIFI_H_
|
||||||
#define CS_MONGOOSE_EXAMPLES_CC3200_WIFI_H_
|
#define CS_MONGOOSE_EXAMPLES_MSP432_CCS_MG_HELLO_WIFI_H_
|
||||||
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|
||||||
bool wifi_setup_ap(const char *ssid, const char *pass, int channel);
|
bool wifi_setup_ap(const char *ssid, const char *pass, int channel);
|
||||||
bool wifi_setup_sta(const char *ssid, const char *pass);
|
bool wifi_setup_sta(const char *ssid, const char *pass);
|
||||||
|
|
||||||
#endif /* CS_MONGOOSE_EXAMPLES_CC3200_WIFI_H_ */
|
#endif /* CS_MONGOOSE_EXAMPLES_MSP432_CCS_MG_HELLO_WIFI_H_ */
|
||||||
@@ -59,6 +59,8 @@
|
|||||||
<option id="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compilerID.LITTLE_ENDIAN.214103179" name="Little endian code [See 'General' page to edit] (--little_endian, -me)" superClass="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compilerID.LITTLE_ENDIAN" value="true" valueType="boolean"/>
|
<option id="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compilerID.LITTLE_ENDIAN.214103179" name="Little endian code [See 'General' page to edit] (--little_endian, -me)" superClass="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compilerID.LITTLE_ENDIAN" value="true" valueType="boolean"/>
|
||||||
<option id="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compilerID.C_DIALECT.1039008667" name="C Dialect" superClass="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compilerID.C_DIALECT" value="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compilerID.C_DIALECT.C99" valueType="enumerated"/>
|
<option id="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compilerID.C_DIALECT.1039008667" name="C Dialect" superClass="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compilerID.C_DIALECT" value="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compilerID.C_DIALECT.C99" valueType="enumerated"/>
|
||||||
<option id="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compilerID.ADVICE__POWER_SEVERITY.1561332826" name="Set error category for ULP power rules (--advice:power_severity)" superClass="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compilerID.ADVICE__POWER_SEVERITY" value="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compilerID.ADVICE__POWER_SEVERITY.suppress" valueType="enumerated"/>
|
<option id="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compilerID.ADVICE__POWER_SEVERITY.1561332826" name="Set error category for ULP power rules (--advice:power_severity)" superClass="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compilerID.ADVICE__POWER_SEVERITY" value="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compilerID.ADVICE__POWER_SEVERITY.suppress" valueType="enumerated"/>
|
||||||
|
<option id="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compilerID.OPT_LEVEL.2024463240" name="Optimization level (--opt_level, -O)" superClass="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compilerID.OPT_LEVEL" value="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compilerID.OPT_LEVEL.4" valueType="enumerated"/>
|
||||||
|
<option id="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compilerID.OPT_FOR_SPEED.1323389945" name="Speed vs. size trade-offs (--opt_for_speed, -mf)" superClass="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compilerID.OPT_FOR_SPEED" value="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compilerID.OPT_FOR_SPEED.0" valueType="enumerated"/>
|
||||||
<inputType id="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compiler.inputType__C_SRCS.640783361" name="C Sources" superClass="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compiler.inputType__C_SRCS"/>
|
<inputType id="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compiler.inputType__C_SRCS.640783361" name="C Sources" superClass="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compiler.inputType__C_SRCS"/>
|
||||||
<inputType id="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compiler.inputType__CPP_SRCS.1558463740" name="C++ Sources" superClass="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compiler.inputType__CPP_SRCS"/>
|
<inputType id="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compiler.inputType__CPP_SRCS.1558463740" name="C++ Sources" superClass="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compiler.inputType__CPP_SRCS"/>
|
||||||
<inputType id="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compiler.inputType__ASM_SRCS.1443539078" name="Assembly Sources" superClass="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compiler.inputType__ASM_SRCS"/>
|
<inputType id="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compiler.inputType__ASM_SRCS.1443539078" name="Assembly Sources" superClass="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compiler.inputType__ASM_SRCS"/>
|
||||||
@@ -142,7 +144,9 @@
|
|||||||
<option id="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compilerID.DISPLAY_ERROR_NUMBER.1052162638" name="Emit diagnostic identifier numbers (--display_error_number, -pden)" superClass="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compilerID.DISPLAY_ERROR_NUMBER" value="true" valueType="boolean"/>
|
<option id="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compilerID.DISPLAY_ERROR_NUMBER.1052162638" name="Emit diagnostic identifier numbers (--display_error_number, -pden)" superClass="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compilerID.DISPLAY_ERROR_NUMBER" value="true" valueType="boolean"/>
|
||||||
<option id="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compilerID.DIAG_WRAP.139877883" name="Wrap diagnostic messages (--diag_wrap)" superClass="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compilerID.DIAG_WRAP" value="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compilerID.DIAG_WRAP.off" valueType="enumerated"/>
|
<option id="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compilerID.DIAG_WRAP.139877883" name="Wrap diagnostic messages (--diag_wrap)" superClass="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compilerID.DIAG_WRAP" value="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compilerID.DIAG_WRAP.off" valueType="enumerated"/>
|
||||||
<option id="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compilerID.LITTLE_ENDIAN.832106645" name="Little endian code [See 'General' page to edit] (--little_endian, -me)" superClass="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compilerID.LITTLE_ENDIAN" value="true" valueType="boolean"/>
|
<option id="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compilerID.LITTLE_ENDIAN.832106645" name="Little endian code [See 'General' page to edit] (--little_endian, -me)" superClass="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compilerID.LITTLE_ENDIAN" value="true" valueType="boolean"/>
|
||||||
<option id="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compilerID.ADVICE__POWER_SEVERITY.1681960761" superClass="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compilerID.ADVICE__POWER_SEVERITY" value="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compilerID.ADVICE__POWER_SEVERITY.suppress" valueType="enumerated"/>
|
<option id="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compilerID.ADVICE__POWER_SEVERITY.1681960761" name="Set error category for ULP power rules (--advice:power_severity)" superClass="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compilerID.ADVICE__POWER_SEVERITY" value="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compilerID.ADVICE__POWER_SEVERITY.suppress" valueType="enumerated"/>
|
||||||
|
<option id="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compilerID.OPT_LEVEL.library.release.1831028141" superClass="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compilerID.OPT_LEVEL.library.release" value="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compilerID.OPT_LEVEL.4" valueType="enumerated"/>
|
||||||
|
<option id="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compilerID.OPT_FOR_SPEED.1526961018" superClass="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compilerID.OPT_FOR_SPEED" value="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compilerID.OPT_FOR_SPEED.0" valueType="enumerated"/>
|
||||||
<inputType id="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compiler.inputType__C_SRCS.494310206" name="C Sources" superClass="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compiler.inputType__C_SRCS"/>
|
<inputType id="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compiler.inputType__C_SRCS.494310206" name="C Sources" superClass="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compiler.inputType__C_SRCS"/>
|
||||||
<inputType id="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compiler.inputType__CPP_SRCS.1747791468" name="C++ Sources" superClass="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compiler.inputType__CPP_SRCS"/>
|
<inputType id="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compiler.inputType__CPP_SRCS.1747791468" name="C++ Sources" superClass="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compiler.inputType__CPP_SRCS"/>
|
||||||
<inputType id="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compiler.inputType__ASM_SRCS.1060043732" name="Assembly Sources" superClass="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compiler.inputType__ASM_SRCS"/>
|
<inputType id="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compiler.inputType__ASM_SRCS.1060043732" name="Assembly Sources" superClass="com.ti.ccstudio.buildDefinitions.MSP432_5.2.compiler.inputType__ASM_SRCS"/>
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ static void handle_request(struct mg_connection *nc) {
|
|||||||
|
|
||||||
static void handle_upload(struct mg_connection *nc, int ev, void *p) {
|
static void handle_upload(struct mg_connection *nc, int ev, void *p) {
|
||||||
struct file_writer_data *data = (struct file_writer_data *) nc->user_data;
|
struct file_writer_data *data = (struct file_writer_data *) nc->user_data;
|
||||||
struct mg_http_multipart_part *mp = (struct mg_http_multipart_part*)p;
|
struct mg_http_multipart_part *mp = (struct mg_http_multipart_part *) p;
|
||||||
|
|
||||||
switch (ev) {
|
switch (ev) {
|
||||||
case MG_EV_HTTP_PART_BEGIN: {
|
case MG_EV_HTTP_PART_BEGIN: {
|
||||||
|
|||||||
@@ -23,28 +23,35 @@ static void ev_handler(struct mg_connection *nc, int ev, void *ev_data) {
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
switch (ev) {
|
switch (ev) {
|
||||||
case MG_DNS_MESSAGE:
|
case MG_DNS_MESSAGE: {
|
||||||
|
struct mbuf reply_buf;
|
||||||
|
mbuf_init(&reply_buf, 512);
|
||||||
msg = (struct mg_dns_message *) ev_data;
|
msg = (struct mg_dns_message *) ev_data;
|
||||||
reply = mg_dns_create_reply(&nc->send_mbuf, msg);
|
reply = mg_dns_create_reply(&reply_buf, msg);
|
||||||
|
|
||||||
for (i = 0; i < msg->num_questions; i++) {
|
for (i = 0; i < msg->num_questions; i++) {
|
||||||
|
char rname[256];
|
||||||
rr = &msg->questions[i];
|
rr = &msg->questions[i];
|
||||||
|
mg_dns_uncompress_name(msg, &rr->name, rname, sizeof(rname) - 1);
|
||||||
|
LOG(LL_INFO, ("Q type %d name %s", rr->rtype, rname));
|
||||||
if (rr->rtype == MG_DNS_A_RECORD) {
|
if (rr->rtype == MG_DNS_A_RECORD) {
|
||||||
mg_dns_reply_record(&reply, rr, NULL, rr->rtype, 3600,
|
mg_dns_reply_record(&reply, rr, NULL, rr->rtype, 10, &s_our_ip_addr,
|
||||||
&s_our_ip_addr, 4);
|
4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We don't set the error flag even if there were no answers
|
* We don't set the error flag even if there were no answers
|
||||||
* maching the MG_DNS_A_RECORD query type.
|
* matching the MG_DNS_A_RECORD query type.
|
||||||
* This indicates that we have (syntetic) answers for MG_DNS_A_RECORD.
|
* This indicates that we have (synthetic) answers for MG_DNS_A_RECORD.
|
||||||
* See http://goo.gl/QWvufr for a distinction between NXDOMAIN and NODATA.
|
* See http://goo.gl/QWvufr for a distinction between NXDOMAIN and NODATA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
mg_dns_send_reply(nc, &reply);
|
mg_dns_send_reply(nc, &reply);
|
||||||
nc->flags |= MG_F_SEND_AND_CLOSE;
|
nc->flags |= MG_F_SEND_AND_CLOSE;
|
||||||
|
mbuf_free(&reply_buf);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -55,6 +62,7 @@ int main(int argc, char *argv[]) {
|
|||||||
|
|
||||||
mg_mgr_init(&mgr, NULL);
|
mg_mgr_init(&mgr, NULL);
|
||||||
s_our_ip_addr = inet_addr("127.0.0.1");
|
s_our_ip_addr = inet_addr("127.0.0.1");
|
||||||
|
cs_log_set_level(LL_INFO);
|
||||||
|
|
||||||
/* Parse command line arguments */
|
/* Parse command line arguments */
|
||||||
for (i = 1; i < argc; i++) {
|
for (i = 1; i < argc; i++) {
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ struct device_settings {
|
|||||||
|
|
||||||
static const char *s_http_port = "8000";
|
static const char *s_http_port = "8000";
|
||||||
static struct mg_serve_http_opts s_http_server_opts;
|
static struct mg_serve_http_opts s_http_server_opts;
|
||||||
static struct device_settings s_settings = { "value1", "value2" };
|
static struct device_settings s_settings = {"value1", "value2"};
|
||||||
|
|
||||||
static void handle_save(struct mg_connection *nc, struct http_message *hm) {
|
static void handle_save(struct mg_connection *nc, struct http_message *hm) {
|
||||||
// Get form variables and store settings values
|
// Get form variables and store settings values
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ struct device_settings {
|
|||||||
|
|
||||||
static const char *s_http_port = "8000";
|
static const char *s_http_port = "8000";
|
||||||
static struct mg_serve_http_opts s_http_server_opts;
|
static struct mg_serve_http_opts s_http_server_opts;
|
||||||
static struct device_settings s_settings = { "value1", "value2" };
|
static struct device_settings s_settings = {"value1", "value2"};
|
||||||
|
|
||||||
static void handle_save(struct mg_connection *nc, struct http_message *hm) {
|
static void handle_save(struct mg_connection *nc, struct http_message *hm) {
|
||||||
// Get form variables and store settings values
|
// Get form variables and store settings values
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ struct device_settings {
|
|||||||
|
|
||||||
static const char *s_http_port = "8000";
|
static const char *s_http_port = "8000";
|
||||||
static struct mg_serve_http_opts s_http_server_opts;
|
static struct mg_serve_http_opts s_http_server_opts;
|
||||||
static struct device_settings s_settings = { "value1", "value2" };
|
static struct device_settings s_settings = {"value1", "value2"};
|
||||||
|
|
||||||
static void handle_save(struct mg_connection *nc, struct http_message *hm) {
|
static void handle_save(struct mg_connection *nc, struct http_message *hm) {
|
||||||
// Get form variables and store settings values
|
// Get form variables and store settings values
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
PROG = json_rpc_server
|
PROG = cookie_auth
|
||||||
include ../examples.mk
|
include ../examples.mk
|
||||||
@@ -0,0 +1,114 @@
|
|||||||
|
// Copyright (c) 2014 Cesanta Software
|
||||||
|
// All rights reserved
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <time.h>
|
||||||
|
#include "mongoose.h"
|
||||||
|
|
||||||
|
static const char *s_http_port = "8000";
|
||||||
|
static struct mg_serve_http_opts s_http_server_opts;
|
||||||
|
static const char *s_login_uri = "/login.html";
|
||||||
|
static const char *s_secret = ":-)"; // Must be known only to server
|
||||||
|
|
||||||
|
static void generate_ssid(const char *user_name, const char *expiration_date,
|
||||||
|
char *ssid, size_t ssid_size) {
|
||||||
|
char hash[33];
|
||||||
|
cs_md5(hash, user_name, strlen(user_name), ":", (size_t) 1, expiration_date,
|
||||||
|
strlen(expiration_date), ":", (size_t) 1, s_secret, strlen(s_secret),
|
||||||
|
NULL);
|
||||||
|
snprintf(ssid, ssid_size, "%s|%s|%s", user_name, expiration_date, hash);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int check_auth(struct http_message *hm) {
|
||||||
|
int authenticated = 0;
|
||||||
|
char ssid[100], calculated_ssid[100], name[100], expire[100];
|
||||||
|
|
||||||
|
if (mg_vcmp(&hm->uri, s_login_uri) == 0) {
|
||||||
|
// Always authenticate requests to login page
|
||||||
|
authenticated = 1;
|
||||||
|
} else {
|
||||||
|
// Look for session ID in the Cookie.
|
||||||
|
// That session ID can be validated against the database that stores
|
||||||
|
// current active sessions.
|
||||||
|
mg_http_parse_header(mg_get_http_header(hm, "Cookie"), "ssid", ssid,
|
||||||
|
sizeof(ssid));
|
||||||
|
if (sscanf(ssid, "%[^|]|%[^|]|", name, expire) == 2) {
|
||||||
|
generate_ssid(name, expire, calculated_ssid, sizeof(calculated_ssid));
|
||||||
|
if (strcmp(ssid, calculated_ssid) == 0) {
|
||||||
|
authenticated = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return authenticated;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void check_login_form_submission(struct mg_connection *c,
|
||||||
|
struct http_message *hm) {
|
||||||
|
char name[100], password[100], ssid[100], expire[100], expire_epoch[100];
|
||||||
|
|
||||||
|
mg_get_http_var(&hm->body, "name", name, sizeof(name));
|
||||||
|
mg_get_http_var(&hm->body, "password", password, sizeof(password));
|
||||||
|
|
||||||
|
// A real authentication mechanism should be employed here.
|
||||||
|
// Also, the whole site should be served through HTTPS.
|
||||||
|
if (strcmp(name, "Joe") == 0 && strcmp(password, "Doe") == 0) {
|
||||||
|
// Generate expiry date
|
||||||
|
time_t t = time(NULL) + 3600; // Valid for 1 hour
|
||||||
|
snprintf(expire_epoch, sizeof(expire_epoch), "%lu", (unsigned long) t);
|
||||||
|
strftime(expire, sizeof(expire), "%a, %d %b %Y %H:%M:%S GMT", gmtime(&t));
|
||||||
|
generate_ssid(name, expire_epoch, ssid, sizeof(ssid));
|
||||||
|
|
||||||
|
// Set "session id" cookie, there could be some data encoded in it.
|
||||||
|
mg_printf(c,
|
||||||
|
"HTTP/1.1 302 Moved\r\n"
|
||||||
|
"Set-Cookie: ssid=%s; expire=\"%s\"; http-only; HttpOnly;\r\n"
|
||||||
|
"Location: /\r\n\r\n",
|
||||||
|
ssid, expire);
|
||||||
|
} else {
|
||||||
|
mg_printf(c, "%s", "HTTP/1.1 302 Moved\r\nLocation: /\r\n\r\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void ev_handler(struct mg_connection *c, int ev, void *ev_data) {
|
||||||
|
if (ev == MG_EV_HTTP_REQUEST) {
|
||||||
|
struct http_message *hm = (struct http_message *) ev_data;
|
||||||
|
|
||||||
|
if (mg_vcmp(&hm->uri, s_login_uri) == 0 &&
|
||||||
|
mg_vcmp(&hm->method, "POST") == 0) {
|
||||||
|
check_login_form_submission(c, hm);
|
||||||
|
} else if (check_auth(hm)) {
|
||||||
|
// Authenticated. Serve files.
|
||||||
|
mg_serve_http(c, (struct http_message *) ev_data, s_http_server_opts);
|
||||||
|
} else {
|
||||||
|
// Not authenticated. Redirect to the login page.
|
||||||
|
mg_printf(c, "HTTP/1.1 302 Moved\r\nLocation: %s\r\n\r\n", s_login_uri);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(void) {
|
||||||
|
struct mg_mgr mgr;
|
||||||
|
struct mg_connection *c;
|
||||||
|
|
||||||
|
mg_mgr_init(&mgr, NULL);
|
||||||
|
c = mg_bind(&mgr, s_http_port, ev_handler);
|
||||||
|
|
||||||
|
if (c == NULL) {
|
||||||
|
printf("Cannot start server on port %s\n", s_http_port);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set up HTTP server parameters
|
||||||
|
mg_set_protocol_http_websocket(c);
|
||||||
|
s_http_server_opts.document_root = "."; // Serve current directory
|
||||||
|
|
||||||
|
printf("Starting web server on port %s\n", s_http_port);
|
||||||
|
for (;;) {
|
||||||
|
mg_mgr_poll(&mgr, 1000);
|
||||||
|
}
|
||||||
|
mg_mgr_free(&mgr);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<title>WebSocket Test</title>
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
|
<style type="text/css">
|
||||||
|
body {
|
||||||
|
background-color: #cde; margin: 0;
|
||||||
|
padding: 0; font: 14px Helvetica, Arial, sans-serif;
|
||||||
|
}
|
||||||
|
* { outline: none; }
|
||||||
|
div.content {
|
||||||
|
width: 800px; margin: 2em auto; padding: 20px 50px;
|
||||||
|
background-color: #fff; border-radius: 1em;
|
||||||
|
}
|
||||||
|
label { display: inline-block; min-width: 7em; }
|
||||||
|
input { border: 1px solid #ccc; padding: 0.4em; margin: 0 0 10px 0; }
|
||||||
|
a:link, a:visited { color: #69c; text-decoration: none; }
|
||||||
|
@media (max-width: 700px) {
|
||||||
|
body { background-color: #fff; }
|
||||||
|
div.content {
|
||||||
|
width: auto; margin: 0 auto; border-radius: 0; padding: 1em;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div class="content">
|
||||||
|
<h1>Mongoose Cookie Base Authentication</h1>
|
||||||
|
<p>This is an index page. Authentication succeeded.</p>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<title>WebSocket Test</title>
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
|
<style type="text/css">
|
||||||
|
body {
|
||||||
|
background-color: #cde; margin: 0;
|
||||||
|
padding: 0; font: 14px Helvetica, Arial, sans-serif;
|
||||||
|
}
|
||||||
|
* { outline: none; }
|
||||||
|
div.content {
|
||||||
|
width: 800px; margin: 2em auto; padding: 20px 50px;
|
||||||
|
background-color: #fff; border-radius: 1em;
|
||||||
|
}
|
||||||
|
label { display: inline-block; min-width: 7em; }
|
||||||
|
input { border: 1px solid #ccc; padding: 0.4em; margin: 0 0 10px 0; }
|
||||||
|
a:link, a:visited { color: #69c; text-decoration: none; }
|
||||||
|
@media (max-width: 700px) {
|
||||||
|
body { background-color: #fff; }
|
||||||
|
div.content {
|
||||||
|
width: auto; margin: 0 auto; border-radius: 0; padding: 1em;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div class="content">
|
||||||
|
<h1>Mongoose Cookie Based Authentication</h1>
|
||||||
|
<p>Use name "Joe", password "Doe" to login.</p>
|
||||||
|
<form method="POST">
|
||||||
|
<div>
|
||||||
|
<label>Name:</label>
|
||||||
|
<input type="text" name="name"/>
|
||||||
|
</div><div>
|
||||||
|
<label>Password:</label>
|
||||||
|
<input type="password" name="password"/>
|
||||||
|
</div><div>
|
||||||
|
<input type="submit" value="Login"/>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -11,7 +11,7 @@ else
|
|||||||
ifeq ($(SSL_LIB),openssl)
|
ifeq ($(SSL_LIB),openssl)
|
||||||
CFLAGS += -DMG_ENABLE_SSL -lssl -lcrypto
|
CFLAGS += -DMG_ENABLE_SSL -lssl -lcrypto
|
||||||
else ifeq ($(SSL_LIB), krypton)
|
else ifeq ($(SSL_LIB), krypton)
|
||||||
CFLAGS += -DMG_ENABLE_SSL ../../../krypton/krypton.c
|
CFLAGS += -DMG_ENABLE_SSL -DMG_DISABLE_PFS ../../../krypton/krypton.c
|
||||||
endif
|
endif
|
||||||
CFLAGS += -lpthread
|
CFLAGS += -lpthread
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -16,8 +16,8 @@ static void ev_handler(struct mg_connection *nc, int ev, void *ev_data) {
|
|||||||
|
|
||||||
switch (ev) {
|
switch (ev) {
|
||||||
case MG_EV_CONNECT:
|
case MG_EV_CONNECT:
|
||||||
if (* (int *) ev_data != 0) {
|
if (*(int *) ev_data != 0) {
|
||||||
fprintf(stderr, "connect() failed: %s\n", strerror(* (int *) ev_data));
|
fprintf(stderr, "connect() failed: %s\n", strerror(*(int *) ev_data));
|
||||||
s_exit_flag = 1;
|
s_exit_flag = 1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -54,8 +54,8 @@ int main(int argc, char *argv[]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (i + 1 != argc) {
|
if (i + 1 != argc) {
|
||||||
fprintf(stderr, "Usage: %s [%s] [--hexdump <file>] <URL>\n",
|
fprintf(stderr, "Usage: %s [%s] [--hexdump <file>] <URL>\n", argv[0],
|
||||||
argv[0], s_show_headers_opt);
|
s_show_headers_opt);
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,67 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2014 Cesanta Software Limited
|
|
||||||
* All rights reserved
|
|
||||||
*
|
|
||||||
* To test this server, do
|
|
||||||
* $ curl -d '{"id":1,method:"sum",params:[22,33]}' 127.0.0.1:8000
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "mongoose.h"
|
|
||||||
|
|
||||||
static const char *s_http_port = "8000";
|
|
||||||
|
|
||||||
static int rpc_sum(char *buf, int len, struct mg_rpc_request *req) {
|
|
||||||
double sum = 0;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
if (req->params[0].type != JSON_TYPE_ARRAY) {
|
|
||||||
return mg_rpc_create_std_error(buf, len, req,
|
|
||||||
JSON_RPC_INVALID_PARAMS_ERROR);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < req->params[0].num_desc; i++) {
|
|
||||||
if (req->params[i + 1].type != JSON_TYPE_NUMBER) {
|
|
||||||
return mg_rpc_create_std_error(buf, len, req,
|
|
||||||
JSON_RPC_INVALID_PARAMS_ERROR);
|
|
||||||
}
|
|
||||||
sum += strtod(req->params[i + 1].ptr, NULL);
|
|
||||||
}
|
|
||||||
return mg_rpc_create_reply(buf, len, req, "f", sum);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void ev_handler(struct mg_connection *nc, int ev, void *ev_data) {
|
|
||||||
struct http_message *hm = (struct http_message *) ev_data;
|
|
||||||
static const char *methods[] = { "sum", NULL };
|
|
||||||
static mg_rpc_handler_t handlers[] = { rpc_sum, NULL };
|
|
||||||
char buf[100];
|
|
||||||
|
|
||||||
switch (ev) {
|
|
||||||
case MG_EV_HTTP_REQUEST:
|
|
||||||
mg_rpc_dispatch(hm->body.p, hm->body.len, buf, sizeof(buf),
|
|
||||||
methods, handlers);
|
|
||||||
mg_printf(nc, "HTTP/1.0 200 OK\r\nContent-Length: %d\r\n"
|
|
||||||
"Content-Type: application/json\r\n\r\n%s",
|
|
||||||
(int) strlen(buf), buf);
|
|
||||||
nc->flags |= MG_F_SEND_AND_CLOSE;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int main(void) {
|
|
||||||
struct mg_mgr mgr;
|
|
||||||
struct mg_connection *nc;
|
|
||||||
|
|
||||||
mg_mgr_init(&mgr, NULL);
|
|
||||||
nc = mg_bind(&mgr, s_http_port, ev_handler);
|
|
||||||
mg_set_protocol_http_websocket(nc);
|
|
||||||
|
|
||||||
printf("Starting JSON-RPC server on port %s\n", s_http_port);
|
|
||||||
for (;;) {
|
|
||||||
mg_mgr_poll(&mgr, 1000);
|
|
||||||
}
|
|
||||||
mg_mgr_free(&mgr);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
@@ -277,8 +277,9 @@ static int connect_backend(struct conn_data *conn, struct http_message *hm) {
|
|||||||
struct mg_connection *nc = conn->client.nc;
|
struct mg_connection *nc = conn->client.nc;
|
||||||
struct http_backend *be = choose_backend(hm);
|
struct http_backend *be = choose_backend(hm);
|
||||||
|
|
||||||
write_log("%.*s %.*s backend=%s\n", (int) hm->method.len, hm->method.p,
|
write_log("%ld %.*s %.*s backend=%s\n", (long) time(NULL),
|
||||||
(int) hm->uri.len, hm->uri.p, be ? be->host_port : "not defined");
|
(int) hm->method.len, hm->method.p, (int) hm->uri.len, hm->uri.p,
|
||||||
|
be ? be->host_port : "not defined");
|
||||||
|
|
||||||
if (be == NULL) return 0;
|
if (be == NULL) return 0;
|
||||||
if (be->redirect != 0) {
|
if (be->redirect != 0) {
|
||||||
|
|||||||
Loaded 100 of 131 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user