├── README.md ├── arduino_demo └── coap_server │ ├── .gitignore │ ├── coap.c │ ├── coap.h │ ├── coap_server.ino │ └── control_rgb_led.js ├── debug_demo └── server.py ├── first_demo └── microcoap │ ├── coap.c │ ├── coap.h │ └── microcoap.ino ├── img ├── book.jpg ├── book_1000.jpg └── book_600.jpg ├── microsystem_device ├── .gitignore ├── Makefile.user.include ├── doc │ └── sensortag │ │ ├── hdc1000.pdf │ │ ├── opt3001.pdf │ │ └── sensortag_sch.pdf ├── examples │ ├── ipv6 │ │ └── slip-radio │ │ │ ├── Makefile │ │ │ ├── Makefile.target │ │ │ ├── no-framer.c │ │ │ ├── project-conf.h │ │ │ ├── slip-net.c │ │ │ ├── slip-radio.c │ │ │ └── slip-radio.h │ ├── sensortag │ │ ├── coap-client-sensor │ │ │ ├── Makefile │ │ │ ├── Makefile.target │ │ │ ├── coap-client-sensor.c │ │ │ ├── coap-post-process.c │ │ │ ├── coap-post-process.h │ │ │ ├── project-conf.h │ │ │ ├── sensor-process.c │ │ │ └── sensor-process.h │ │ ├── coap-client │ │ │ ├── Makefile │ │ │ ├── Makefile.target │ │ │ ├── coap-client.c │ │ │ └── project-conf.h │ │ ├── hello-world │ │ │ ├── Makefile │ │ │ ├── Makefile.target │ │ │ ├── hello-world.c │ │ │ └── project-conf.h │ │ ├── nat-udp-client │ │ │ ├── Makefile │ │ │ ├── Makefile.target │ │ │ ├── project-conf.h │ │ │ └── udp-client.c │ │ └── sensor-demo │ │ │ ├── Makefile │ │ │ ├── Makefile.target │ │ │ ├── project-conf.h │ │ │ ├── readme.md │ │ │ └── sensor-demo.c │ └── wxlink │ │ ├── coap-client │ │ ├── Makefile │ │ ├── Makefile.target │ │ ├── er-example-client.c │ │ └── project-conf.h │ │ ├── hello-world │ │ ├── Makefile │ │ ├── Makefile.target │ │ ├── hello-world.c │ │ └── project-conf.h │ │ └── nat-udp-client │ │ ├── Makefile │ │ ├── Makefile.target │ │ ├── project-conf.h │ │ └── udp-client.c └── platform │ └── wxlink │ ├── README.cc2538dk.md │ ├── contiki-conf.h │ ├── contiki-main.c │ └── dev │ ├── als-sensor.c │ ├── als-sensor.h │ ├── board.h │ ├── button-sensor.c │ ├── button-sensor.h │ ├── leds-arch.c │ └── smartrf-sensors.c ├── microsystem_server ├── .gitignore ├── app-coap.js ├── app-web.js ├── app.js ├── config │ └── db-config.json ├── lib │ └── coap-router │ │ ├── formatter.js │ │ ├── index.js │ │ └── matcher.js ├── package.json ├── public │ ├── javascripts │ │ ├── bootstrap-table-zh-CN.min.js │ │ ├── bootstrap-table.min.js │ │ ├── bootstrap.min.js │ │ └── jquery.min.js │ ├── stylesheet │ │ ├── bootstrap-table.min.css │ │ ├── bootstrap-theme.css │ │ ├── bootstrap.css │ │ └── custom.css │ └── themes │ │ ├── bootstrap │ │ ├── accordion.css │ │ ├── calendar.css │ │ ├── combo.css │ │ ├── combobox.css │ │ ├── datagrid.css │ │ ├── datalist.css │ │ ├── datebox.css │ │ ├── dialog.css │ │ ├── easyui.css │ │ ├── filebox.css │ │ ├── images │ │ │ ├── accordion_arrows.png │ │ │ ├── blank.gif │ │ │ ├── calendar_arrows.png │ │ │ ├── combo_arrow.png │ │ │ ├── datagrid_icons.png │ │ │ ├── datebox_arrow.png │ │ │ ├── layout_arrows.png │ │ │ ├── linkbutton_bg.png │ │ │ ├── loading.gif │ │ │ ├── menu_arrows.png │ │ │ ├── messager_icons.png │ │ │ ├── pagination_icons.png │ │ │ ├── panel_tools.png │ │ │ ├── searchbox_button.png │ │ │ ├── slider_handle.png │ │ │ ├── spinner_arrows.png │ │ │ ├── tabs_icons.png │ │ │ ├── tree_icons.png │ │ │ └── validatebox_warning.png │ │ ├── layout.css │ │ ├── linkbutton.css │ │ ├── menu.css │ │ ├── menubutton.css │ │ ├── messager.css │ │ ├── numberbox.css │ │ ├── pagination.css │ │ ├── panel.css │ │ ├── progressbar.css │ │ ├── propertygrid.css │ │ ├── searchbox.css │ │ ├── slider.css │ │ ├── spinner.css │ │ ├── splitbutton.css │ │ ├── switchbutton.css │ │ ├── tabs.css │ │ ├── textbox.css │ │ ├── tooltip.css │ │ ├── tree.css │ │ ├── validatebox.css │ │ └── window.css │ │ ├── color.css │ │ ├── icon.css │ │ ├── icons │ │ ├── back.png │ │ ├── blank.gif │ │ ├── cancel.png │ │ ├── clear.png │ │ ├── cut.png │ │ ├── edit_add.png │ │ ├── edit_remove.png │ │ ├── filesave.png │ │ ├── filter.png │ │ ├── help.png │ │ ├── large_chart.png │ │ ├── large_clipart.png │ │ ├── large_picture.png │ │ ├── large_shapes.png │ │ ├── large_smartart.png │ │ ├── lock.png │ │ ├── man.png │ │ ├── mini_add.png │ │ ├── mini_edit.png │ │ ├── mini_refresh.png │ │ ├── more.png │ │ ├── no.png │ │ ├── ok.png │ │ ├── pencil.png │ │ ├── print.png │ │ ├── redo.png │ │ ├── reload.png │ │ ├── search.png │ │ ├── sum.png │ │ ├── tip.png │ │ └── undo.png │ │ └── mobile.css ├── readme.md ├── routes │ ├── coap_index.js │ └── index.js ├── sensor_history.sql ├── test │ └── post_sensor_data.js └── views │ ├── admin.html │ ├── layout.html │ └── test.html ├── review_demo ├── http_demo │ ├── app.py │ ├── static │ │ └── jquery.js │ └── templates │ │ └── index.html ├── tcp_echo_demo │ ├── tcp_client.py │ └── tcp_server.py └── udp_echo_demo │ ├── udp_client.py │ └── udp_server.py └── simple_demo ├── aiocoap_demo ├── .gitignore ├── README.md ├── rpi_gpio_server.py ├── test-client.py └── test-server.py ├── cf_demo ├── .gitignore ├── runnable_jar │ ├── .gitignore │ ├── test-coap-client.jar │ └── test-coap-server.jar ├── sources │ ├── californium-core-2.0.0-M2-sources.jar │ └── element-connector-2.0.0-M2-sources.jar ├── test-coap-client │ ├── .classpath │ ├── .gitignore │ ├── .project │ ├── .settings │ │ └── org.eclipse.jdt.core.prefs │ ├── Californium.properties │ ├── lib │ │ ├── californium-core-2.0.0-M2.jar │ │ └── element-connector-2.0.0-M2.jar │ └── src │ │ └── org │ │ └── wsncoap │ │ └── GETClient.java └── test-coap-server │ ├── .classpath │ ├── .gitignore │ ├── .project │ ├── .settings │ └── org.eclipse.jdt.core.prefs │ ├── Californium.properties │ ├── lib │ ├── californium-core-2.0.0-M2.jar │ └── element-connector-2.0.0-M2.jar │ └── src │ └── org │ └── wsncoap │ └── HelloCoAPServer.java └── nodecoap_demo ├── .gitignore ├── client.js ├── json_server.js └── server.js /README.md: -------------------------------------------------------------------------------- 1 | ## 图书简介 2 | CoAP是受限制的应用协议(Constrained Application Protocol)的简称。随着近几年物联网技术的快速发展,越来越多的设备需要接入互联网。虽然对人们而言连接互联网显得方便而快捷,但是对于那些低功耗受限制设备而言接入互联网却非常困难。在当前由PC机和智能手机组成的互联网世界中,信息交换一般通过TCP和HTTP协议实现。但是对于那些低功耗受限制设备而言,实现TCP和HTTP协议也许是一个非常苛刻的要求。为了让低功耗受限制设也可以流畅接入互联网,CoAP协议应运而生。CoAP是一种物联网应用层协议,它运行于UDP协议之上而不是像HTTP那样运行于TCP之上。CoAP协议借鉴了HTTP协议的大量成功经验,CoAP协议和HTTP协议一样均使用请求响应工作模式。和HTTP协议采用文本首部不同,CoAP协议采用完全的二进制首部,这使得CoAP协议的首部更短,传输效率更高。CoAP协议为受限制设备而生,一个内存仅有20KB的单片机也可以实现CoAP服务器或客户端。 3 | ## 本书主要内容 4 | - 学习CoAP协议必要的网络基础知识; 5 | - CoAP与MQTT、HTTP之间的区别与联系; 6 | - CoAP核心内容:二进制首部、工作模式、重传机制、响应吗、选项和媒体类型等; 7 | - CoAP扩展内容:CoAP资源描述和CoAP观察者; 8 | - 使用C语言、Python或Node.js实现CoAP客户端与服务器; 9 | - 使用Copper插件和Wireshark调试CoAP。 10 | 11 | ![CoAP in Action](http://ovqdgsm5c.bkt.clouddn.com/17-10-12/96986591.jpg) 12 | 13 | ## 图书勘误 14 | ### 最新版火狐浏览器不能使用Copper插件 15 | 最新版火狐浏览器(56版本及以上)已经*不能正确*支持Copper插件。如果想尝试本书中关于Copper插件的相关功能,请使用火狐 55.0版本或更低版本。 16 | 火狐浏览器的历史版本可通过以下途径获取 17 | - [FTP服务器](http://ftp.mozilla.org/pub/firefox/releases/) 18 | - [火狐浏览器下载与安装](http://www.firefox.com.cn/download/#more) 19 | ![](http://ovqdgsm5c.bkt.clouddn.com/17-11-8/191344.jpg) 20 | -------------------------------------------------------------------------------- /arduino_demo/coap_server/.gitignore: -------------------------------------------------------------------------------- 1 | /node_modules -------------------------------------------------------------------------------- /arduino_demo/coap_server/coap_server.ino: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include "coap.h" 9 | 10 | #define PORT 5683 11 | byte mac[] = {0x00, 0xAA, 0xBB, 0xCC, 0xDE, 0x02}; 12 | IPAddress ip(192, 168, 0, 10); 13 | IPAddress gateway(192, 168, 0, 1); 14 | IPAddress subnet(255, 255, 255, 0); 15 | 16 | EthernetClient client; 17 | EthernetUDP udp; 18 | 19 | #define WS2812_PIN 6 20 | Adafruit_NeoPixel strip = Adafruit_NeoPixel(16, WS2812_PIN, NEO_GRB + NEO_KHZ800); 21 | 22 | uint8_t packetbuf[256]; 23 | static uint8_t scratch_raw[32]; 24 | static coap_rw_buffer_t scratch_buf = {scratch_raw, sizeof(scratch_raw)}; 25 | 26 | static int red = 10; 27 | static int green = 10; 28 | static int blue = 10; 29 | 30 | static const coap_endpoint_path_t path_hello = {1, {"hello"}}; 31 | static int handle_get_hello(coap_rw_buffer_t *scratch, 32 | const coap_packet_t *inpkt, coap_packet_t *outpkt, 33 | uint8_t id_hi, uint8_t id_lo) 34 | { 35 | char hello[32] = "Hello CoAP!"; 36 | return coap_make_response(scratch, outpkt, 37 | (const uint8_t *)&hello, strlen(hello), 38 | id_hi, id_lo, &inpkt->tok, 39 | COAP_RSPCODE_CONTENT, COAP_CONTENTTYPE_TEXT_PLAIN); 40 | } 41 | 42 | static const coap_endpoint_path_t path_rgb = {1, {"rgb"}}; 43 | static int handle_get_rgb(coap_rw_buffer_t *scratch, 44 | const coap_packet_t *inpkt, coap_packet_t *outpkt, 45 | uint8_t id_hi, uint8_t id_lo) 46 | { 47 | char response[64]; 48 | int len; 49 | StaticJsonBuffer<64> jsonBuffer; 50 | JsonObject& root = jsonBuffer.createObject(); 51 | root["red"] = red; 52 | root["green"] = green; 53 | root["blue"] = blue; 54 | 55 | memset(response, 0x00, sizeof(response)); 56 | root.printTo(response, sizeof(response)); 57 | 58 | return coap_make_response(scratch, outpkt, 59 | (const uint8_t *)&response, strlen(response), 60 | id_hi, id_lo, &inpkt->tok, 61 | COAP_RSPCODE_CONTENT, COAP_CONTENTTYPE_TEXT_PLAIN); 62 | } 63 | 64 | static int handle_put_rgb(coap_rw_buffer_t *scratch, 65 | const coap_packet_t *inpkt, coap_packet_t *outpkt, 66 | uint8_t id_hi, uint8_t id_lo) 67 | { 68 | char request[64]; 69 | memset(request, 0x00, sizeof(request)); 70 | memcpy(request, inpkt->payload.p, inpkt->payload.len); 71 | 72 | StaticJsonBuffer<64> jsonBuffer; 73 | JsonObject& root = jsonBuffer.parseObject(request); 74 | 75 | red = root["red"]; 76 | green = root["green"]; 77 | blue= root["blue"]; 78 | 79 | color_wipe(strip.Color(red, green, blue)); 80 | 81 | return coap_make_response(scratch, outpkt, 82 | NULL, 0, 83 | id_hi, id_lo, &inpkt->tok, 84 | COAP_RSPCODE_CHANGED, 85 | COAP_CONTENTTYPE_TEXT_PLAIN); 86 | } 87 | 88 | coap_endpoint_t endpoints[] = 89 | { 90 | {COAP_METHOD_GET, handle_get_hello, &path_hello, "ct=0"}, 91 | {COAP_METHOD_GET, handle_get_rgb, &path_rgb, "ct=40"}, 92 | {COAP_METHOD_PUT, handle_put_rgb, &path_rgb, NULL}, 93 | {(coap_method_t)0, NULL, NULL, NULL} 94 | }; 95 | 96 | void endpoint_setup(void) 97 | { 98 | 99 | } 100 | 101 | void color_wipe(uint32_t c) { 102 | for(uint16_t i=0; i 0) 146 | { 147 | udp.read(packetbuf, sizeof(packetbuf)); 148 | 149 | Serial.print("UDP:"); 150 | for (i = 0; i < sz; i++) 151 | { 152 | Serial.print(packetbuf[i], HEX); 153 | Serial.print(" "); 154 | } 155 | Serial.println(""); 156 | 157 | if (0 != (rc = coap_parse(&pkt, packetbuf, sz))) 158 | { 159 | Serial.print("Bad packet rc="); 160 | Serial.println(rc, DEC); 161 | } 162 | else 163 | { 164 | size_t rsplen = sizeof(packetbuf); 165 | coap_packet_t rsppkt; 166 | coap_handle_req(&scratch_buf, &pkt, &rsppkt, endpoints); 167 | 168 | memset(packetbuf, 0, UDP_TX_PACKET_MAX_SIZE); 169 | if (0 != (rc = coap_build(packetbuf, &rsplen, &rsppkt))) 170 | { 171 | Serial.print("coap_build failed rc="); 172 | Serial.println(rc, DEC); 173 | } 174 | else 175 | { 176 | udp_send(packetbuf, rsplen); 177 | } 178 | } 179 | } 180 | } 181 | 182 | -------------------------------------------------------------------------------- /arduino_demo/coap_server/control_rgb_led.js: -------------------------------------------------------------------------------- 1 | const coap = require('coap') 2 | 3 | var host = '192.168.0.10'; 4 | var pathname = 'rgb'; 5 | 6 | function put_request() { 7 | var req = coap.request({ 8 | host: host, 9 | port: 5683, 10 | pathname: pathname, 11 | method: 'PUT' 12 | }); 13 | req.setOption("Content-Format", "application/json"); 14 | 15 | // 负载 16 | var payload = { 17 | red: parseInt(Math.round(10 + (250 - 10) * Math.random())), 18 | green: parseInt(Math.round(10 + (250 - 10) * Math.random())), 19 | blue: parseInt(Math.round(10 + (250 - 10) * Math.random())) 20 | } 21 | console.log(payload); 22 | req.end(JSON.stringify(payload)); 23 | 24 | req.on('response', function(res) { 25 | console.log('response code: ' + res.code); 26 | console.log('response payload: ' + res.payload); 27 | }); 28 | } 29 | 30 | setInterval(put_request, 5000); 31 | 32 | -------------------------------------------------------------------------------- /debug_demo/server.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | import datetime 4 | import logging 5 | import asyncio 6 | import aiocoap.resource as resource 7 | import aiocoap 8 | 9 | class BlockResource(resource.Resource): 10 | def __init__(self): 11 | super(BlockResource, self).__init__() 12 | self.content = ("Constrained Application Protocol (CoAP) is a software protocol "\ 13 | "intended to be used in very simple electronics devices, "\ 14 | "allowing them to communicate interactively over the Internet. "\ 15 | "It is particularly targeted for small, low-power sensors, switches, valves " 16 | "and similar components that need to be controlled or supervised remotely, "\ 17 | "through standard Internet networks. CoAP is an application layer protocol "\ 18 | "that is intended for use in resource-constrained internet devices, "\ 19 | "such as WSN nodes. CoAP is designed to easily translate to HTTP "\ 20 | "for simplified integration with the web, "\ 21 | "while also meeting specialized requirements such as multicast support, "\ 22 | "very low overhead, and simplicity.[Multicast, low overhead, "\ 23 | "and simplicity are extremely important for Internet of Things (IoT) "\ 24 | "and Machine-to-Machine (M2M) devices, "\ 25 | "which tend to be deeply embedded and have much less memory "\ 26 | "and power supply than traditional internet devices have. "\ 27 | "Therefore, efficiency is very important. "\ 28 | "CoAP can run on most devices that support UDP or a UDP analogue.\n").encode("ascii") 29 | 30 | @asyncio.coroutine 31 | def render_get(self, request): 32 | response = aiocoap.Message(code=aiocoap.CONTENT, payload=self.content) 33 | return response 34 | 35 | @asyncio.coroutine 36 | def render_put(self, request): 37 | print('PUT payload: %s' % request.payload) 38 | self.content = request.payload 39 | payload = ("accepted the new payload. You may inspect it here in "\ 40 | "Python's repr format:\n\n%r" % self.content).encode('utf8') 41 | response = aiocoap.Message(code=aiocoap.CHANGED, payload=self.content) 42 | return response 43 | 44 | class SeparateLargeResource(resource.Resource): 45 | def __init__(self): 46 | super(SeparateLargeResource, self).__init__() 47 | 48 | @asyncio.coroutine 49 | def render_get(self, request): 50 | yield from asyncio.sleep(3) 51 | 52 | payload = "CoAP is an open Internet standard for the Web of Things."\ 53 | " It's based on the Web's core pipe: HTTP, "\ 54 | "but has many differences to allow it to be used "\ 55 | "by very resource-constrained devices "\ 56 | "and local radio networks.".encode('ascii') 57 | return aiocoap.Message(code=aiocoap.CONTENT, payload=payload) 58 | 59 | class TimeResource(resource.ObservableResource): 60 | def __init__(self): 61 | super(TimeResource, self).__init__() 62 | 63 | self.notify() 64 | 65 | def notify(self): 66 | self.updated_state() 67 | asyncio.get_event_loop().call_later(5, self.notify) 68 | 69 | def update_observation_count(self, count): 70 | if count: 71 | # not that it's actually implemented like that here -- unconditional updating works just as well 72 | print("Keeping the clock nearby to trigger observations") 73 | else: 74 | print("Stowing away the clock until someone asks again") 75 | 76 | @asyncio.coroutine 77 | def render_get(self, request): 78 | payload = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S").encode('ascii') 79 | return aiocoap.Message(code=aiocoap.CONTENT, payload=payload) 80 | 81 | # logging setup 82 | logging.basicConfig(level=logging.INFO) 83 | logging.getLogger("coap-server").setLevel(logging.DEBUG) 84 | 85 | def main(): 86 | # Resource tree creation 87 | root = resource.Site() 88 | root.add_resource(('.well-known', 'core'), resource.WKCResource(root.get_resources_as_linkheader)) 89 | root.add_resource(('time',), TimeResource()) 90 | root.add_resource(('other', 'block'), BlockResource()) 91 | root.add_resource(('other', 'separate'), SeparateLargeResource()) 92 | asyncio.async(aiocoap.Context.create_server_context(root)) 93 | asyncio.get_event_loop().run_forever() 94 | 95 | if __name__ == "__main__": 96 | main() -------------------------------------------------------------------------------- /img/book.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xukai871105/the_beginning_of_coap/8410596cb2e8d5eef5196429ecbb98771fd1261e/img/book.jpg -------------------------------------------------------------------------------- /img/book_1000.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xukai871105/the_beginning_of_coap/8410596cb2e8d5eef5196429ecbb98771fd1261e/img/book_1000.jpg -------------------------------------------------------------------------------- /img/book_600.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xukai871105/the_beginning_of_coap/8410596cb2e8d5eef5196429ecbb98771fd1261e/img/book_600.jpg -------------------------------------------------------------------------------- /microsystem_device/.gitignore: -------------------------------------------------------------------------------- 1 | *.c~ 2 | *.h~ 3 | *.o 4 | *.d 5 | *.hex 6 | *.map 7 | *.elf 8 | *.a 9 | *.ld 10 | *.bin 11 | *.cc2538dk 12 | *.wxlink 13 | *.srf06-cc26xx 14 | symbols.c 15 | symbols.h 16 | *.native 17 | *.z1 18 | COOJA.log 19 | *.pcap 20 | 21 | -------------------------------------------------------------------------------- /microsystem_device/Makefile.user.include: -------------------------------------------------------------------------------- 1 | APPDIRS+=$(USER_FOLDER)/apps 2 | TARGETDIRS+=$(USER_FOLDER)/platform 3 | 4 | #define contiki folder 5 | CONTIKI=/home/user/contiki 6 | include $(CONTIKI)/Makefile.include 7 | -------------------------------------------------------------------------------- /microsystem_device/doc/sensortag/hdc1000.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xukai871105/the_beginning_of_coap/8410596cb2e8d5eef5196429ecbb98771fd1261e/microsystem_device/doc/sensortag/hdc1000.pdf -------------------------------------------------------------------------------- /microsystem_device/doc/sensortag/opt3001.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xukai871105/the_beginning_of_coap/8410596cb2e8d5eef5196429ecbb98771fd1261e/microsystem_device/doc/sensortag/opt3001.pdf -------------------------------------------------------------------------------- /microsystem_device/doc/sensortag/sensortag_sch.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xukai871105/the_beginning_of_coap/8410596cb2e8d5eef5196429ecbb98771fd1261e/microsystem_device/doc/sensortag/sensortag_sch.pdf -------------------------------------------------------------------------------- /microsystem_device/examples/ipv6/slip-radio/Makefile: -------------------------------------------------------------------------------- 1 | CONTIKI_PROJECT=slip-radio 2 | all: $(CONTIKI_PROJECT) 3 | APPS = slip-cmd 4 | 5 | ifeq ($(TARGET),) 6 | -include Makefile.target 7 | endif 8 | 9 | #CONTIKI=../../.. 10 | 11 | #linker optimizations 12 | SMALL=1 13 | 14 | CFLAGS += -DPROJECT_CONF_H=\"project-conf.h\" 15 | PROJECT_SOURCEFILES += slip-net.c no-framer.c 16 | 17 | CONTIKI_WITH_RPL = 0 18 | CONTIKI_WITH_IPV6 = 1 19 | 20 | USER_FOLDER = ../../.. 21 | include $(USER_FOLDER)/Makefile.user.include 22 | -------------------------------------------------------------------------------- /microsystem_device/examples/ipv6/slip-radio/Makefile.target: -------------------------------------------------------------------------------- 1 | TARGET = wxlink 2 | -------------------------------------------------------------------------------- /microsystem_device/examples/ipv6/slip-radio/no-framer.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009, Swedish Institute of Computer Science. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 3. Neither the name of the Institute nor the names of its contributors 14 | * may be used to endorse or promote products derived from this software 15 | * without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE 21 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 | * SUCH DAMAGE. 28 | * 29 | */ 30 | 31 | /** 32 | * \file 33 | * MAC framer that does nothing... 34 | * \author 35 | * Niclas Finne 36 | * Joakim Eriksson 37 | */ 38 | #include "net/mac/framer.h" 39 | #include "net/mac/frame802154.h" 40 | #include "net/packetbuf.h" 41 | #include 42 | 43 | #define DEBUG 0 44 | 45 | #if DEBUG 46 | #include 47 | #define PRINTF(...) printf(__VA_ARGS__) 48 | #define PRINTADDR(addr) PRINTF(" %02x%02x:%02x%02x:%02x%02x:%02x%02x ", ((uint8_t *)addr)[0], ((uint8_t *)addr)[1], ((uint8_t *)addr)[2], ((uint8_t *)addr)[3], ((uint8_t *)addr)[4], ((uint8_t *)addr)[5], ((uint8_t *)addr)[6], ((uint8_t *)addr)[7]) 49 | #else 50 | #define PRINTF(...) 51 | #define PRINTADDR(addr) 52 | #endif 53 | 54 | /** \brief The 16-bit identifier of the PAN on which the device is 55 | * sending to. If this value is 0xffff, the device is not 56 | * associated. 57 | */ 58 | static const uint16_t mac_dst_pan_id = IEEE802154_PANID; 59 | 60 | /** \brief The 16-bit identifier of the PAN on which the device is 61 | * operating. If this value is 0xffff, the device is not 62 | * associated. 63 | */ 64 | static const uint16_t mac_src_pan_id = IEEE802154_PANID; 65 | /*---------------------------------------------------------------------------*/ 66 | static int 67 | is_broadcast_addr(uint8_t mode, uint8_t *addr) 68 | { 69 | int i = mode == FRAME802154_SHORTADDRMODE ? 2 : 8; 70 | while(i-- > 0) { 71 | if(addr[i] != 0xff) { 72 | return 0; 73 | } 74 | } 75 | return 1; 76 | } 77 | /*---------------------------------------------------------------------------*/ 78 | static int 79 | hdr_length(void) 80 | { 81 | /* never adds any header */ 82 | return 0; 83 | } 84 | /*---------------------------------------------------------------------------*/ 85 | static int 86 | create(void) 87 | { 88 | /* nothing extra... */ 89 | return 0; 90 | } 91 | /*---------------------------------------------------------------------------*/ 92 | static int 93 | parse(void) 94 | { 95 | frame802154_t frame; 96 | int len; 97 | len = packetbuf_datalen(); 98 | if(frame802154_parse(packetbuf_dataptr(), len, &frame)) { 99 | if(frame.fcf.dest_addr_mode) { 100 | if(frame.dest_pid != mac_src_pan_id && 101 | frame.dest_pid != FRAME802154_BROADCASTPANDID) { 102 | /* Packet to another PAN */ 103 | PRINTF("15.4: for another pan %u\n", frame.dest_pid); 104 | return 0; 105 | } 106 | if(!is_broadcast_addr(frame.fcf.dest_addr_mode, frame.dest_addr)) { 107 | packetbuf_set_addr(PACKETBUF_ADDR_RECEIVER, (linkaddr_t *)&frame.dest_addr); 108 | } 109 | } 110 | packetbuf_set_addr(PACKETBUF_ADDR_SENDER, (linkaddr_t *)&frame.src_addr); 111 | packetbuf_set_attr(PACKETBUF_ATTR_PENDING, frame.fcf.frame_pending); 112 | packetbuf_set_attr(PACKETBUF_ATTR_MAC_SEQNO, frame.seq); 113 | 114 | PRINTF("15.4-IN: %2X", frame.fcf.frame_type); 115 | PRINTADDR(packetbuf_addr(PACKETBUF_ADDR_SENDER)); 116 | PRINTADDR(packetbuf_addr(PACKETBUF_ADDR_RECEIVER)); 117 | PRINTF("%u (%u)\n", packetbuf_datalen(), len); 118 | 119 | return 0; 120 | } 121 | return 0; 122 | } 123 | /*---------------------------------------------------------------------------*/ 124 | const struct framer no_framer = { 125 | hdr_length, 126 | create, 127 | parse 128 | }; 129 | -------------------------------------------------------------------------------- /microsystem_device/examples/ipv6/slip-radio/project-conf.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010, Swedish Institute of Computer Science. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 3. Neither the name of the Institute nor the names of its contributors 14 | * may be used to endorse or promote products derived from this software 15 | * without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE 21 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 | * SUCH DAMAGE. 28 | */ 29 | 30 | #ifndef PROJECT_CONF_H_ 31 | #define PROJECT_CONF_H_ 32 | 33 | #undef QUEUEBUF_CONF_NUM 34 | #define QUEUEBUF_CONF_NUM 4 35 | 36 | //#undef UIP_CONF_BUFFER_SIZE 37 | //#define UIP_CONF_BUFFER_SIZE 140 38 | 39 | #undef UIP_CONF_ROUTER 40 | #define UIP_CONF_ROUTER 0 41 | 42 | #define CMD_CONF_OUTPUT slip_radio_cmd_output 43 | 44 | /* add the cmd_handler_cc2420 + some sensors if TARGET_SKY */ 45 | #ifdef CONTIKI_TARGET_SKY 46 | #define CMD_CONF_HANDLERS slip_radio_cmd_handler,cmd_handler_cc2420 47 | #define SLIP_RADIO_CONF_SENSORS slip_radio_sky_sensors 48 | /* add the cmd_handler_rf230 if TARGET_NOOLIBERRY. Other RF230 platforms can be added */ 49 | #elif CONTIKI_TARGET_NOOLIBERRY 50 | #define CMD_CONF_HANDLERS slip_radio_cmd_handler,cmd_handler_rf230 51 | #elif CONTIKI_TARGET_ECONOTAG 52 | #define CMD_CONF_HANDLERS slip_radio_cmd_handler,cmd_handler_mc1322x 53 | #else 54 | #define CMD_CONF_HANDLERS slip_radio_cmd_handler 55 | #endif 56 | 57 | 58 | /* configuration for the slipradio/network driver */ 59 | #undef NETSTACK_CONF_MAC 60 | #define NETSTACK_CONF_MAC nullmac_driver 61 | 62 | #undef NETSTACK_CONF_RDC 63 | /* #define NETSTACK_CONF_RDC nullrdc_noframer_driver */ 64 | #define NETSTACK_CONF_RDC contikimac_driver 65 | 66 | #undef NETSTACK_CONF_NETWORK 67 | #define NETSTACK_CONF_NETWORK slipnet_driver 68 | 69 | #undef NETSTACK_CONF_FRAMER 70 | #define NETSTACK_CONF_FRAMER no_framer 71 | 72 | #undef CC2420_CONF_AUTOACK 73 | #define CC2420_CONF_AUTOACK 1 74 | 75 | #undef UART1_CONF_RX_WITH_DMA 76 | #define UART1_CONF_RX_WITH_DMA 1 77 | 78 | #endif /* PROJECT_CONF_H_ */ 79 | -------------------------------------------------------------------------------- /microsystem_device/examples/ipv6/slip-radio/slip-net.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011, Swedish Institute of Computer Science. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 3. Neither the name of the Institute nor the names of its contributors 14 | * may be used to endorse or promote products derived from this software 15 | * without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE 21 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 | * SUCH DAMAGE. 28 | */ 29 | 30 | #include "contiki.h" 31 | #include "net/netstack.h" 32 | #include "net/ip/uip.h" 33 | #include "net/packetbuf.h" 34 | #include "dev/slip.h" 35 | #include 36 | 37 | #define SLIP_END 0300 38 | #define SLIP_ESC 0333 39 | #define SLIP_ESC_END 0334 40 | #define SLIP_ESC_ESC 0335 41 | 42 | #define DEBUG 0 43 | 44 | /*---------------------------------------------------------------------------*/ 45 | void 46 | slipnet_init(void) 47 | { 48 | } 49 | /*---------------------------------------------------------------------------*/ 50 | void 51 | slip_send_packet(const uint8_t *ptr, int len) 52 | { 53 | uint16_t i; 54 | uint8_t c; 55 | 56 | slip_arch_writeb(SLIP_END); 57 | for(i = 0; i < len; ++i) { 58 | c = *ptr++; 59 | if(c == SLIP_END) { 60 | slip_arch_writeb(SLIP_ESC); 61 | c = SLIP_ESC_END; 62 | } else if(c == SLIP_ESC) { 63 | slip_arch_writeb(SLIP_ESC); 64 | c = SLIP_ESC_ESC; 65 | } 66 | slip_arch_writeb(c); 67 | } 68 | slip_arch_writeb(SLIP_END); 69 | } 70 | /*---------------------------------------------------------------------------*/ 71 | void 72 | slipnet_input(void) 73 | { 74 | int i; 75 | /* radio should be configured for filtering so this should be simple */ 76 | /* this should be sent over SLIP! */ 77 | /* so just copy into uip-but and send!!! */ 78 | /* Format: !R ? */ 79 | uip_len = packetbuf_datalen(); 80 | i = packetbuf_copyto(uip_buf); 81 | 82 | if(DEBUG) { 83 | printf("Slipnet got input of len: %d, copied: %d\n", 84 | packetbuf_datalen(), i); 85 | 86 | for(i = 0; i < uip_len; i++) { 87 | printf("%02x", (unsigned char) uip_buf[i]); 88 | if((i & 15) == 15) printf("\n"); 89 | else if((i & 7) == 7) printf(" "); 90 | } 91 | printf("\n"); 92 | } 93 | 94 | /* printf("SUT: %u\n", uip_len); */ 95 | slip_send_packet(uip_buf, uip_len); 96 | } 97 | /*---------------------------------------------------------------------------*/ 98 | const struct network_driver slipnet_driver = { 99 | "slipnet", 100 | slipnet_init, 101 | slipnet_input 102 | }; 103 | /*---------------------------------------------------------------------------*/ 104 | -------------------------------------------------------------------------------- /microsystem_device/examples/ipv6/slip-radio/slip-radio.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011, Swedish Institute of Computer Science. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 3. Neither the name of the Institute nor the names of its contributors 14 | * may be used to endorse or promote products derived from this software 15 | * without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE 21 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 | * SUCH DAMAGE. 28 | * 29 | */ 30 | 31 | #ifndef SLIP_RADIO_H_ 32 | #define SLIP_RADIO_H_ 33 | 34 | struct slip_radio_sensors { 35 | /** Initialize the driver */ 36 | void (* init)(void); 37 | /** Send the sensor data packet via the command send */ 38 | void (* send)(void); 39 | }; 40 | 41 | #endif /* SLIP_RADIO_H_ */ 42 | -------------------------------------------------------------------------------- /microsystem_device/examples/sensortag/coap-client-sensor/Makefile: -------------------------------------------------------------------------------- 1 | # make BOARD=sensortag/cc2650 2 | DEFINES+=PROJECT_CONF_H=\"project-conf.h\" 3 | DEFINES+=STARTUP_CONF_VERBOSE=1 4 | 5 | all: coap-client-sensor 6 | # linker optimizations 7 | # SMALL=1 8 | 9 | # REST Engine shall use Erbium CoAP implementation 10 | APPS += er-coap 11 | APPS += rest-engine 12 | 13 | PROJECT_SOURCEFILES += sensor-process.c coap-post-process.c 14 | 15 | CONTIKI_WITH_IPV6 = 1 16 | 17 | USER_FOLDER = ../../.. 18 | include $(USER_FOLDER)/Makefile.user.include 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /microsystem_device/examples/sensortag/coap-client-sensor/Makefile.target: -------------------------------------------------------------------------------- 1 | TARGET = srf06-cc26xx 2 | -------------------------------------------------------------------------------- /microsystem_device/examples/sensortag/coap-client-sensor/coap-client-sensor.c: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include 4 | #include 5 | #include "contiki.h" 6 | #include "contiki-net.h" 7 | 8 | #include "er-coap-engine.h" 9 | #include "dev/button-sensor.h" 10 | #include "dev/leds.h" 11 | #include "board-peripherals.h" 12 | #include "ip64-addr.h" 13 | #include "ieee-addr.h" 14 | 15 | #include "sensor-process.h" 16 | #include "coap-post-process.h" 17 | 18 | #define DEBUG DEBUG_PRINT 19 | #include "net/ip/uip-debug.h" 20 | 21 | PROCESS(start_process, "start process"); 22 | AUTOSTART_PROCESSES(&start_process); 23 | /*---------------------------------------------------------------------------*/ 24 | PROCESS_THREAD(start_process, ev, data) 25 | { 26 | static struct etimer et_red; 27 | PROCESS_BEGIN(); 28 | 29 | etimer_set(&et_red, CLOCK_SECOND / 8); 30 | printf("system start!\n"); 31 | while(1) { 32 | PROCESS_YIELD(); 33 | 34 | if(ev == PROCESS_EVENT_TIMER && etimer_expired(&et_red)) { 35 | if(uip_ds6_get_global(ADDR_PREFERRED) != NULL) { 36 | leds_off(LEDS_RED); 37 | printf("device has joined the net\n"); 38 | process_start(&sensor_process, NULL); 39 | process_start(&coap_post_process, NULL); 40 | } else { 41 | leds_toggle(LEDS_RED); 42 | etimer_set(&et_red, CLOCK_SECOND / 8); 43 | } 44 | } 45 | } 46 | 47 | PROCESS_END(); 48 | } 49 | -------------------------------------------------------------------------------- /microsystem_device/examples/sensortag/coap-client-sensor/coap-post-process.c: -------------------------------------------------------------------------------- 1 | 2 | #include "coap-post-process.h" 3 | #include "sensor-process.h" 4 | 5 | #define DEBUG DEBUG_PRINT 6 | #include "net/ip/uip-debug.h" 7 | 8 | #define LOCAL_PORT UIP_HTONS(COAP_DEFAULT_PORT + 1) 9 | #define REMOTE_PORT UIP_HTONS(COAP_DEFAULT_PORT) 10 | 11 | uip_ipaddr_t server_ipaddr; 12 | 13 | /* This function is will be passed to COAP_BLOCKING_REQUEST() to handle responses. */ 14 | void 15 | client_chunk_handler(void *response) 16 | { 17 | const uint8_t *chunk; 18 | int len = coap_get_payload(response, &chunk); 19 | printf("coap response payload:\n"); 20 | printf("[%d]%s\n", len, (char *)chunk); 21 | } 22 | PROCESS(coap_post_process, "coap client"); 23 | PROCESS_THREAD(coap_post_process, ev, data) 24 | { 25 | PROCESS_BEGIN(); 26 | printf("coap post process start!\n"); 27 | 28 | static coap_packet_t request[1]; 29 | 30 | uip_ip4addr_t ip4addr; 31 | uip_ipaddr(&ip4addr, 192, 168, 0, 9); 32 | 33 | ip64_addr_4to6(&ip4addr, &server_ipaddr); 34 | PRINTF("Server address: "); 35 | PRINT6ADDR(&server_ipaddr); 36 | PRINTF("\n"); 37 | 38 | uint8_t dev_addr[8]; 39 | ieee_addr_cpy_to(dev_addr, 8); 40 | 41 | static char url[32]; 42 | sprintf(url, "devices/%02X%02X", dev_addr[6], dev_addr[7]); 43 | PRINTF("device url: %s\n", url); 44 | /* receives all CoAP messages */ 45 | coap_init_engine(); 46 | 47 | while(1) { 48 | PROCESS_YIELD(); 49 | if (ev == sensor_data_ready) { 50 | printf("take sensor date ready event\n"); 51 | sensor_data_t sensor_take = *(sensor_data_t*)data; 52 | coap_init_message(request, COAP_TYPE_CON, COAP_POST, 0); 53 | // coap_set_token(request, (uint8_t*)"1234", 4); 54 | coap_set_header_uri_path(request, url); 55 | coap_set_header_content_format(request, APPLICATION_JSON); 56 | 57 | char payload[32]; 58 | memset(payload, 0x00, 32); 59 | int len = sprintf(payload, "{\"temp\":%d, \"hum\":%d, \"light\":%d}", 60 | sensor_take.temp, sensor_take.hum, sensor_take.light); 61 | coap_set_payload(request, (uint8_t *)payload, len); 62 | 63 | printf("coap request payload: %s\n", payload); 64 | PRINT6ADDR(&server_ipaddr); PRINTF(" : %u\n", UIP_HTONS(REMOTE_PORT)); 65 | 66 | COAP_BLOCKING_REQUEST(&server_ipaddr, REMOTE_PORT, request, 67 | client_chunk_handler); 68 | } 69 | } 70 | 71 | PROCESS_END(); 72 | } 73 | -------------------------------------------------------------------------------- /microsystem_device/examples/sensortag/coap-client-sensor/coap-post-process.h: -------------------------------------------------------------------------------- 1 | #ifndef __COAP_POST_PROCESS_H 2 | #define __COAP_POST_PROCESS_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include "contiki.h" 8 | #include "contiki-net.h" 9 | 10 | #include "er-coap-engine.h" 11 | #include "dev/button-sensor.h" 12 | #include "dev/leds.h" 13 | #include "board-peripherals.h" 14 | #include "ip64-addr.h" 15 | #include "ieee-addr.h" 16 | 17 | PROCESS_NAME(coap_post_process); 18 | 19 | #endif -------------------------------------------------------------------------------- /microsystem_device/examples/sensortag/coap-client-sensor/project-conf.h: -------------------------------------------------------------------------------- 1 | #ifndef __PROJECT_ERBIUM_CONF_H__ 2 | #define __PROJECT_ERBIUM_CONF_H__ 3 | 4 | 5 | /* Disabling RDC and CSMA for demo purposes. Core updates often 6 | require more memory. */ 7 | /* For projects, optimize memory and enable RDC and CSMA again. */ 8 | //#undef NETSTACK_CONF_RDC 9 | //#define NETSTACK_CONF_RDC nullrdc_driver 10 | 11 | /* Disabling TCP on CoAP nodes. */ 12 | //#undef UIP_CONF_TCP 13 | //#define UIP_CONF_TCP 0 14 | 15 | //#undef NETSTACK_CONF_MAC 16 | //#define NETSTACK_CONF_MAC nullmac_driver 17 | 18 | /* Increase rpl-border-router IP-buffer when using more than 64. */ 19 | #undef REST_MAX_CHUNK_SIZE 20 | #define REST_MAX_CHUNK_SIZE 64 21 | 22 | /* Estimate your header size, especially when using Proxy-Uri. */ 23 | /* 24 | #undef COAP_MAX_HEADER_SIZE 25 | #define COAP_MAX_HEADER_SIZE 70 26 | */ 27 | 28 | /* Multiplies with chunk size, be aware of memory constraints. */ 29 | #undef COAP_MAX_OPEN_TRANSACTIONS 30 | #define COAP_MAX_OPEN_TRANSACTIONS 4 31 | 32 | /* Must be <= open transactions, default is COAP_MAX_OPEN_TRANSACTIONS-1. */ 33 | /* 34 | #undef COAP_MAX_OBSERVERS 35 | #define COAP_MAX_OBSERVERS 2 36 | */ 37 | 38 | /* Filtering .well-known/core per query can be disabled to save space. */ 39 | #undef COAP_LINK_FORMAT_FILTERING 40 | #define COAP_LINK_FORMAT_FILTERING 0 41 | #undef COAP_PROXY_OPTION_PROCESSING 42 | #define COAP_PROXY_OPTION_PROCESSING 0 43 | 44 | /* Enable client-side support for COAP observe */ 45 | #define COAP_OBSERVE_CLIENT 1 46 | #endif /* __PROJECT_ERBIUM_CONF_H__ */ 47 | -------------------------------------------------------------------------------- /microsystem_device/examples/sensortag/coap-client-sensor/sensor-process.c: -------------------------------------------------------------------------------- 1 | #include "sensor-process.h" 2 | #include "coap-post-process.h" 3 | 4 | #define DEBUG DEBUG_PRINT 5 | #include "net/ip/uip-debug.h" 6 | 7 | static struct etimer et; 8 | process_event_t sensor_data_ready; 9 | sensor_data_t sensor_give; 10 | /*---------------------------------------------------------------------------*/ 11 | static void get_hdc_reading() 12 | { 13 | int value; 14 | value = hdc_1000_sensor.value(HDC_1000_SENSOR_TYPE_TEMP); 15 | if(value != CC26XX_SENSOR_READING_ERROR) { 16 | sensor_give.temp = value / 100; 17 | printf("HDC: Temp = %d.%02d C\n", value / 100, value % 100); 18 | } 19 | 20 | value = hdc_1000_sensor.value(HDC_1000_SENSOR_TYPE_HUMIDITY); 21 | if(value != CC26XX_SENSOR_READING_ERROR) { 22 | sensor_give.hum = value / 100; 23 | printf("HDC: Humidity = %d.%02d %%RH\n", value / 100, value % 100); 24 | } 25 | } 26 | /*---------------------------------------------------------------------------*/ 27 | static void get_light_reading() 28 | { 29 | int value; 30 | value = opt_3001_sensor.value(0); 31 | if(value != CC26XX_SENSOR_READING_ERROR) { 32 | sensor_give.light = value / 100; 33 | printf("OPT: Light = %d.%02d lux\n", value / 100, value % 100); 34 | } 35 | } 36 | PROCESS(sensor_process, "sensor monitoring"); 37 | PROCESS_THREAD(sensor_process, ev, data) 38 | { 39 | PROCESS_BEGIN(); 40 | printf("sensor process start!\n"); 41 | sensor_data_ready = process_alloc_event(); 42 | 43 | etimer_set(&et, CLOCK_SECOND * 60); 44 | 45 | while(1) { 46 | PROCESS_YIELD(); 47 | 48 | if(ev == PROCESS_EVENT_TIMER && data == &et) { 49 | printf("start to acquire sensor data\n"); 50 | SENSORS_ACTIVATE(opt_3001_sensor); 51 | etimer_set(&et, CLOCK_SECOND * 60); 52 | } else if(ev == sensors_event && data == &opt_3001_sensor) { 53 | get_light_reading(); 54 | SENSORS_ACTIVATE(hdc_1000_sensor); 55 | } else if(ev == sensors_event && data == &hdc_1000_sensor) { 56 | get_hdc_reading(); 57 | process_post(&coap_post_process, sensor_data_ready, (void *)&sensor_give); 58 | } 59 | 60 | } 61 | PROCESS_END(); 62 | } 63 | -------------------------------------------------------------------------------- /microsystem_device/examples/sensortag/coap-client-sensor/sensor-process.h: -------------------------------------------------------------------------------- 1 | #ifndef __SENSOR_PROCESS_H__ 2 | #define __SENSOR_PROCESS_H__ 3 | #include 4 | #include 5 | #include 6 | #include "contiki.h" 7 | #include "contiki-net.h" 8 | #include "er-coap-engine.h" 9 | #include "dev/button-sensor.h" 10 | #include "dev/leds.h" 11 | #include "board-peripherals.h" 12 | 13 | extern process_event_t sensor_data_ready; 14 | typedef struct sensor_data_{ 15 | int temp; 16 | int hum; 17 | int light; 18 | } sensor_data_t; 19 | 20 | PROCESS_NAME(sensor_process); 21 | #endif 22 | 23 | -------------------------------------------------------------------------------- /microsystem_device/examples/sensortag/coap-client/Makefile: -------------------------------------------------------------------------------- 1 | # make BOARD=sensortag/cc2650 2 | DEFINES+=PROJECT_CONF_H=\"project-conf.h\" 3 | DEFINES+=STARTUP_CONF_VERBOSE=1 4 | 5 | all: coap-client 6 | # linker optimizations 7 | # SMALL=1 8 | 9 | # REST Engine shall use Erbium CoAP implementation 10 | APPS += er-coap 11 | APPS += rest-engine 12 | 13 | CONTIKI_WITH_IPV6 = 1 14 | 15 | USER_FOLDER = ../../.. 16 | include $(USER_FOLDER)/Makefile.user.include 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /microsystem_device/examples/sensortag/coap-client/Makefile.target: -------------------------------------------------------------------------------- 1 | TARGET = srf06-cc26xx 2 | -------------------------------------------------------------------------------- /microsystem_device/examples/sensortag/coap-client/coap-client.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include "contiki.h" 5 | #include "contiki-net.h" 6 | #include "er-coap-engine.h" 7 | #include "dev/button-sensor.h" 8 | #include "dev/leds.h" 9 | #include "ip64-addr.h" 10 | 11 | #define DEBUG DEBUG_PRINT 12 | #include "net/ip/uip-debug.h" 13 | 14 | #define LOCAL_PORT UIP_HTONS(COAP_DEFAULT_PORT + 1) 15 | #define REMOTE_PORT UIP_HTONS(COAP_DEFAULT_PORT) 16 | 17 | uip_ipaddr_t server_ipaddr; 18 | 19 | PROCESS(coap_client_example, "coap client example"); 20 | PROCESS(hello_world_process, "hello world process"); 21 | AUTOSTART_PROCESSES(&hello_world_process); 22 | /*---------------------------------------------------------------------------*/ 23 | PROCESS_THREAD(hello_world_process, ev, data) 24 | { 25 | static struct etimer et_red; 26 | PROCESS_BEGIN(); 27 | 28 | etimer_set(&et_red, CLOCK_SECOND / 8); 29 | printf("hello world!\n"); 30 | while(1) { 31 | PROCESS_YIELD(); 32 | 33 | if(ev == PROCESS_EVENT_TIMER && etimer_expired(&et_red)) { 34 | if(uip_ds6_get_global(ADDR_PREFERRED) != NULL) { 35 | leds_off(LEDS_RED); 36 | printf("device has joined the net\n"); 37 | process_start(&coap_client_example, NULL); 38 | } else { 39 | leds_toggle(LEDS_RED); 40 | etimer_set(&et_red, CLOCK_SECOND / 8); 41 | } 42 | } 43 | } 44 | 45 | PROCESS_END(); 46 | } 47 | 48 | void 49 | client_chunk_handler(void *response) 50 | { 51 | const uint8_t *chunk; 52 | int len = coap_get_payload(response, &chunk); 53 | printf("[%d]%s\n", len, (char *)chunk); 54 | } 55 | 56 | PROCESS_THREAD(coap_client_example, ev, data) 57 | { 58 | PROCESS_BEGIN(); 59 | 60 | /* This way the packet can be treated as pointer as usual. */ 61 | static coap_packet_t request[1]; 62 | 63 | uip_ip4addr_t ip4addr; 64 | uip_ipaddr(&ip4addr, 192, 168, 0, 3); 65 | ip64_addr_4to6(&ip4addr, &server_ipaddr); 66 | PRINTF("Server address: "); 67 | PRINT6ADDR(&server_ipaddr); 68 | PRINTF("\n"); 69 | 70 | coap_init_engine(); 71 | 72 | while(1) { 73 | 74 | PROCESS_YIELD(); 75 | if(ev == sensors_event && data == &button_sensor) { 76 | 77 | coap_init_message(request, COAP_TYPE_CON, COAP_GET, 0); 78 | coap_set_header_uri_path(request, "test-time"); 79 | 80 | PRINT6ADDR(&server_ipaddr); 81 | PRINTF(":%u\n", UIP_HTONS(REMOTE_PORT)); 82 | printf("coap response :\n"); 83 | COAP_BLOCKING_REQUEST(&server_ipaddr, REMOTE_PORT, request, 84 | client_chunk_handler); 85 | } 86 | } 87 | PROCESS_END(); 88 | } 89 | -------------------------------------------------------------------------------- /microsystem_device/examples/sensortag/coap-client/project-conf.h: -------------------------------------------------------------------------------- 1 | #ifndef __PROJECT_ERBIUM_CONF_H__ 2 | #define __PROJECT_ERBIUM_CONF_H__ 3 | 4 | /* Disabling RDC and CSMA for demo purposes. Core updates often 5 | require more memory. */ 6 | /* For projects, optimize memory and enable RDC and CSMA again. */ 7 | //#undef NETSTACK_CONF_RDC 8 | //#define NETSTACK_CONF_RDC nullrdc_driver 9 | 10 | /* Disabling TCP on CoAP nodes. */ 11 | //#undef UIP_CONF_TCP 12 | //#define UIP_CONF_TCP 0 13 | 14 | //#undef NETSTACK_CONF_MAC 15 | //#define NETSTACK_CONF_MAC nullmac_driver 16 | 17 | /* Increase rpl-border-router IP-buffer when using more than 64. */ 18 | #undef REST_MAX_CHUNK_SIZE 19 | #define REST_MAX_CHUNK_SIZE 64 20 | 21 | /* Estimate your header size, especially when using Proxy-Uri. */ 22 | /* 23 | #undef COAP_MAX_HEADER_SIZE 24 | #define COAP_MAX_HEADER_SIZE 70 25 | */ 26 | 27 | /* Multiplies with chunk size, be aware of memory constraints. */ 28 | #undef COAP_MAX_OPEN_TRANSACTIONS 29 | #define COAP_MAX_OPEN_TRANSACTIONS 4 30 | 31 | /* Must be <= open transactions, default is COAP_MAX_OPEN_TRANSACTIONS-1. */ 32 | /* 33 | #undef COAP_MAX_OBSERVERS 34 | #define COAP_MAX_OBSERVERS 2 35 | */ 36 | 37 | /* Filtering .well-known/core per query can be disabled to save space. */ 38 | #undef COAP_LINK_FORMAT_FILTERING 39 | #define COAP_LINK_FORMAT_FILTERING 0 40 | #undef COAP_PROXY_OPTION_PROCESSING 41 | #define COAP_PROXY_OPTION_PROCESSING 0 42 | 43 | /* Enable client-side support for COAP observe */ 44 | #define COAP_OBSERVE_CLIENT 1 45 | #endif /* __PROJECT_ERBIUM_CONF_H__ */ 46 | -------------------------------------------------------------------------------- /microsystem_device/examples/sensortag/hello-world/Makefile: -------------------------------------------------------------------------------- 1 | # make BOARD=sensortag/cc2650 2 | DEFINES+=PROJECT_CONF_H=\"project-conf.h\" 3 | DEFINES+=STARTUP_CONF_VERBOSE=1 4 | 5 | CONTIKI_PROJECT = hello-world 6 | all: $(CONTIKI_PROJECT) 7 | 8 | CONTIKI_WITH_IPV6 = 1 9 | 10 | USER_FOLDER = ../../.. 11 | include $(USER_FOLDER)/Makefile.user.include 12 | -------------------------------------------------------------------------------- /microsystem_device/examples/sensortag/hello-world/Makefile.target: -------------------------------------------------------------------------------- 1 | TARGET = srf06-cc26xx 2 | -------------------------------------------------------------------------------- /microsystem_device/examples/sensortag/hello-world/hello-world.c: -------------------------------------------------------------------------------- 1 | #include "contiki.h" 2 | #include "dev/leds.h" 3 | #include "net/ipv6/uip-ds6.h" 4 | #include 5 | 6 | 7 | PROCESS(hello_world_process, "hello world process"); 8 | PROCESS(simple_process, "simple process"); 9 | AUTOSTART_PROCESSES(&hello_world_process); 10 | 11 | PROCESS_THREAD(hello_world_process, ev, data) 12 | { 13 | static struct etimer et_red; 14 | PROCESS_BEGIN(); 15 | 16 | etimer_set(&et_red, CLOCK_SECOND / 8); 17 | printf("hello world!\n"); 18 | while(1) { 19 | PROCESS_YIELD(); 20 | 21 | if(ev == PROCESS_EVENT_TIMER && etimer_expired(&et_red)) { 22 | if(uip_ds6_get_global(ADDR_PREFERRED) != NULL) { 23 | leds_off(LEDS_RED); 24 | printf("device has joined the net\n"); 25 | process_start(&simple_process, NULL); 26 | } else { 27 | leds_toggle(LEDS_RED); 28 | etimer_set(&et_red, CLOCK_SECOND / 8); 29 | } 30 | } 31 | } 32 | 33 | PROCESS_END(); 34 | } 35 | 36 | PROCESS_THREAD(simple_process, ev, data) 37 | { 38 | static struct etimer et_green; 39 | PROCESS_BEGIN(); 40 | 41 | printf("simple process\n"); 42 | etimer_set(&et_green, CLOCK_SECOND / 4); 43 | 44 | while(1) { 45 | PROCESS_YIELD(); 46 | if(ev == PROCESS_EVENT_TIMER && etimer_expired(&et_green)) { 47 | leds_toggle(LEDS_GREEN); 48 | etimer_set(&et_green, CLOCK_SECOND / 4); 49 | } 50 | } 51 | PROCESS_END(); 52 | } 53 | -------------------------------------------------------------------------------- /microsystem_device/examples/sensortag/hello-world/project-conf.h: -------------------------------------------------------------------------------- 1 | #ifndef PROJECT_CONF_H_ 2 | #define PROJECT_CONF_H_ 3 | 4 | #endif /* PROJECT_CONF_H_ */ 5 | 6 | -------------------------------------------------------------------------------- /microsystem_device/examples/sensortag/nat-udp-client/Makefile: -------------------------------------------------------------------------------- 1 | # # make BOARD=sensortag/cc2650 2 | DEFINES+=PROJECT_CONF_H=\"project-conf.h\" 3 | DEFINES+=STARTUP_CONF_VERBOSE=1 4 | 5 | CONTIKI_PROJECT = udp-client 6 | all: $(CONTIKI_PROJECT) 7 | 8 | CONTIKI_WITH_IPV6 = 1 9 | 10 | USER_FOLDER = ../../.. 11 | include $(USER_FOLDER)/Makefile.user.include 12 | -------------------------------------------------------------------------------- /microsystem_device/examples/sensortag/nat-udp-client/Makefile.target: -------------------------------------------------------------------------------- 1 | TARGET = srf06-cc26xx 2 | -------------------------------------------------------------------------------- /microsystem_device/examples/sensortag/nat-udp-client/project-conf.h: -------------------------------------------------------------------------------- 1 | #ifndef PROJECT_CONF_H_ 2 | #define PROJECT_CONF_H_ 3 | 4 | #endif /* PROJECT_CONF_H_ */ 5 | -------------------------------------------------------------------------------- /microsystem_device/examples/sensortag/nat-udp-client/udp-client.c: -------------------------------------------------------------------------------- 1 | #include "contiki.h" 2 | #include 3 | #include "net/ip/uip.h" 4 | #include "net/ipv6/uip-ds6.h" 5 | #include "net/ip/uip-udp-packet.h" 6 | 7 | #include "dev/leds.h" 8 | #include "dev/button-sensor.h" 9 | 10 | #include "ip64-addr.h" 11 | 12 | #include 13 | #include 14 | 15 | #define UDP_CLIENT_PORT 8765 16 | #define UDP_SERVER_PORT 5678 17 | 18 | 19 | #define DEBUG DEBUG_PRINT 20 | #include "net/ip/uip-debug.h" 21 | 22 | #define MAX_PAYLOAD_LEN 32 23 | 24 | static struct uip_udp_conn *client_conn; 25 | static uip_ipaddr_t server_ipaddr; 26 | 27 | /*---------------------------------------------------------------------------*/ 28 | PROCESS(udp_client_process, "UDP client process"); 29 | PROCESS(hello_world_process, "hello world process"); 30 | AUTOSTART_PROCESSES(&hello_world_process); 31 | /*---------------------------------------------------------------------------*/ 32 | PROCESS_THREAD(hello_world_process, ev, data) 33 | { 34 | static struct etimer et_red; 35 | PROCESS_BEGIN(); 36 | 37 | etimer_set(&et_red, CLOCK_SECOND / 8); 38 | printf("hello world!\n"); 39 | while(1) { 40 | PROCESS_YIELD(); 41 | 42 | if(ev == PROCESS_EVENT_TIMER && etimer_expired(&et_red)) { 43 | if(uip_ds6_get_global(ADDR_PREFERRED) != NULL) { 44 | leds_off(LEDS_RED); 45 | printf("device has joined the net\n"); 46 | process_start(&udp_client_process, NULL); 47 | } else { 48 | leds_toggle(LEDS_RED); 49 | etimer_set(&et_red, CLOCK_SECOND / 8); 50 | } 51 | } 52 | } 53 | 54 | PROCESS_END(); 55 | } 56 | /*---------------------------------------------------------------------------*/ 57 | static void 58 | tcpip_handler(void) 59 | { 60 | char *str; 61 | 62 | if(uip_newdata()) { 63 | str = uip_appdata; 64 | str[uip_datalen()] = '\0'; 65 | printf("data recv [%s]\n", str); 66 | } 67 | } 68 | /*---------------------------------------------------------------------------*/ 69 | static void 70 | send_packet(void) 71 | { 72 | static int seq_id; 73 | char buf[MAX_PAYLOAD_LEN]; 74 | 75 | seq_id++; 76 | PRINTF("DATA send to %02X 'Hello %d'\n", 77 | server_ipaddr.u8[sizeof(server_ipaddr.u8) - 1], seq_id); 78 | sprintf(buf, "Hello %d from the client\r\n", seq_id); 79 | uip_udp_packet_sendto(client_conn, buf, strlen(buf), 80 | &server_ipaddr, UIP_HTONS(UDP_SERVER_PORT)); 81 | } 82 | /*---------------------------------------------------------------------------*/ 83 | static void 84 | print_local_addresses(void) 85 | { 86 | int i; 87 | uint8_t state; 88 | 89 | PRINTF("Client IPv6 Address: "); 90 | for(i = 0; i < UIP_DS6_ADDR_NB; i++) { 91 | state = uip_ds6_if.addr_list[i].state; 92 | if(uip_ds6_if.addr_list[i].isused && 93 | (state == ADDR_TENTATIVE || state == ADDR_PREFERRED)) { 94 | PRINT6ADDR(&uip_ds6_if.addr_list[i].ipaddr); 95 | PRINTF("\n"); 96 | /* hack to make address "final" */ 97 | if (state == ADDR_TENTATIVE) { 98 | uip_ds6_if.addr_list[i].state = ADDR_PREFERRED; 99 | } 100 | } 101 | } 102 | 103 | PRINTF("Server address: "); 104 | PRINT6ADDR(&server_ipaddr); 105 | PRINTF("\n"); 106 | } 107 | 108 | /*---------------------------------------------------------------------------*/ 109 | PROCESS_THREAD(udp_client_process, ev, data) 110 | { 111 | 112 | PROCESS_BEGIN(); 113 | 114 | printf("udp client process started\n"); 115 | 116 | uip_ip4addr_t ip4addr; 117 | uip_ipaddr(&ip4addr, 192, 168, 0, 3); 118 | ip64_addr_4to6(&ip4addr, &server_ipaddr); 119 | 120 | print_local_addresses(); 121 | 122 | /* new connection with remote host */ 123 | client_conn = udp_new(NULL, UIP_HTONS(UDP_SERVER_PORT), NULL); 124 | if(client_conn == NULL) { 125 | PRINTF("No UDP connection available, exiting the process!\n"); 126 | PROCESS_EXIT(); 127 | } 128 | udp_bind(client_conn, UIP_HTONS(UDP_CLIENT_PORT)); 129 | 130 | PRINTF("Created a connection with the server "); 131 | PRINT6ADDR(&client_conn->ripaddr); 132 | PRINTF(" local/remote port %u/%u\n", 133 | UIP_HTONS(client_conn->lport), UIP_HTONS(client_conn->rport)); 134 | printf("Press left button to send udp packet"); 135 | 136 | while(1) { 137 | 138 | PROCESS_YIELD(); 139 | if(ev == tcpip_event) { 140 | tcpip_handler(); 141 | } 142 | 143 | if(ev == sensors_event && data == &button_sensor) { 144 | send_packet(); 145 | } 146 | } 147 | 148 | PROCESS_END(); 149 | } 150 | /*---------------------------------------------------------------------------*/ 151 | -------------------------------------------------------------------------------- /microsystem_device/examples/sensortag/sensor-demo/Makefile: -------------------------------------------------------------------------------- 1 | CONTIKI_PROJECT = sensor-demo 2 | all: $(CONTIKI_PROJECT) 3 | 4 | DEFINES+=PROJECT_CONF_H=\"project-conf.h\" 5 | DEFINES+=STARTUP_CONF_VERBOSE=1 6 | 7 | CONTIKI_WITH_IPV6 = 1 8 | 9 | USER_FOLDER = ../../.. 10 | include $(USER_FOLDER)/Makefile.user.include 11 | -------------------------------------------------------------------------------- /microsystem_device/examples/sensortag/sensor-demo/Makefile.target: -------------------------------------------------------------------------------- 1 | TARGET = srf06-cc26xx 2 | -------------------------------------------------------------------------------- /microsystem_device/examples/sensortag/sensor-demo/project-conf.h: -------------------------------------------------------------------------------- 1 | /*---------------------------------------------------------------------------*/ 2 | #ifndef PROJECT_CONF_H_ 3 | #define PROJECT_CONF_H_ 4 | /*---------------------------------------------------------------------------*/ 5 | /* Disable button shutdown functionality */ 6 | #define BUTTON_SENSOR_CONF_ENABLE_SHUTDOWN 0 7 | /*---------------------------------------------------------------------------*/ 8 | /* Enable the ROM bootloader */ 9 | #define ROM_BOOTLOADER_ENABLE 1 10 | /*---------------------------------------------------------------------------*/ 11 | /* Change to match your configuration */ 12 | // #define IEEE802154_CONF_PANID 0xABCD 13 | // #define RF_CORE_CONF_CHANNEL 25 14 | #define RF_BLE_CONF_ENABLED 0 15 | /*---------------------------------------------------------------------------*/ 16 | #endif /* PROJECT_CONF_H_ */ 17 | /*---------------------------------------------------------------------------*/ 18 | -------------------------------------------------------------------------------- /microsystem_device/examples/sensortag/sensor-demo/readme.md: -------------------------------------------------------------------------------- 1 | make BOARD=sensortag/cc2650 2 | -------------------------------------------------------------------------------- /microsystem_device/examples/sensortag/sensor-demo/sensor-demo.c: -------------------------------------------------------------------------------- 1 | #include "contiki.h" 2 | #include "contiki-net.h" 3 | #include "sys/etimer.h" 4 | // #include "sys/ctimer.h" 5 | #include "dev/leds.h" 6 | // #include "dev/watchdog.h" 7 | // #include "random.h" 8 | #include "board-peripherals.h" 9 | // #include "rf-core/rf-ble.h" 10 | 11 | // #include "ti-lib.h" 12 | 13 | #include 14 | #include 15 | 16 | static struct etimer et; 17 | 18 | PROCESS(hello_world_process, "hello world process"); 19 | PROCESS(sensor_process, "sensor monitoring"); 20 | AUTOSTART_PROCESSES(&hello_world_process); 21 | 22 | PROCESS_THREAD(hello_world_process, ev, data) 23 | { 24 | static struct etimer et_red; 25 | PROCESS_BEGIN(); 26 | 27 | etimer_set(&et_red, CLOCK_SECOND / 8); 28 | printf("hello world!\n"); 29 | while(1) { 30 | PROCESS_YIELD(); 31 | 32 | if(ev == PROCESS_EVENT_TIMER && etimer_expired(&et_red)) { 33 | if(uip_ds6_get_global(ADDR_PREFERRED) != NULL) { 34 | leds_off(LEDS_RED); 35 | printf("device has joined the net\n"); 36 | process_start(&sensor_process, NULL); 37 | } else { 38 | leds_toggle(LEDS_RED); 39 | etimer_set(&et_red, CLOCK_SECOND / 8); 40 | } 41 | } 42 | } 43 | 44 | PROCESS_END(); 45 | } 46 | 47 | 48 | static void 49 | get_hdc_reading() 50 | { 51 | int value; 52 | value = hdc_1000_sensor.value(HDC_1000_SENSOR_TYPE_TEMP); 53 | if(value != CC26XX_SENSOR_READING_ERROR) { 54 | printf("HDC: Temp=%d.%02d C\n", value / 100, value % 100); 55 | } 56 | 57 | value = hdc_1000_sensor.value(HDC_1000_SENSOR_TYPE_HUMIDITY); 58 | if(value != CC26XX_SENSOR_READING_ERROR) { 59 | printf("HDC: Humidity=%d.%02d %%RH\n", value / 100, value % 100); 60 | } 61 | } 62 | 63 | static void 64 | get_light_reading() 65 | { 66 | int value; 67 | value = opt_3001_sensor.value(0); 68 | if(value != CC26XX_SENSOR_READING_ERROR) { 69 | printf("OPT: Light=%d.%02d lux\n", value / 100, value % 100); 70 | } 71 | } 72 | 73 | 74 | PROCESS_THREAD(sensor_process, ev, data) 75 | { 76 | 77 | PROCESS_BEGIN(); 78 | printf("sensor process start!\n"); 79 | 80 | // init_sensors(); 81 | // SENSORS_ACTIVATE(batmon_sensor); 82 | 83 | /* Init the BLE advertisement daemon */ 84 | // rf_ble_beacond_config(0, BOARD_STRING); 85 | // rf_ble_beacond_start(); 86 | 87 | etimer_set(&et, CLOCK_SECOND * 20); 88 | // get_sync_sensor_readings(); 89 | // init_sensor_readings(); 90 | 91 | while(1) { 92 | 93 | PROCESS_YIELD(); 94 | 95 | if(ev == PROCESS_EVENT_TIMER && data == &et) { 96 | etimer_set(&et, CLOCK_SECOND * 20); 97 | SENSORS_ACTIVATE(hdc_1000_sensor); 98 | } else if(ev == sensors_event && data == &hdc_1000_sensor) { 99 | get_hdc_reading(); 100 | SENSORS_ACTIVATE(opt_3001_sensor); 101 | }else if(ev == sensors_event && data == &opt_3001_sensor) { 102 | get_light_reading(); 103 | } 104 | } 105 | 106 | PROCESS_END(); 107 | } 108 | -------------------------------------------------------------------------------- /microsystem_device/examples/wxlink/coap-client/Makefile: -------------------------------------------------------------------------------- 1 | all: er-example-client 2 | 3 | #CONTIKI=../.. 4 | #CONTIKI=/home/user/contiki-3.0 5 | 6 | CFLAGS += -DPROJECT_CONF_H=\"project-conf.h\" 7 | 8 | # linker optimizations 9 | SMALL=1 10 | 11 | # REST Engine shall use Erbium CoAP implementation 12 | APPS += er-coap 13 | APPS += rest-engine 14 | 15 | 16 | CONTIKI_WITH_IPV6 = 1 17 | 18 | USER_FOLDER = ../../.. 19 | include $(USER_FOLDER)/Makefile.user.include 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /microsystem_device/examples/wxlink/coap-client/Makefile.target: -------------------------------------------------------------------------------- 1 | TARGET = wxlink 2 | -------------------------------------------------------------------------------- /microsystem_device/examples/wxlink/coap-client/er-example-client.c: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * \file 4 | * Erbium (Er) CoAP client example. 5 | * \author 6 | * Matthias Kovatsch 7 | */ 8 | 9 | #include 10 | #include 11 | #include 12 | #include "contiki.h" 13 | #include "contiki-net.h" 14 | #include "er-coap-engine.h" 15 | #include "dev/button-sensor.h" 16 | #include "dev/leds.h" 17 | #include "ip64-addr.h" 18 | 19 | #define COAP_HEART 1 20 | #define DEBUG 1 21 | #if DEBUG 22 | #include 23 | #define PRINTF(...) printf(__VA_ARGS__) 24 | #define PRINT6ADDR(addr) PRINTF("[%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x]", ((uint8_t *)addr)[0], ((uint8_t *)addr)[1], ((uint8_t *)addr)[2], ((uint8_t *)addr)[3], ((uint8_t *)addr)[4], ((uint8_t *)addr)[5], ((uint8_t *)addr)[6], ((uint8_t *)addr)[7], ((uint8_t *)addr)[8], ((uint8_t *)addr)[9], ((uint8_t *)addr)[10], ((uint8_t *)addr)[11], ((uint8_t *)addr)[12], ((uint8_t *)addr)[13], ((uint8_t *)addr)[14], ((uint8_t *)addr)[15]) 25 | #define PRINTLLADDR(lladdr) PRINTF("[%02x:%02x:%02x:%02x:%02x:%02x]", (lladdr)->addr[0], (lladdr)->addr[1], (lladdr)->addr[2], (lladdr)->addr[3], (lladdr)->addr[4], (lladdr)->addr[5]) 26 | #else 27 | #define PRINTF(...) 28 | #define PRINT6ADDR(addr) 29 | #define PRINTLLADDR(addr) 30 | #endif 31 | 32 | #define LOCAL_PORT UIP_HTONS(COAP_DEFAULT_PORT + 1) 33 | #define REMOTE_PORT UIP_HTONS(COAP_DEFAULT_PORT) 34 | 35 | PROCESS(er_example_client, "Erbium Example Client"); 36 | AUTOSTART_PROCESSES(&er_example_client); 37 | 38 | uip_ipaddr_t server_ipaddr; 39 | 40 | 41 | /* This function is will be passed to COAP_BLOCKING_REQUEST() to handle responses. */ 42 | void 43 | client_chunk_handler(void *response) 44 | { 45 | const uint8_t *chunk; 46 | 47 | int len = coap_get_payload(response, &chunk); 48 | 49 | printf("[%d]%s\n", len, (char *)chunk); 50 | } 51 | 52 | PROCESS_THREAD(er_example_client, ev, data) 53 | { 54 | PROCESS_BEGIN(); 55 | 56 | static coap_packet_t request[1]; /* This way the packet can be treated as pointer as usual. */ 57 | 58 | uip_ip4addr_t ip4addr; 59 | uip_ipaddr(&ip4addr, 192, 168, 0, 3); 60 | 61 | ip64_addr_4to6(&ip4addr, &server_ipaddr); 62 | PRINTF("Server address: "); 63 | PRINT6ADDR(&server_ipaddr); 64 | PRINTF("\n"); 65 | 66 | /* receives all CoAP messages */ 67 | coap_init_engine(); 68 | 69 | //etimer_set(&et, ER_COAP_DEMO_NET_CONNECT_PERIODIC); 70 | 71 | while(1) { 72 | PROCESS_YIELD(); 73 | 74 | if(ev == sensors_event && data == &button_left_sensor) { 75 | printf("left button press\n"); 76 | // send_packet(); 77 | 78 | coap_init_message(request, COAP_TYPE_CON, COAP_GET, 0); 79 | coap_set_header_uri_path(request, "time"); 80 | PRINT6ADDR(&server_ipaddr); 81 | PRINTF(" : %u\n", UIP_HTONS(REMOTE_PORT)); 82 | printf("uri hello coap response :\n"); 83 | COAP_BLOCKING_REQUEST(&server_ipaddr, REMOTE_PORT, request, 84 | client_chunk_handler); 85 | } 86 | 87 | } 88 | PROCESS_END(); 89 | } 90 | -------------------------------------------------------------------------------- /microsystem_device/examples/wxlink/coap-client/project-conf.h: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * \file 4 | * Erbium (Er) example project configuration. 5 | * \author 6 | * Matthias Kovatsch 7 | */ 8 | 9 | #ifndef __PROJECT_ERBIUM_CONF_H__ 10 | #define __PROJECT_ERBIUM_CONF_H__ 11 | 12 | 13 | /* Disabling RDC and CSMA for demo purposes. Core updates often 14 | require more memory. */ 15 | /* For projects, optimize memory and enable RDC and CSMA again. */ 16 | #undef NETSTACK_CONF_RDC 17 | #define NETSTACK_CONF_RDC nullrdc_driver 18 | 19 | /* Disabling TCP on CoAP nodes. */ 20 | #undef UIP_CONF_TCP 21 | #define UIP_CONF_TCP 0 22 | 23 | #undef NETSTACK_CONF_MAC 24 | #define NETSTACK_CONF_MAC nullmac_driver 25 | 26 | /* Increase rpl-border-router IP-buffer when using more than 64. */ 27 | #undef REST_MAX_CHUNK_SIZE 28 | #define REST_MAX_CHUNK_SIZE 48 29 | 30 | /* Estimate your header size, especially when using Proxy-Uri. */ 31 | /* 32 | #undef COAP_MAX_HEADER_SIZE 33 | #define COAP_MAX_HEADER_SIZE 70 34 | */ 35 | 36 | /* Multiplies with chunk size, be aware of memory constraints. */ 37 | #undef COAP_MAX_OPEN_TRANSACTIONS 38 | #define COAP_MAX_OPEN_TRANSACTIONS 4 39 | 40 | /* Must be <= open transactions, default is COAP_MAX_OPEN_TRANSACTIONS-1. */ 41 | /* 42 | #undef COAP_MAX_OBSERVERS 43 | #define COAP_MAX_OBSERVERS 2 44 | */ 45 | 46 | /* Filtering .well-known/core per query can be disabled to save space. */ 47 | #undef COAP_LINK_FORMAT_FILTERING 48 | #define COAP_LINK_FORMAT_FILTERING 0 49 | #undef COAP_PROXY_OPTION_PROCESSING 50 | #define COAP_PROXY_OPTION_PROCESSING 0 51 | 52 | /* Enable client-side support for COAP observe */ 53 | #define COAP_OBSERVE_CLIENT 1 54 | #endif /* __PROJECT_ERBIUM_CONF_H__ */ 55 | -------------------------------------------------------------------------------- /microsystem_device/examples/wxlink/hello-world/Makefile: -------------------------------------------------------------------------------- 1 | DEFINES+=PROJECT_CONF_H=\"project-conf.h\" 2 | CONTIKI_PROJECT=hello-world 3 | 4 | all: $(CONTIKI_PROJECT) 5 | 6 | CONTIKI_WITH_IPV6 = 1 7 | 8 | USER_FOLDER = ../../.. 9 | include $(USER_FOLDER)/Makefile.user.include 10 | -------------------------------------------------------------------------------- /microsystem_device/examples/wxlink/hello-world/Makefile.target: -------------------------------------------------------------------------------- 1 | TARGET = wxlink 2 | -------------------------------------------------------------------------------- /microsystem_device/examples/wxlink/hello-world/hello-world.c: -------------------------------------------------------------------------------- 1 | 2 | #include "contiki.h" 3 | #include "net/ipv6/uip-ds6.h" 4 | #include "dev/leds.h" 5 | #include 6 | 7 | static struct etimer et; 8 | static struct ctimer ct; 9 | 10 | /* A timeout used when waiting to connect to a network */ 11 | #define ER_COAP_DEMO_NET_CONNECT_PERIODIC (CLOCK_SECOND >> 3) 12 | /* Provide visible feedback via LEDS while searching for a network */ 13 | #define ER_COAP_NO_NET_LED_DURATION (ER_COAP_DEMO_NET_CONNECT_PERIODIC >> 1) 14 | 15 | static void 16 | net_led_off(void *d) 17 | { 18 | leds_off(LEDS_RED); 19 | } 20 | 21 | /*---------------------------------------------------------------------------*/ 22 | PROCESS(hello_world_process, "Hello World Process"); 23 | AUTOSTART_PROCESSES(&hello_world_process); 24 | /*---------------------------------------------------------------------------*/ 25 | PROCESS_THREAD(hello_world_process, ev, data) 26 | { 27 | 28 | PROCESS_BEGIN(); 29 | 30 | etimer_set(&et, ER_COAP_DEMO_NET_CONNECT_PERIODIC); 31 | 32 | while(1) 33 | { 34 | PROCESS_YIELD(); 35 | 36 | if(ev == PROCESS_EVENT_TIMER && etimer_expired(&et)) { 37 | if(uip_ds6_get_global(ADDR_PREFERRED) == NULL) { 38 | leds_on(LEDS_RED); 39 | ctimer_set(&ct, ER_COAP_NO_NET_LED_DURATION, net_led_off, NULL); 40 | etimer_set(&et, ER_COAP_DEMO_NET_CONNECT_PERIODIC); 41 | } else { 42 | leds_on(LEDS_GREEN); 43 | printf("device join in the network!\n"); 44 | printf("Hello CC2538\n"); 45 | } 46 | } 47 | } 48 | 49 | PROCESS_END(); 50 | } 51 | /*---------------------------------------------------------------------------*/ 52 | 53 | -------------------------------------------------------------------------------- /microsystem_device/examples/wxlink/hello-world/project-conf.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef PROJECT_CONF_H_ 3 | #define PROJECT_CONF_H_ 4 | 5 | #ifndef IEEE802154_CONF_PANID 6 | #define IEEE802154_CONF_PANID 0xABCD 7 | #endif 8 | 9 | #ifndef CC2538_RF_CONF_CHANNEL 10 | #define CC2538_RF_CONF_CHANNEL 26 11 | #endif /* CC2538_RF_CONF_CHANNEL */ 12 | 13 | #endif /* PROJECT_CONF_H_ */ 14 | 15 | -------------------------------------------------------------------------------- /microsystem_device/examples/wxlink/nat-udp-client/Makefile: -------------------------------------------------------------------------------- 1 | DEFINES+=PROJECT_CONF_H=\"project-conf.h\" 2 | CONTIKI_PROJECT = udp-client 3 | 4 | all: $(CONTIKI_PROJECT) 5 | 6 | CONTIKI_WITH_IPV6 = 1 7 | 8 | USER_FOLDER = ../../.. 9 | include $(USER_FOLDER)/Makefile.user.include 10 | -------------------------------------------------------------------------------- /microsystem_device/examples/wxlink/nat-udp-client/Makefile.target: -------------------------------------------------------------------------------- 1 | TARGET = wxlink 2 | -------------------------------------------------------------------------------- /microsystem_device/examples/wxlink/nat-udp-client/project-conf.h: -------------------------------------------------------------------------------- 1 | /** 2 | * \addtogroup cc2538-examples 3 | * @{ 4 | * 5 | * \file 6 | * Project specific configuration defines for the basic cc2538dk examples 7 | */ 8 | #ifndef PROJECT_CONF_H_ 9 | #define PROJECT_CONF_H_ 10 | 11 | #if 0 12 | #ifndef IEEE802154_CONF_PANID 13 | #define IEEE802154_CONF_PANID 0x1234 14 | #endif 15 | 16 | #ifndef CC2538_RF_CONF_CHANNEL 17 | #define CC2538_RF_CONF_CHANNEL 26 18 | #endif /* CC2538_RF_CONF_CHANNEL */ 19 | #endif 20 | 21 | #endif /* PROJECT_CONF_H_ */ 22 | 23 | /** @} */ 24 | -------------------------------------------------------------------------------- /microsystem_device/examples/wxlink/nat-udp-client/udp-client.c: -------------------------------------------------------------------------------- 1 | #include "contiki.h" 2 | #include "lib/random.h" 3 | #include "sys/ctimer.h" 4 | #include "net/ip/uip.h" 5 | #include "net/ipv6/uip-ds6.h" 6 | #include "net/ip/uip-udp-packet.h" 7 | 8 | #include "dev/cc2538-sensors.h" 9 | #include "dev/button-sensor.h" 10 | 11 | #include "ip64-addr.h" 12 | 13 | #include 14 | #include 15 | 16 | #define UDP_CLIENT_PORT 8765 17 | #define UDP_SERVER_PORT 5678 18 | 19 | #define UDP_EXAMPLE_ID 190 20 | 21 | #define DEBUG DEBUG_PRINT 22 | #include "net/ip/uip-debug.h" 23 | 24 | #define MAX_PAYLOAD_LEN 30 25 | 26 | static struct uip_udp_conn *client_conn; 27 | static uip_ipaddr_t server_ipaddr; 28 | 29 | /*---------------------------------------------------------------------------*/ 30 | PROCESS(udp_client_process, "UDP client process"); 31 | AUTOSTART_PROCESSES(&udp_client_process); 32 | /*---------------------------------------------------------------------------*/ 33 | static void 34 | tcpip_handler(void) 35 | { 36 | char *str; 37 | 38 | if(uip_newdata()) { 39 | str = uip_appdata; 40 | str[uip_datalen()] = '\0'; 41 | printf("DATA recv '%s'\n", str); 42 | } 43 | } 44 | /*---------------------------------------------------------------------------*/ 45 | static void 46 | send_packet(void) 47 | { 48 | static int seq_id; 49 | char buf[MAX_PAYLOAD_LEN]; 50 | 51 | seq_id++; 52 | PRINTF("DATA send to %02X 'Hello %d'\n", 53 | server_ipaddr.u8[sizeof(server_ipaddr.u8) - 1], seq_id); 54 | sprintf(buf, "Hello %d from the client\r\n", seq_id); 55 | uip_udp_packet_sendto(client_conn, buf, strlen(buf), 56 | &server_ipaddr, UIP_HTONS(UDP_SERVER_PORT)); 57 | } 58 | /*---------------------------------------------------------------------------*/ 59 | static void 60 | print_local_addresses(void) 61 | { 62 | int i; 63 | uint8_t state; 64 | 65 | PRINTF("Client IPv6 addresses: "); 66 | for(i = 0; i < UIP_DS6_ADDR_NB; i++) { 67 | state = uip_ds6_if.addr_list[i].state; 68 | if(uip_ds6_if.addr_list[i].isused && 69 | (state == ADDR_TENTATIVE || state == ADDR_PREFERRED)) { 70 | PRINT6ADDR(&uip_ds6_if.addr_list[i].ipaddr); 71 | PRINTF("\n"); 72 | /* hack to make address "final" */ 73 | if (state == ADDR_TENTATIVE) { 74 | uip_ds6_if.addr_list[i].state = ADDR_PREFERRED; 75 | } 76 | } 77 | } 78 | 79 | PRINTF("Server address: "); 80 | PRINT6ADDR(&server_ipaddr); 81 | PRINTF("\n"); 82 | } 83 | /*---------------------------------------------------------------------------*/ 84 | static void 85 | set_global_address(void) 86 | { 87 | uip_ip4addr_t ip4addr; 88 | uip_ipaddr(&ip4addr, 192, 168, 0, 3); 89 | ip64_addr_4to6(&ip4addr, &server_ipaddr); 90 | } 91 | /*---------------------------------------------------------------------------*/ 92 | PROCESS_THREAD(udp_client_process, ev, data) 93 | { 94 | 95 | PROCESS_BEGIN(); 96 | 97 | PROCESS_PAUSE(); 98 | 99 | set_global_address(); 100 | 101 | PRINTF("UDP client process started\n"); 102 | 103 | print_local_addresses(); 104 | 105 | /* new connection with remote host */ 106 | client_conn = udp_new(NULL, UIP_HTONS(UDP_SERVER_PORT), NULL); 107 | if(client_conn == NULL) { 108 | PRINTF("No UDP connection available, exiting the process!\n"); 109 | PROCESS_EXIT(); 110 | } 111 | udp_bind(client_conn, UIP_HTONS(UDP_CLIENT_PORT)); 112 | 113 | PRINTF("Created a connection with the server "); 114 | PRINT6ADDR(&client_conn->ripaddr); 115 | PRINTF(" local/remote port %u/%u\n", 116 | UIP_HTONS(client_conn->lport), UIP_HTONS(client_conn->rport)); 117 | PRINTF("Press left button to send udp packet"); 118 | 119 | while(1) { 120 | 121 | PROCESS_YIELD(); 122 | if(ev == tcpip_event) { 123 | tcpip_handler(); 124 | } 125 | 126 | if(ev == sensors_event && data == &button_left_sensor) { 127 | printf("button1 press\n"); 128 | send_packet(); 129 | } 130 | } 131 | 132 | PROCESS_END(); 133 | } 134 | /*---------------------------------------------------------------------------*/ 135 | -------------------------------------------------------------------------------- /microsystem_device/platform/wxlink/contiki-main.c: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * \addtogroup cc2538-platforms 4 | * @{ 5 | * 6 | * \defgroup cc2538dk The cc2538 Development Kit platform 7 | * 8 | * The cc2538DK is a platform by Texas Instruments, based on the 9 | * cc2538 SoC with an ARM Cortex-M3 core. 10 | * @{ 11 | * 12 | * \file 13 | * Main module for the cc2538dk platform 14 | */ 15 | /*---------------------------------------------------------------------------*/ 16 | #include "contiki.h" 17 | #include "dev/adc.h" 18 | #include "dev/leds.h" 19 | #include "dev/sys-ctrl.h" 20 | #include "dev/scb.h" 21 | #include "dev/nvic.h" 22 | #include "dev/uart.h" 23 | #include "dev/watchdog.h" 24 | #include "dev/ioc.h" 25 | #include "dev/button-sensor.h" 26 | #include "dev/serial-line.h" 27 | #include "dev/slip.h" 28 | #include "dev/cc2538-rf.h" 29 | #include "dev/udma.h" 30 | #include "dev/crypto.h" 31 | #include "usb/usb-serial.h" 32 | #include "lib/random.h" 33 | #include "net/netstack.h" 34 | #include "net/queuebuf.h" 35 | #include "net/ip/tcpip.h" 36 | #include "net/ip/uip.h" 37 | #include "net/mac/frame802154.h" 38 | #include "soc.h" 39 | #include "cpu.h" 40 | #include "reg.h" 41 | #include "ieee-addr.h" 42 | #include "lpm.h" 43 | 44 | #include 45 | #include 46 | #include 47 | /*---------------------------------------------------------------------------*/ 48 | #if STARTUP_CONF_VERBOSE 49 | #define PRINTF(...) printf(__VA_ARGS__) 50 | #else 51 | #define PRINTF(...) 52 | #endif 53 | 54 | #if UART_CONF_ENABLE 55 | #define PUTS(s) puts(s) 56 | #else 57 | #define PUTS(s) 58 | #endif 59 | /*---------------------------------------------------------------------------*/ 60 | static void 61 | fade(unsigned char l) 62 | { 63 | volatile int i; 64 | int k, j; 65 | for(k = 0; k < 800; ++k) { 66 | j = k > 400 ? 800 - k : k; 67 | 68 | leds_on(l); 69 | for(i = 0; i < j; ++i) { 70 | asm("nop"); 71 | } 72 | leds_off(l); 73 | for(i = 0; i < 400 - j; ++i) { 74 | asm("nop"); 75 | } 76 | } 77 | } 78 | /*---------------------------------------------------------------------------*/ 79 | static void 80 | set_rf_params(void) 81 | { 82 | uint16_t short_addr; 83 | uint8_t ext_addr[8]; 84 | 85 | ieee_addr_cpy_to(ext_addr, 8); 86 | 87 | short_addr = ext_addr[7]; 88 | short_addr |= ext_addr[6] << 8; 89 | 90 | /* Populate linkaddr_node_addr. Maintain endianness */ 91 | memcpy(&linkaddr_node_addr, &ext_addr[8 - LINKADDR_SIZE], LINKADDR_SIZE); 92 | 93 | #if STARTUP_CONF_VERBOSE 94 | { 95 | int i; 96 | printf("Rime configured with address "); 97 | for(i = 0; i < LINKADDR_SIZE - 1; i++) { 98 | printf("%02x:", linkaddr_node_addr.u8[i]); 99 | } 100 | printf("%02x\n", linkaddr_node_addr.u8[i]); 101 | } 102 | #endif 103 | 104 | NETSTACK_RADIO.set_value(RADIO_PARAM_PAN_ID, IEEE802154_PANID); 105 | NETSTACK_RADIO.set_value(RADIO_PARAM_16BIT_ADDR, short_addr); 106 | NETSTACK_RADIO.set_value(RADIO_PARAM_CHANNEL, CC2538_RF_CHANNEL); 107 | NETSTACK_RADIO.set_object(RADIO_PARAM_64BIT_ADDR, ext_addr, 8); 108 | } 109 | /*---------------------------------------------------------------------------*/ 110 | /** 111 | * \brief Main routine for the cc2538dk platform 112 | */ 113 | int 114 | main(void) 115 | { 116 | nvic_init(); 117 | ioc_init(); 118 | sys_ctrl_init(); 119 | clock_init(); 120 | lpm_init(); 121 | rtimer_init(); 122 | gpio_init(); 123 | 124 | leds_init(); 125 | fade(LEDS_YELLOW); 126 | 127 | process_init(); 128 | 129 | watchdog_init(); 130 | button_sensor_init(); 131 | 132 | /* 133 | * Character I/O Initialisation. 134 | * When the UART receives a character it will call serial_line_input_byte to 135 | * notify the core. The same applies for the USB driver. 136 | * 137 | * If slip-arch is also linked in afterwards (e.g. if we are a border router) 138 | * it will overwrite one of the two peripheral input callbacks. Characters 139 | * received over the relevant peripheral will be handled by 140 | * slip_input_byte instead 141 | */ 142 | #if UART_CONF_ENABLE 143 | uart_init(0); 144 | uart_init(1); 145 | uart_set_input(SERIAL_LINE_CONF_UART, serial_line_input_byte); 146 | #endif 147 | 148 | #if USB_SERIAL_CONF_ENABLE 149 | usb_serial_init(); 150 | usb_serial_set_input(serial_line_input_byte); 151 | #endif 152 | 153 | serial_line_init(); 154 | 155 | INTERRUPTS_ENABLE(); 156 | fade(LEDS_GREEN); 157 | 158 | PUTS(CONTIKI_VERSION_STRING); 159 | PUTS(BOARD_STRING); 160 | #if STARTUP_CONF_VERBOSE 161 | soc_print_info(); 162 | #endif 163 | 164 | PRINTF(" Net: "); 165 | PRINTF("%s\n", NETSTACK_NETWORK.name); 166 | PRINTF(" MAC: "); 167 | PRINTF("%s\n", NETSTACK_MAC.name); 168 | PRINTF(" RDC: "); 169 | PRINTF("%s\n", NETSTACK_RDC.name); 170 | 171 | /* Initialise the H/W RNG engine. */ 172 | random_init(0); 173 | 174 | udma_init(); 175 | 176 | process_start(&etimer_process, NULL); 177 | ctimer_init(); 178 | 179 | set_rf_params(); 180 | 181 | #if CRYPTO_CONF_INIT 182 | crypto_init(); 183 | crypto_disable(); 184 | #endif 185 | 186 | netstack_init(); 187 | 188 | #if NETSTACK_CONF_WITH_IPV6 189 | memcpy(&uip_lladdr.addr, &linkaddr_node_addr, sizeof(uip_lladdr.addr)); 190 | queuebuf_init(); 191 | process_start(&tcpip_process, NULL); 192 | #endif /* NETSTACK_CONF_WITH_IPV6 */ 193 | 194 | adc_init(); 195 | 196 | process_start(&sensors_process, NULL); 197 | 198 | energest_init(); 199 | ENERGEST_ON(ENERGEST_TYPE_CPU); 200 | 201 | autostart_start(autostart_processes); 202 | 203 | watchdog_start(); 204 | fade(LEDS_ORANGE); 205 | 206 | while(1) { 207 | uint8_t r; 208 | do { 209 | /* Reset watchdog and handle polls and events */ 210 | watchdog_periodic(); 211 | 212 | r = process_run(); 213 | } while(r > 0); 214 | 215 | /* We have serviced all pending events. Enter a Low-Power mode. */ 216 | lpm_enter(); 217 | } 218 | } 219 | /*---------------------------------------------------------------------------*/ 220 | 221 | /** 222 | * @} 223 | * @} 224 | */ 225 | -------------------------------------------------------------------------------- /microsystem_device/platform/wxlink/dev/als-sensor.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013, ADVANSEE - http://www.advansee.com/ 3 | * Benoît Thébaudeau 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 15 | * 3. Neither the name of the copyright holder nor the names of its 16 | * contributors may be used to endorse or promote products derived 17 | * from this software without specific prior written permission. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 22 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 23 | * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 24 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 25 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 26 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 28 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 30 | * OF THE POSSIBILITY OF SUCH DAMAGE. 31 | */ 32 | /** 33 | * \addtogroup cc2538dk-als-sensor 34 | * @{ 35 | * 36 | * \file 37 | * Driver for the SmartRF06EB ALS 38 | */ 39 | #include "contiki.h" 40 | #include "sys/clock.h" 41 | #include "dev/ioc.h" 42 | #include "dev/gpio.h" 43 | #include "dev/adc.h" 44 | #include "dev/als-sensor.h" 45 | 46 | #include 47 | 48 | #define ADC_ALS_PWR_PORT_BASE GPIO_PORT_TO_BASE(ADC_ALS_PWR_PORT) 49 | #define ADC_ALS_PWR_PIN_MASK GPIO_PIN_MASK(ADC_ALS_PWR_PIN) 50 | #define ADC_ALS_OUT_PIN_MASK GPIO_PIN_MASK(ADC_ALS_OUT_PIN) 51 | /*---------------------------------------------------------------------------*/ 52 | static int 53 | value(int type) 54 | { 55 | uint8_t channel = SOC_ADC_ADCCON_CH_AIN0 + ADC_ALS_OUT_PIN; 56 | int16_t res; 57 | 58 | GPIO_SET_PIN(ADC_ALS_PWR_PORT_BASE, ADC_ALS_PWR_PIN_MASK); 59 | clock_delay_usec(2000); 60 | 61 | res = adc_get(channel, SOC_ADC_ADCCON_REF_INT, SOC_ADC_ADCCON_DIV_512); 62 | 63 | GPIO_CLR_PIN(ADC_ALS_PWR_PORT_BASE, ADC_ALS_PWR_PIN_MASK); 64 | 65 | return res; 66 | } 67 | /*---------------------------------------------------------------------------*/ 68 | static int 69 | configure(int type, int value) 70 | { 71 | switch(type) { 72 | case SENSORS_HW_INIT: 73 | GPIO_SOFTWARE_CONTROL(ADC_ALS_PWR_PORT_BASE, ADC_ALS_PWR_PIN_MASK); 74 | GPIO_SET_OUTPUT(ADC_ALS_PWR_PORT_BASE, ADC_ALS_PWR_PIN_MASK); 75 | GPIO_CLR_PIN(ADC_ALS_PWR_PORT_BASE, ADC_ALS_PWR_PIN_MASK); 76 | ioc_set_over(ADC_ALS_PWR_PORT, ADC_ALS_PWR_PIN, IOC_OVERRIDE_DIS); 77 | 78 | GPIO_SOFTWARE_CONTROL(GPIO_A_BASE, ADC_ALS_OUT_PIN_MASK); 79 | GPIO_SET_INPUT(GPIO_A_BASE, ADC_ALS_OUT_PIN_MASK); 80 | ioc_set_over(GPIO_A_NUM, ADC_ALS_OUT_PIN, IOC_OVERRIDE_ANA); 81 | 82 | break; 83 | } 84 | return 0; 85 | } 86 | /*---------------------------------------------------------------------------*/ 87 | static int 88 | status(int type) 89 | { 90 | return 1; 91 | } 92 | /*---------------------------------------------------------------------------*/ 93 | SENSORS_SENSOR(als_sensor, ALS_SENSOR, value, configure, status); 94 | 95 | /** @} */ 96 | -------------------------------------------------------------------------------- /microsystem_device/platform/wxlink/dev/als-sensor.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013, ADVANSEE - http://www.advansee.com/ 3 | * Benoît Thébaudeau 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 15 | * 3. Neither the name of the copyright holder nor the names of its 16 | * contributors may be used to endorse or promote products derived 17 | * from this software without specific prior written permission. 18 | * 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 22 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 23 | * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 24 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 25 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 26 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 28 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 30 | * OF THE POSSIBILITY OF SUCH DAMAGE. 31 | */ 32 | /** 33 | * \addtogroup cc2538-smartrf-sensors 34 | * @{ 35 | * 36 | * \defgroup cc2538dk-als-sensor cc2538dk ALS Driver 37 | * 38 | * Driver for the SmartRF06EB ALS sensor 39 | * @{ 40 | * 41 | * \file 42 | * Header file for the cc2538dk ALS Driver 43 | */ 44 | #ifndef ALS_SENSOR_H_ 45 | #define ALS_SENSOR_H_ 46 | 47 | #include "lib/sensors.h" 48 | 49 | /*---------------------------------------------------------------------------*/ 50 | /** \name ALS sensor 51 | * @{ 52 | */ 53 | #define ALS_SENSOR "ALS" 54 | /** @} */ 55 | 56 | extern const struct sensors_sensor als_sensor; 57 | 58 | #endif /* ALS_SENSOR_H_ */ 59 | 60 | /** 61 | * @} 62 | * @} 63 | */ 64 | -------------------------------------------------------------------------------- /microsystem_device/platform/wxlink/dev/button-sensor.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2012, Texas Instruments Incorporated - http://www.ti.com/ 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 14 | * 3. Neither the name of the copyright holder nor the names of its 15 | * contributors may be used to endorse or promote products derived 16 | * from this software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 21 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 22 | * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 23 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 25 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 27 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 29 | * OF THE POSSIBILITY OF SUCH DAMAGE. 30 | */ 31 | /** 32 | * \addtogroup cc2538-smartrf-sensors 33 | * @{ 34 | * 35 | * \defgroup cc2538dk-button-sensor cc2538dk Button Driver 36 | * 37 | * Driver for the SmartRF06EB buttons 38 | * @{ 39 | * 40 | * \file 41 | * Header file for the cc2538dk Button Driver 42 | */ 43 | #ifndef BUTTON_SENSOR_H_ 44 | #define BUTTON_SENSOR_H_ 45 | 46 | #include "lib/sensors.h" 47 | #include "dev/gpio.h" 48 | 49 | #define BUTTON_SENSOR "Button" 50 | 51 | #define button_sensor button_select_sensor 52 | extern const struct sensors_sensor button_select_sensor; 53 | extern const struct sensors_sensor button_left_sensor; 54 | extern const struct sensors_sensor button_right_sensor; 55 | extern const struct sensors_sensor button_up_sensor; 56 | extern const struct sensors_sensor button_down_sensor; 57 | /*---------------------------------------------------------------------------*/ 58 | #endif /* BUTTON_SENSOR_H_ */ 59 | 60 | /** \brief Common initialiser for all SmartRF Buttons */ 61 | void button_sensor_init(); 62 | 63 | /** 64 | * @} 65 | * @} 66 | */ 67 | -------------------------------------------------------------------------------- /microsystem_device/platform/wxlink/dev/leds-arch.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2012, Texas Instruments Incorporated - http://www.ti.com/ 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 14 | * 3. Neither the name of the copyright holder nor the names of its 15 | * contributors may be used to endorse or promote products derived 16 | * from this software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 21 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 22 | * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 23 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 25 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 27 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 29 | * OF THE POSSIBILITY OF SUCH DAMAGE. 30 | */ 31 | /** 32 | * \addtogroup cc2538-smartrf 33 | * @{ 34 | * 35 | * \defgroup cc2538dk-leds SmartRF06EB LED driver 36 | * 37 | * LED driver implementation for the TI SmartRF06EB + cc2538EM 38 | * @{ 39 | * 40 | * \file 41 | * LED driver implementation for the TI SmartRF06EB + cc2538EM 42 | */ 43 | #include "contiki.h" 44 | #include "reg.h" 45 | #include "dev/leds.h" 46 | #include "dev/gpio.h" 47 | 48 | #define LEDS_GPIO_PIN_MASK LEDS_ALL 49 | /*---------------------------------------------------------------------------*/ 50 | void 51 | leds_arch_init(void) 52 | { 53 | GPIO_SET_OUTPUT(GPIO_C_BASE, LEDS_GPIO_PIN_MASK); 54 | } 55 | /*---------------------------------------------------------------------------*/ 56 | unsigned char 57 | leds_arch_get(void) 58 | { 59 | return GPIO_READ_PIN(GPIO_C_BASE, LEDS_GPIO_PIN_MASK); 60 | } 61 | /*---------------------------------------------------------------------------*/ 62 | void 63 | leds_arch_set(unsigned char leds) 64 | { 65 | GPIO_WRITE_PIN(GPIO_C_BASE, LEDS_GPIO_PIN_MASK, leds); 66 | } 67 | /*---------------------------------------------------------------------------*/ 68 | 69 | /** 70 | * @} 71 | * @} 72 | */ 73 | -------------------------------------------------------------------------------- /microsystem_device/platform/wxlink/dev/smartrf-sensors.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2012, Texas Instruments Incorporated - http://www.ti.com/ 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 14 | * 3. Neither the name of the copyright holder nor the names of its 15 | * contributors may be used to endorse or promote products derived 16 | * from this software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 21 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 22 | * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 23 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 25 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 27 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 29 | * OF THE POSSIBILITY OF SUCH DAMAGE. 30 | */ 31 | /** 32 | * \addtogroup cc2538-smartrf 33 | * @{ 34 | * 35 | * \defgroup cc2538-smartrf-sensors SmartRF06EB Sensors 36 | * 37 | * Generic module controlling sensors on the SmartRF06EB 38 | * @{ 39 | * 40 | * \file 41 | * Implementation of a generic module controlling SmartRF06EB sensors 42 | */ 43 | #include "contiki.h" 44 | #include "dev/button-sensor.h" 45 | #include "dev/als-sensor.h" 46 | #include "dev/cc2538-sensors.h" 47 | 48 | #include 49 | 50 | /** \brief Exports a global symbol to be used by the sensor API */ 51 | SENSORS(&button_select_sensor, &button_left_sensor, &button_right_sensor, 52 | &button_up_sensor, &button_down_sensor, &als_sensor, 53 | &cc2538_temp_sensor, &vdd3_sensor); 54 | 55 | /** 56 | * @} 57 | * @} 58 | */ 59 | -------------------------------------------------------------------------------- /microsystem_server/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .project 3 | .settings 4 | -------------------------------------------------------------------------------- /microsystem_server/app-coap.js: -------------------------------------------------------------------------------- 1 | // 模块依赖 2 | var coap = require('coap') 3 | // 引入coap路由 4 | var coap_routes = require('./routes/coap_index'); 5 | 6 | var host = '0.0.0.0'; 7 | var coap_port = 5683; 8 | 9 | // 启动coap服务器 10 | coap.createServer(coap_routes).listen(coap_port); 11 | console.log('CoAP Server Listening on :' + host + ':' + coap_port); -------------------------------------------------------------------------------- /microsystem_server/app-web.js: -------------------------------------------------------------------------------- 1 | // 模块依赖 2 | var express = require('express') 3 | var bodyParser = require('body-parser') 4 | var path = require('path') 5 | var swig = require('swig') 6 | var routes = require('./routes/index'); 7 | 8 | var app = express(); 9 | app.engine('html', swig.renderFile); 10 | app.set('view engine', 'html'); 11 | app.use(bodyParser.json()); 12 | app.use(express.static(path.join(__dirname, 'public'))); 13 | 14 | var port = 8090; 15 | var host = '0.0.0.0'; 16 | 17 | app.use('/', routes); 18 | 19 | // 启动http服务器 20 | var http_server = app.listen(port, host) 21 | console.log('Http Server Listening on :' + host + ':' + port); 22 | -------------------------------------------------------------------------------- /microsystem_server/app.js: -------------------------------------------------------------------------------- 1 | // 模块依赖 2 | var express = require('express') 3 | var bodyParser = require('body-parser') 4 | var path = require('path') 5 | var swig = require('swig') 6 | var coap = require('coap') 7 | 8 | var routes = require('./routes/index'); 9 | var coap_routes = require('./routes/coap_index'); 10 | 11 | var app = express(); 12 | 13 | // 设置渲染引擎 14 | app.engine('html', swig.renderFile); 15 | app.set('view engine', 'html'); 16 | 17 | app.use(bodyParser.json()); 18 | app.use(express.static(path.join(__dirname, 'public'))); 19 | 20 | var coap_port = 5683; 21 | var port = 8090; 22 | var host = '0.0.0.0'; 23 | 24 | app.use('/', routes); 25 | 26 | // 启动http服务器 27 | app.listen(port, host); 28 | console.log('Http Server Listening on :' + host + ':' + port); 29 | 30 | // 启动coap服务器 31 | coap.createServer(coap_routes).listen(coap_port); 32 | console.log('CoAP Server Listening on :' + host + ':' + coap_port); -------------------------------------------------------------------------------- /microsystem_server/config/db-config.json: -------------------------------------------------------------------------------- 1 | { 2 | "host": "localhost", 3 | "user": "root", 4 | "password": "123456", 5 | "database": "monitor", 6 | "dateStrings": true 7 | } -------------------------------------------------------------------------------- /microsystem_server/lib/coap-router/formatter.js: -------------------------------------------------------------------------------- 1 | var param = function(val) { 2 | return function(map) { 3 | return map[val]; 4 | }; 5 | }; 6 | var str = function(val) { 7 | return function() { 8 | return val; 9 | }; 10 | }; 11 | 12 | module.exports = function(format) { 13 | if (!format) return null; 14 | 15 | format = format.replace(/\{\*\}/g, '*').replace(/\*/g, '{*}').replace(/:(\w+)/g, '{$1}'); // normalize 16 | format = format.match(/(?:[^\{]+)|(?:{[^\}]+\})/g).map(function(item) { 17 | return item[0] !== '{' ? str(item) : param(item.substring(1, item.length-1)); 18 | }); 19 | 20 | return function(params) { 21 | return format.reduce(function(result, item) { 22 | return result+item(params); 23 | }, ''); 24 | }; 25 | }; 26 | -------------------------------------------------------------------------------- /microsystem_server/lib/coap-router/index.js: -------------------------------------------------------------------------------- 1 | var matcher = require('./matcher'); 2 | var formatter = require('./formatter'); 3 | 4 | var METHODS = ['get', 'post', 'put', 'del' , 'delete', 'head', 'options']; 5 | var COAP_METHODS = ['GET', 'POST', 'PUT', 'DELETE', 'DELETE', 'HEAD', 'OPTIONS']; 6 | 7 | var noop = function() {}; 8 | var error = function(res) { 9 | return function() { 10 | res.statusCode = 404; 11 | res.end(); 12 | }; 13 | }; 14 | var router = function() { 15 | var methods = {}; 16 | var traps = {}; 17 | 18 | COAP_METHODS.forEach(function(method) { 19 | methods[method] = []; 20 | }); 21 | 22 | var route = function(req, res, next) { 23 | var method = methods[req.method]; 24 | var trap = traps[req.method]; 25 | var index = req.url.indexOf('?'); 26 | var url = index === -1 ? req.url : req.url.substr(0, index); 27 | var i = 0; 28 | 29 | next = next || error(res); 30 | if (!method) return next(); 31 | 32 | var loop = function(err) { 33 | if (err) return next(err); 34 | while (i < method.length) { 35 | var route = method[i]; 36 | 37 | i++; 38 | req.params = route.pattern(url); 39 | if (!req.params) continue; 40 | if (route.rewrite) { 41 | req.url = url = route.rewrite(req.params)+(index === -1 ? '' : req.url.substr(index)); 42 | } 43 | route.fn(req, res, loop); 44 | return; 45 | } 46 | if (!trap) return next(); 47 | trap(req, res, next); 48 | }; 49 | 50 | loop(); 51 | }; 52 | 53 | METHODS.forEach(function(method, i) { 54 | route[method] = function(pattern, rewrite, fn) { 55 | if (Array.isArray(pattern)) { 56 | pattern.forEach(function(item) { 57 | route[method](item, rewrite, fn); 58 | }); 59 | return; 60 | } 61 | 62 | if (!fn && !rewrite) return route[method](null, null, pattern); 63 | if (!fn && typeof rewrite === 'string') return route[method](pattern, rewrite, route); 64 | if (!fn && typeof rewrite === 'function') return route[method](pattern, null, rewrite); 65 | if (!fn) return route; 66 | 67 | (route.onmount || noop)(pattern, rewrite, fn); 68 | 69 | if (!pattern) { 70 | traps[COAP_METHODS[i]] = fn; 71 | return route; 72 | } 73 | 74 | methods[COAP_METHODS[i]].push({ 75 | pattern:matcher(pattern), 76 | rewrite:formatter(rewrite), 77 | fn:fn 78 | }); 79 | return route; 80 | }; 81 | }); 82 | route.all = function(pattern, rewrite, fn) { 83 | METHODS.forEach(function(method) { 84 | route[method](pattern, rewrite, fn); 85 | }); 86 | return route; 87 | }; 88 | 89 | return route; 90 | }; 91 | 92 | module.exports = router; 93 | -------------------------------------------------------------------------------- /microsystem_server/lib/coap-router/matcher.js: -------------------------------------------------------------------------------- 1 | var decode = function(str) { 2 | try { 3 | return decodeURIComponent(str); 4 | } catch(err) { 5 | return str; 6 | } 7 | }; 8 | 9 | module.exports = function(pattern) { 10 | if (typeof pattern !== 'string') { // regex 11 | return function(url) { 12 | return url.match(pattern); 13 | }; 14 | } 15 | 16 | var keys = []; 17 | 18 | pattern = pattern.replace(/:(\w+)/g, '{$1}').replace('{*}', '*'); // normalize 19 | pattern = pattern.replace(/(\/)?(\.)?\{([^}]+)\}(?:\(([^)]*)\))?(\?)?/g, function(match, slash, dot, key, capture, opt, offset) { 20 | var incl = (pattern[match.length+offset] || '/') === '/'; 21 | 22 | keys.push(key); 23 | 24 | return (incl ? '(?:' : '')+(slash || '')+(incl ? '' : '(?:')+(dot || '')+'('+(capture || '[^/]+')+'))'+(opt || ''); 25 | }); 26 | pattern = pattern.replace(/([\/.])/g, '\\$1').replace(/\*/g, '(.+)'); 27 | pattern = new RegExp('^'+pattern+'[\\/]?$', 'i'); 28 | 29 | return function(str) { 30 | var match = str.match(pattern); 31 | 32 | if (!match) { 33 | return match; 34 | } 35 | 36 | var map = {}; 37 | 38 | match.slice(1).forEach(function(param, i) { 39 | var k = keys[i] = keys[i] || 'wildcard'; 40 | 41 | param = param && decode(param); 42 | map[k] = map[k] ? [].concat(map[k]).concat(param) : param; 43 | }); 44 | 45 | if (map.wildcard) { 46 | map['*'] = map.wildcard; 47 | } 48 | 49 | return map; 50 | }; 51 | }; -------------------------------------------------------------------------------- /microsystem_server/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "microsystem", 3 | "version": "0.0.1", 4 | "dependencies": { 5 | "body-parser": "*", 6 | "coap": "*", 7 | "express": "*", 8 | "http": "*", 9 | "mysql": "*", 10 | "os": "*", 11 | "path": "*", 12 | "request": "*", 13 | "sockjs": "*", 14 | "swig": "*" 15 | } 16 | } -------------------------------------------------------------------------------- /microsystem_server/public/javascripts/bootstrap-table-zh-CN.min.js: -------------------------------------------------------------------------------- 1 | /* 2 | * bootstrap-table - v1.11.0 - 2016-07-02 3 | * https://github.com/wenzhixin/bootstrap-table 4 | * Copyright (c) 2016 zhixin wen 5 | * Licensed MIT License 6 | */ 7 | !function(a){"use strict";a.fn.bootstrapTable.locales["zh-CN"]={formatLoadingMessage:function(){return"正在努力地加载数据中,请稍候……"},formatRecordsPerPage:function(a){return"每页显示 "+a+" 条记录"},formatShowingRows:function(a,b,c){return"显示第 "+a+" 到第 "+b+" 条记录,总共 "+c+" 条记录"},formatSearch:function(){return"搜索"},formatNoMatches:function(){return"没有找到匹配的记录"},formatPaginationSwitch:function(){return"隐藏/显示分页"},formatRefresh:function(){return"刷新"},formatToggle:function(){return"切换"},formatColumns:function(){return"列"},formatExport:function(){return"导出数据"},formatClearFilters:function(){return"清空过滤"}},a.extend(a.fn.bootstrapTable.defaults,a.fn.bootstrapTable.locales["zh-CN"])}(jQuery); -------------------------------------------------------------------------------- /microsystem_server/public/stylesheet/bootstrap-table.min.css: -------------------------------------------------------------------------------- 1 | .fixed-table-container .bs-checkbox,.fixed-table-container .no-records-found{text-align:center}.fixed-table-body thead th .th-inner,.table td,.table th{box-sizing:border-box}.bootstrap-table .table{margin-bottom:0!important;border-bottom:1px solid #ddd;border-collapse:collapse!important;border-radius:1px}.bootstrap-table .table:not(.table-condensed),.bootstrap-table .table:not(.table-condensed)>tbody>tr>td,.bootstrap-table .table:not(.table-condensed)>tbody>tr>th,.bootstrap-table .table:not(.table-condensed)>tfoot>tr>td,.bootstrap-table .table:not(.table-condensed)>tfoot>tr>th,.bootstrap-table .table:not(.table-condensed)>thead>tr>td{padding:8px}.bootstrap-table .table.table-no-bordered>tbody>tr>td,.bootstrap-table .table.table-no-bordered>thead>tr>th{border-right:2px solid transparent}.bootstrap-table .table.table-no-bordered>tbody>tr>td:last-child{border-right:none}.fixed-table-container{position:relative;clear:both;border:1px solid #ddd;border-radius:4px;-webkit-border-radius:4px;-moz-border-radius:4px}.fixed-table-container.table-no-bordered{border:1px solid transparent}.fixed-table-footer,.fixed-table-header{overflow:hidden}.fixed-table-footer{border-top:1px solid #ddd}.fixed-table-body{overflow-x:auto;overflow-y:auto;height:100%}.fixed-table-container table{width:100%}.fixed-table-container thead th{height:0;padding:0;margin:0;border-left:1px solid #ddd}.fixed-table-container thead th:focus{outline:transparent solid 0}.fixed-table-container thead th:first-child{border-left:none;border-top-left-radius:4px;-webkit-border-top-left-radius:4px;-moz-border-radius-topleft:4px}.fixed-table-container tbody td .th-inner,.fixed-table-container thead th .th-inner{padding:8px;line-height:24px;vertical-align:top;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.fixed-table-container thead th .sortable{cursor:pointer;background-position:right;background-repeat:no-repeat;padding-right:30px}.fixed-table-container thead th .both{background-image:url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABMAAAATCAQAAADYWf5HAAAAkElEQVQoz7X QMQ5AQBCF4dWQSJxC5wwax1Cq1e7BAdxD5SL+Tq/QCM1oNiJidwox0355mXnG/DrEtIQ6azioNZQxI0ykPhTQIwhCR+BmBYtlK7kLJYwWCcJA9M4qdrZrd8pPjZWPtOqdRQy320YSV17OatFC4euts6z39GYMKRPCTKY9UnPQ6P+GtMRfGtPnBCiqhAeJPmkqAAAAAElFTkSuQmCC')}.fixed-table-container thead th .asc{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABMAAAATCAYAAAByUDbMAAAAZ0lEQVQ4y2NgGLKgquEuFxBPAGI2ahhWCsS/gDibUoO0gPgxEP8H4ttArEyuQYxAPBdqEAxPBImTY5gjEL9DM+wTENuQahAvEO9DMwiGdwAxOymGJQLxTyD+jgWDxCMZRsEoGAVoAADeemwtPcZI2wAAAABJRU5ErkJggg==)}.fixed-table-container thead th .desc{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABMAAAATCAYAAAByUDbMAAAAZUlEQVQ4y2NgGAWjYBSggaqGu5FA/BOIv2PBIPFEUgxjB+IdQPwfC94HxLykus4GiD+hGfQOiB3J8SojEE9EM2wuSJzcsFMG4ttQgx4DsRalkZENxL+AuJQaMcsGxBOAmGvopk8AVz1sLZgg0bsAAAAASUVORK5CYII=)}.fixed-table-container th.detail{width:30px}.fixed-table-container tbody td{border-left:1px solid #ddd}.fixed-table-container tbody tr:first-child td{border-top:none}.fixed-table-container tbody td:first-child{border-left:none}.fixed-table-container tbody .selected td{background-color:#f5f5f5}.fixed-table-container .bs-checkbox .th-inner{padding:8px 0}.fixed-table-container input[type=radio],.fixed-table-container input[type=checkbox]{margin:0 auto!important}.fixed-table-pagination .pagination-detail,.fixed-table-pagination div.pagination{margin-top:10px;margin-bottom:10px}.fixed-table-pagination div.pagination .pagination{margin:0}.fixed-table-pagination .pagination a{padding:6px 12px;line-height:1.428571429}.fixed-table-pagination .pagination-info{line-height:34px;margin-right:5px}.fixed-table-pagination .btn-group{position:relative;display:inline-block;vertical-align:middle}.fixed-table-pagination .dropup .dropdown-menu{margin-bottom:0}.fixed-table-pagination .page-list{display:inline-block}.fixed-table-toolbar .columns-left{margin-right:5px}.fixed-table-toolbar .columns-right{margin-left:5px}.fixed-table-toolbar .columns label{display:block;padding:3px 20px;clear:both;font-weight:400;line-height:1.428571429}.fixed-table-toolbar .bs-bars,.fixed-table-toolbar .columns,.fixed-table-toolbar .search{position:relative;margin-top:10px;margin-bottom:10px;line-height:34px}.fixed-table-pagination li.disabled a{pointer-events:none;cursor:default}.fixed-table-loading{display:none;position:absolute;top:42px;right:0;bottom:0;left:0;z-index:99;background-color:#fff;text-align:center}.fixed-table-body .card-view .title{font-weight:700;display:inline-block;min-width:30%;text-align:left!important}.table td,.table th{vertical-align:middle}.fixed-table-toolbar .dropdown-menu{text-align:left;max-height:300px;overflow:auto}.fixed-table-toolbar .btn-group>.btn-group{display:inline-block;margin-left:-1px!important}.fixed-table-toolbar .btn-group>.btn-group>.btn{border-radius:0}.fixed-table-toolbar .btn-group>.btn-group:first-child>.btn{border-top-left-radius:4px;border-bottom-left-radius:4px}.fixed-table-toolbar .btn-group>.btn-group:last-child>.btn{border-top-right-radius:4px;border-bottom-right-radius:4px}.bootstrap-table .table>thead>tr>th{vertical-align:bottom;border-bottom:1px solid #ddd}.bootstrap-table .table thead>tr>th{padding:0;margin:0}.bootstrap-table .fixed-table-footer tbody>tr>td{padding:0!important}.bootstrap-table .fixed-table-footer .table{border-bottom:none;border-radius:0;padding:0!important}.pull-right .dropdown-menu{right:0;left:auto}p.fixed-table-scroll-inner{width:100%;height:200px}div.fixed-table-scroll-outer{top:0;left:0;visibility:hidden;width:200px;height:150px;overflow:hidden} -------------------------------------------------------------------------------- /microsystem_server/public/stylesheet/custom.css: -------------------------------------------------------------------------------- 1 | body { 2 | padding-top: 20px; 3 | padding-bottom: 20px; 4 | } 5 | 6 | .navbar { 7 | margin-bottom: 20px; 8 | } -------------------------------------------------------------------------------- /microsystem_server/public/themes/bootstrap/accordion.css: -------------------------------------------------------------------------------- 1 | .accordion { 2 | overflow: hidden; 3 | border-width: 1px; 4 | border-style: solid; 5 | } 6 | .accordion .accordion-header { 7 | border-width: 0 0 1px; 8 | cursor: pointer; 9 | } 10 | .accordion .accordion-body { 11 | border-width: 0 0 1px; 12 | } 13 | .accordion-noborder { 14 | border-width: 0; 15 | } 16 | .accordion-noborder .accordion-header { 17 | border-width: 0 0 1px; 18 | } 19 | .accordion-noborder .accordion-body { 20 | border-width: 0 0 1px; 21 | } 22 | .accordion-collapse { 23 | background: url('images/accordion_arrows.png') no-repeat 0 0; 24 | } 25 | .accordion-expand { 26 | background: url('images/accordion_arrows.png') no-repeat -16px 0; 27 | } 28 | .accordion { 29 | background: #ffffff; 30 | border-color: #D4D4D4; 31 | } 32 | .accordion .accordion-header { 33 | background: #F2F2F2; 34 | filter: none; 35 | } 36 | .accordion .accordion-header-selected { 37 | background: #0081c2; 38 | } 39 | .accordion .accordion-header-selected .panel-title { 40 | color: #fff; 41 | } 42 | -------------------------------------------------------------------------------- /microsystem_server/public/themes/bootstrap/calendar.css: -------------------------------------------------------------------------------- 1 | .calendar { 2 | border-width: 1px; 3 | border-style: solid; 4 | padding: 1px; 5 | overflow: hidden; 6 | } 7 | .calendar table { 8 | table-layout: fixed; 9 | border-collapse: separate; 10 | font-size: 12px; 11 | width: 100%; 12 | height: 100%; 13 | } 14 | .calendar table td, 15 | .calendar table th { 16 | font-size: 12px; 17 | } 18 | .calendar-noborder { 19 | border: 0; 20 | } 21 | .calendar-header { 22 | position: relative; 23 | height: 22px; 24 | } 25 | .calendar-title { 26 | text-align: center; 27 | height: 22px; 28 | } 29 | .calendar-title span { 30 | position: relative; 31 | display: inline-block; 32 | top: 2px; 33 | padding: 0 3px; 34 | height: 18px; 35 | line-height: 18px; 36 | font-size: 12px; 37 | cursor: pointer; 38 | -moz-border-radius: 5px 5px 5px 5px; 39 | -webkit-border-radius: 5px 5px 5px 5px; 40 | border-radius: 5px 5px 5px 5px; 41 | } 42 | .calendar-prevmonth, 43 | .calendar-nextmonth, 44 | .calendar-prevyear, 45 | .calendar-nextyear { 46 | position: absolute; 47 | top: 50%; 48 | margin-top: -7px; 49 | width: 14px; 50 | height: 14px; 51 | cursor: pointer; 52 | font-size: 1px; 53 | -moz-border-radius: 5px 5px 5px 5px; 54 | -webkit-border-radius: 5px 5px 5px 5px; 55 | border-radius: 5px 5px 5px 5px; 56 | } 57 | .calendar-prevmonth { 58 | left: 20px; 59 | background: url('images/calendar_arrows.png') no-repeat -18px -2px; 60 | } 61 | .calendar-nextmonth { 62 | right: 20px; 63 | background: url('images/calendar_arrows.png') no-repeat -34px -2px; 64 | } 65 | .calendar-prevyear { 66 | left: 3px; 67 | background: url('images/calendar_arrows.png') no-repeat -1px -2px; 68 | } 69 | .calendar-nextyear { 70 | right: 3px; 71 | background: url('images/calendar_arrows.png') no-repeat -49px -2px; 72 | } 73 | .calendar-body { 74 | position: relative; 75 | } 76 | .calendar-body th, 77 | .calendar-body td { 78 | text-align: center; 79 | } 80 | .calendar-day { 81 | border: 0; 82 | padding: 1px; 83 | cursor: pointer; 84 | -moz-border-radius: 5px 5px 5px 5px; 85 | -webkit-border-radius: 5px 5px 5px 5px; 86 | border-radius: 5px 5px 5px 5px; 87 | } 88 | .calendar-other-month { 89 | opacity: 0.3; 90 | filter: alpha(opacity=30); 91 | } 92 | .calendar-disabled { 93 | opacity: 0.6; 94 | filter: alpha(opacity=60); 95 | cursor: default; 96 | } 97 | .calendar-menu { 98 | position: absolute; 99 | top: 0; 100 | left: 0; 101 | width: 180px; 102 | height: 150px; 103 | padding: 5px; 104 | font-size: 12px; 105 | display: none; 106 | overflow: hidden; 107 | } 108 | .calendar-menu-year-inner { 109 | text-align: center; 110 | padding-bottom: 5px; 111 | } 112 | .calendar-menu-year { 113 | width: 50px; 114 | text-align: center; 115 | border-width: 1px; 116 | border-style: solid; 117 | outline-style: none; 118 | resize: none; 119 | margin: 0; 120 | padding: 2px; 121 | font-weight: bold; 122 | font-size: 12px; 123 | -moz-border-radius: 5px 5px 5px 5px; 124 | -webkit-border-radius: 5px 5px 5px 5px; 125 | border-radius: 5px 5px 5px 5px; 126 | } 127 | .calendar-menu-prev, 128 | .calendar-menu-next { 129 | display: inline-block; 130 | width: 21px; 131 | height: 21px; 132 | vertical-align: top; 133 | cursor: pointer; 134 | -moz-border-radius: 5px 5px 5px 5px; 135 | -webkit-border-radius: 5px 5px 5px 5px; 136 | border-radius: 5px 5px 5px 5px; 137 | } 138 | .calendar-menu-prev { 139 | margin-right: 10px; 140 | background: url('images/calendar_arrows.png') no-repeat 2px 2px; 141 | } 142 | .calendar-menu-next { 143 | margin-left: 10px; 144 | background: url('images/calendar_arrows.png') no-repeat -45px 2px; 145 | } 146 | .calendar-menu-month { 147 | text-align: center; 148 | cursor: pointer; 149 | font-weight: bold; 150 | -moz-border-radius: 5px 5px 5px 5px; 151 | -webkit-border-radius: 5px 5px 5px 5px; 152 | border-radius: 5px 5px 5px 5px; 153 | } 154 | .calendar-body th, 155 | .calendar-menu-month { 156 | color: #808080; 157 | } 158 | .calendar-day { 159 | color: #333; 160 | } 161 | .calendar-sunday { 162 | color: #CC2222; 163 | } 164 | .calendar-saturday { 165 | color: #00ee00; 166 | } 167 | .calendar-today { 168 | color: #0000ff; 169 | } 170 | .calendar-menu-year { 171 | border-color: #D4D4D4; 172 | } 173 | .calendar { 174 | border-color: #D4D4D4; 175 | } 176 | .calendar-header { 177 | background: #F2F2F2; 178 | } 179 | .calendar-body, 180 | .calendar-menu { 181 | background: #ffffff; 182 | } 183 | .calendar-body th { 184 | background: #F5F5F5; 185 | padding: 2px 0; 186 | } 187 | .calendar-hover, 188 | .calendar-nav-hover, 189 | .calendar-menu-hover { 190 | background-color: #e6e6e6; 191 | color: #00438a; 192 | } 193 | .calendar-hover { 194 | border: 1px solid #ddd; 195 | padding: 0; 196 | } 197 | .calendar-selected { 198 | background-color: #0081c2; 199 | color: #fff; 200 | border: 1px solid #0070a9; 201 | padding: 0; 202 | } 203 | -------------------------------------------------------------------------------- /microsystem_server/public/themes/bootstrap/combo.css: -------------------------------------------------------------------------------- 1 | .combo-arrow { 2 | width: 18px; 3 | height: 20px; 4 | overflow: hidden; 5 | display: inline-block; 6 | vertical-align: top; 7 | cursor: pointer; 8 | opacity: 0.6; 9 | filter: alpha(opacity=60); 10 | } 11 | .combo-arrow-hover { 12 | opacity: 1.0; 13 | filter: alpha(opacity=100); 14 | } 15 | .combo-panel { 16 | overflow: auto; 17 | } 18 | .combo-arrow { 19 | background: url('images/combo_arrow.png') no-repeat center center; 20 | } 21 | .combo-panel { 22 | background-color: #ffffff; 23 | } 24 | .combo-arrow { 25 | background-color: #F2F2F2; 26 | } 27 | .combo-arrow-hover { 28 | background-color: #e6e6e6; 29 | } 30 | .combo-arrow:hover { 31 | background-color: #e6e6e6; 32 | } 33 | .combo .textbox-icon-disabled:hover { 34 | cursor: default; 35 | } 36 | -------------------------------------------------------------------------------- /microsystem_server/public/themes/bootstrap/combobox.css: -------------------------------------------------------------------------------- 1 | .combobox-item, 2 | .combobox-group, 3 | .combobox-stick { 4 | font-size: 12px; 5 | padding: 3px; 6 | } 7 | .combobox-item-disabled { 8 | opacity: 0.5; 9 | filter: alpha(opacity=50); 10 | } 11 | .combobox-gitem { 12 | padding-left: 10px; 13 | } 14 | .combobox-group, 15 | .combobox-stick { 16 | font-weight: bold; 17 | } 18 | .combobox-stick { 19 | position: absolute; 20 | top: 1px; 21 | left: 1px; 22 | right: 1px; 23 | background: inherit; 24 | } 25 | .combobox-item-hover { 26 | background-color: #e6e6e6; 27 | color: #00438a; 28 | } 29 | .combobox-item-selected { 30 | background-color: #0081c2; 31 | color: #fff; 32 | } 33 | .combobox-icon { 34 | display: inline-block; 35 | width: 16px; 36 | height: 16px; 37 | vertical-align: middle; 38 | margin-right: 2px; 39 | } 40 | -------------------------------------------------------------------------------- /microsystem_server/public/themes/bootstrap/datalist.css: -------------------------------------------------------------------------------- 1 | .datalist .datagrid-header { 2 | border-width: 0; 3 | } 4 | .datalist .datagrid-group, 5 | .m-list .m-list-group { 6 | height: 25px; 7 | line-height: 25px; 8 | font-weight: bold; 9 | overflow: hidden; 10 | background-color: #F2F2F2; 11 | border-style: solid; 12 | border-width: 0 0 1px 0; 13 | border-color: #ccc; 14 | } 15 | .datalist .datagrid-group-expander { 16 | display: none; 17 | } 18 | .datalist .datagrid-group-title { 19 | padding: 0 4px; 20 | } 21 | .datalist .datagrid-btable { 22 | width: 100%; 23 | table-layout: fixed; 24 | } 25 | .datalist .datagrid-row td { 26 | border-style: solid; 27 | border-left-color: transparent; 28 | border-right-color: transparent; 29 | border-bottom-width: 0; 30 | } 31 | .datalist-lines .datagrid-row td { 32 | border-bottom-width: 1px; 33 | } 34 | .datalist .datagrid-cell, 35 | .m-list li { 36 | width: auto; 37 | height: auto; 38 | padding: 2px 4px; 39 | line-height: 18px; 40 | position: relative; 41 | white-space: nowrap; 42 | text-overflow: ellipsis; 43 | overflow: hidden; 44 | } 45 | .datalist-link, 46 | .m-list li>a { 47 | display: block; 48 | position: relative; 49 | cursor: pointer; 50 | color: #333; 51 | text-decoration: none; 52 | overflow: hidden; 53 | margin: -2px -4px; 54 | padding: 2px 4px; 55 | padding-right: 16px; 56 | line-height: 18px; 57 | white-space: nowrap; 58 | text-overflow: ellipsis; 59 | overflow: hidden; 60 | } 61 | .datalist-link::after, 62 | .m-list li>a::after { 63 | position: absolute; 64 | display: block; 65 | width: 8px; 66 | height: 8px; 67 | content: ''; 68 | right: 6px; 69 | top: 50%; 70 | margin-top: -4px; 71 | border-style: solid; 72 | border-width: 1px 1px 0 0; 73 | -ms-transform: rotate(45deg); 74 | -moz-transform: rotate(45deg); 75 | -webkit-transform: rotate(45deg); 76 | -o-transform: rotate(45deg); 77 | transform: rotate(45deg); 78 | } 79 | .m-list { 80 | margin: 0; 81 | padding: 0; 82 | list-style: none; 83 | } 84 | .m-list li { 85 | border-style: solid; 86 | border-width: 0 0 1px 0; 87 | border-color: #ccc; 88 | } 89 | .m-list li>a:hover { 90 | background: #e6e6e6; 91 | color: #00438a; 92 | } 93 | .m-list .m-list-group { 94 | padding: 0 4px; 95 | } 96 | -------------------------------------------------------------------------------- /microsystem_server/public/themes/bootstrap/datebox.css: -------------------------------------------------------------------------------- 1 | .datebox-calendar-inner { 2 | height: 180px; 3 | } 4 | .datebox-button { 5 | padding: 0 5px; 6 | text-align: center; 7 | } 8 | .datebox-button a { 9 | line-height: 22px; 10 | font-size: 12px; 11 | font-weight: bold; 12 | text-decoration: none; 13 | opacity: 0.6; 14 | filter: alpha(opacity=60); 15 | } 16 | .datebox-button a:hover { 17 | opacity: 1.0; 18 | filter: alpha(opacity=100); 19 | } 20 | .datebox-current, 21 | .datebox-close { 22 | float: left; 23 | } 24 | .datebox-close { 25 | float: right; 26 | } 27 | .datebox .combo-arrow { 28 | background-image: url('images/datebox_arrow.png'); 29 | background-position: center center; 30 | } 31 | .datebox-button { 32 | background-color: #F5F5F5; 33 | } 34 | .datebox-button a { 35 | color: #444; 36 | } 37 | -------------------------------------------------------------------------------- /microsystem_server/public/themes/bootstrap/dialog.css: -------------------------------------------------------------------------------- 1 | .dialog-content { 2 | overflow: auto; 3 | } 4 | .dialog-toolbar { 5 | position: relative; 6 | padding: 2px 5px; 7 | } 8 | .dialog-tool-separator { 9 | float: left; 10 | height: 24px; 11 | border-left: 1px solid #ccc; 12 | border-right: 1px solid #fff; 13 | margin: 2px 1px; 14 | } 15 | .dialog-button { 16 | position: relative; 17 | top: -1px; 18 | padding: 5px; 19 | text-align: right; 20 | } 21 | .dialog-button .l-btn { 22 | margin-left: 5px; 23 | } 24 | .dialog-toolbar, 25 | .dialog-button { 26 | background: #F5F5F5; 27 | border-width: 1px; 28 | border-style: solid; 29 | } 30 | .dialog-toolbar { 31 | border-color: #D4D4D4 #D4D4D4 #e6e6e6 #D4D4D4; 32 | } 33 | .dialog-button { 34 | border-color: #e6e6e6 #D4D4D4 #D4D4D4 #D4D4D4; 35 | } 36 | .window-thinborder .dialog-toolbar { 37 | border-left: transparent; 38 | border-right: transparent; 39 | border-top-color: #F5F5F5; 40 | } 41 | .window-thinborder .dialog-button { 42 | top: 0px; 43 | padding: 5px 8px 8px 8px; 44 | border-left: transparent; 45 | border-right: transparent; 46 | border-bottom: transparent; 47 | } 48 | -------------------------------------------------------------------------------- /microsystem_server/public/themes/bootstrap/filebox.css: -------------------------------------------------------------------------------- 1 | .filebox .textbox-value { 2 | vertical-align: top; 3 | position: absolute; 4 | top: 0; 5 | left: -5000px; 6 | } 7 | .filebox-label { 8 | display: inline-block; 9 | position: absolute; 10 | width: 100%; 11 | height: 100%; 12 | cursor: pointer; 13 | left: 0; 14 | top: 0; 15 | z-index: 10; 16 | background: url('images/blank.gif') no-repeat; 17 | } 18 | .l-btn-disabled .filebox-label { 19 | cursor: default; 20 | } 21 | -------------------------------------------------------------------------------- /microsystem_server/public/themes/bootstrap/images/accordion_arrows.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xukai871105/the_beginning_of_coap/8410596cb2e8d5eef5196429ecbb98771fd1261e/microsystem_server/public/themes/bootstrap/images/accordion_arrows.png -------------------------------------------------------------------------------- /microsystem_server/public/themes/bootstrap/images/blank.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xukai871105/the_beginning_of_coap/8410596cb2e8d5eef5196429ecbb98771fd1261e/microsystem_server/public/themes/bootstrap/images/blank.gif -------------------------------------------------------------------------------- /microsystem_server/public/themes/bootstrap/images/calendar_arrows.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xukai871105/the_beginning_of_coap/8410596cb2e8d5eef5196429ecbb98771fd1261e/microsystem_server/public/themes/bootstrap/images/calendar_arrows.png -------------------------------------------------------------------------------- /microsystem_server/public/themes/bootstrap/images/combo_arrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xukai871105/the_beginning_of_coap/8410596cb2e8d5eef5196429ecbb98771fd1261e/microsystem_server/public/themes/bootstrap/images/combo_arrow.png -------------------------------------------------------------------------------- /microsystem_server/public/themes/bootstrap/images/datagrid_icons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xukai871105/the_beginning_of_coap/8410596cb2e8d5eef5196429ecbb98771fd1261e/microsystem_server/public/themes/bootstrap/images/datagrid_icons.png -------------------------------------------------------------------------------- /microsystem_server/public/themes/bootstrap/images/datebox_arrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xukai871105/the_beginning_of_coap/8410596cb2e8d5eef5196429ecbb98771fd1261e/microsystem_server/public/themes/bootstrap/images/datebox_arrow.png -------------------------------------------------------------------------------- /microsystem_server/public/themes/bootstrap/images/layout_arrows.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xukai871105/the_beginning_of_coap/8410596cb2e8d5eef5196429ecbb98771fd1261e/microsystem_server/public/themes/bootstrap/images/layout_arrows.png -------------------------------------------------------------------------------- /microsystem_server/public/themes/bootstrap/images/linkbutton_bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xukai871105/the_beginning_of_coap/8410596cb2e8d5eef5196429ecbb98771fd1261e/microsystem_server/public/themes/bootstrap/images/linkbutton_bg.png -------------------------------------------------------------------------------- /microsystem_server/public/themes/bootstrap/images/loading.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xukai871105/the_beginning_of_coap/8410596cb2e8d5eef5196429ecbb98771fd1261e/microsystem_server/public/themes/bootstrap/images/loading.gif -------------------------------------------------------------------------------- /microsystem_server/public/themes/bootstrap/images/menu_arrows.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xukai871105/the_beginning_of_coap/8410596cb2e8d5eef5196429ecbb98771fd1261e/microsystem_server/public/themes/bootstrap/images/menu_arrows.png -------------------------------------------------------------------------------- /microsystem_server/public/themes/bootstrap/images/messager_icons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xukai871105/the_beginning_of_coap/8410596cb2e8d5eef5196429ecbb98771fd1261e/microsystem_server/public/themes/bootstrap/images/messager_icons.png -------------------------------------------------------------------------------- /microsystem_server/public/themes/bootstrap/images/pagination_icons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xukai871105/the_beginning_of_coap/8410596cb2e8d5eef5196429ecbb98771fd1261e/microsystem_server/public/themes/bootstrap/images/pagination_icons.png -------------------------------------------------------------------------------- /microsystem_server/public/themes/bootstrap/images/panel_tools.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xukai871105/the_beginning_of_coap/8410596cb2e8d5eef5196429ecbb98771fd1261e/microsystem_server/public/themes/bootstrap/images/panel_tools.png -------------------------------------------------------------------------------- /microsystem_server/public/themes/bootstrap/images/searchbox_button.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xukai871105/the_beginning_of_coap/8410596cb2e8d5eef5196429ecbb98771fd1261e/microsystem_server/public/themes/bootstrap/images/searchbox_button.png -------------------------------------------------------------------------------- /microsystem_server/public/themes/bootstrap/images/slider_handle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xukai871105/the_beginning_of_coap/8410596cb2e8d5eef5196429ecbb98771fd1261e/microsystem_server/public/themes/bootstrap/images/slider_handle.png -------------------------------------------------------------------------------- /microsystem_server/public/themes/bootstrap/images/spinner_arrows.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xukai871105/the_beginning_of_coap/8410596cb2e8d5eef5196429ecbb98771fd1261e/microsystem_server/public/themes/bootstrap/images/spinner_arrows.png -------------------------------------------------------------------------------- /microsystem_server/public/themes/bootstrap/images/tabs_icons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xukai871105/the_beginning_of_coap/8410596cb2e8d5eef5196429ecbb98771fd1261e/microsystem_server/public/themes/bootstrap/images/tabs_icons.png -------------------------------------------------------------------------------- /microsystem_server/public/themes/bootstrap/images/tree_icons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xukai871105/the_beginning_of_coap/8410596cb2e8d5eef5196429ecbb98771fd1261e/microsystem_server/public/themes/bootstrap/images/tree_icons.png -------------------------------------------------------------------------------- /microsystem_server/public/themes/bootstrap/images/validatebox_warning.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xukai871105/the_beginning_of_coap/8410596cb2e8d5eef5196429ecbb98771fd1261e/microsystem_server/public/themes/bootstrap/images/validatebox_warning.png -------------------------------------------------------------------------------- /microsystem_server/public/themes/bootstrap/layout.css: -------------------------------------------------------------------------------- 1 | .layout { 2 | position: relative; 3 | overflow: hidden; 4 | margin: 0; 5 | padding: 0; 6 | z-index: 0; 7 | } 8 | .layout-panel { 9 | position: absolute; 10 | overflow: hidden; 11 | } 12 | .layout-body { 13 | min-width: 1px; 14 | min-height: 1px; 15 | } 16 | .layout-panel-east, 17 | .layout-panel-west { 18 | z-index: 2; 19 | } 20 | .layout-panel-north, 21 | .layout-panel-south { 22 | z-index: 3; 23 | } 24 | .layout-expand { 25 | position: absolute; 26 | padding: 0px; 27 | font-size: 1px; 28 | cursor: pointer; 29 | z-index: 1; 30 | } 31 | .layout-expand .panel-header, 32 | .layout-expand .panel-body { 33 | background: transparent; 34 | filter: none; 35 | overflow: hidden; 36 | } 37 | .layout-expand .panel-header { 38 | border-bottom-width: 0px; 39 | } 40 | .layout-expand .panel-body { 41 | position: relative; 42 | } 43 | .layout-expand .panel-body .panel-icon { 44 | margin-top: 0; 45 | top: 0; 46 | left: 50%; 47 | margin-left: -8px; 48 | } 49 | .layout-expand-west .panel-header .panel-icon, 50 | .layout-expand-east .panel-header .panel-icon { 51 | display: none; 52 | } 53 | .layout-expand-title { 54 | position: absolute; 55 | top: 0; 56 | left: 21px; 57 | white-space: nowrap; 58 | word-wrap: normal; 59 | -webkit-transform: rotate(90deg); 60 | -webkit-transform-origin: 0 0; 61 | -moz-transform: rotate(90deg); 62 | -moz-transform-origin: 0 0; 63 | -o-transform: rotate(90deg); 64 | -o-transform-origin: 0 0; 65 | transform: rotate(90deg); 66 | transform-origin: 0 0; 67 | } 68 | .layout-expand-with-icon { 69 | top: 18px; 70 | } 71 | .layout-expand .panel-body-noheader .layout-expand-title, 72 | .layout-expand .panel-body-noheader .panel-icon { 73 | top: 5px; 74 | } 75 | .layout-expand .panel-body-noheader .layout-expand-with-icon { 76 | top: 23px; 77 | } 78 | .layout-split-proxy-h, 79 | .layout-split-proxy-v { 80 | position: absolute; 81 | font-size: 1px; 82 | display: none; 83 | z-index: 5; 84 | } 85 | .layout-split-proxy-h { 86 | width: 5px; 87 | cursor: e-resize; 88 | } 89 | .layout-split-proxy-v { 90 | height: 5px; 91 | cursor: n-resize; 92 | } 93 | .layout-mask { 94 | position: absolute; 95 | background: #fafafa; 96 | filter: alpha(opacity=10); 97 | opacity: 0.10; 98 | z-index: 4; 99 | } 100 | .layout-button-up { 101 | background: url('images/layout_arrows.png') no-repeat -16px -16px; 102 | } 103 | .layout-button-down { 104 | background: url('images/layout_arrows.png') no-repeat -16px 0; 105 | } 106 | .layout-button-left { 107 | background: url('images/layout_arrows.png') no-repeat 0 0; 108 | } 109 | .layout-button-right { 110 | background: url('images/layout_arrows.png') no-repeat 0 -16px; 111 | } 112 | .layout-split-proxy-h, 113 | .layout-split-proxy-v { 114 | background-color: #bbb; 115 | } 116 | .layout-split-north { 117 | border-bottom: 5px solid #eee; 118 | } 119 | .layout-split-south { 120 | border-top: 5px solid #eee; 121 | } 122 | .layout-split-east { 123 | border-left: 5px solid #eee; 124 | } 125 | .layout-split-west { 126 | border-right: 5px solid #eee; 127 | } 128 | .layout-expand { 129 | background-color: #F2F2F2; 130 | } 131 | .layout-expand-over { 132 | background-color: #F2F2F2; 133 | } 134 | -------------------------------------------------------------------------------- /microsystem_server/public/themes/bootstrap/linkbutton.css: -------------------------------------------------------------------------------- 1 | .l-btn { 2 | text-decoration: none; 3 | display: inline-block; 4 | overflow: hidden; 5 | margin: 0; 6 | padding: 0; 7 | cursor: pointer; 8 | outline: none; 9 | text-align: center; 10 | vertical-align: middle; 11 | line-height: normal; 12 | } 13 | .l-btn-plain { 14 | border-width: 0; 15 | padding: 1px; 16 | } 17 | .l-btn-left { 18 | display: inline-block; 19 | position: relative; 20 | overflow: hidden; 21 | margin: 0; 22 | padding: 0; 23 | vertical-align: top; 24 | } 25 | .l-btn-text { 26 | display: inline-block; 27 | vertical-align: top; 28 | width: auto; 29 | line-height: 24px; 30 | font-size: 12px; 31 | padding: 0; 32 | margin: 0 4px; 33 | } 34 | .l-btn-icon { 35 | display: inline-block; 36 | width: 16px; 37 | height: 16px; 38 | line-height: 16px; 39 | position: absolute; 40 | top: 50%; 41 | margin-top: -8px; 42 | font-size: 1px; 43 | } 44 | .l-btn span span .l-btn-empty { 45 | display: inline-block; 46 | margin: 0; 47 | width: 16px; 48 | height: 24px; 49 | font-size: 1px; 50 | vertical-align: top; 51 | } 52 | .l-btn span .l-btn-icon-left { 53 | padding: 0 0 0 20px; 54 | background-position: left center; 55 | } 56 | .l-btn span .l-btn-icon-right { 57 | padding: 0 20px 0 0; 58 | background-position: right center; 59 | } 60 | .l-btn-icon-left .l-btn-text { 61 | margin: 0 4px 0 24px; 62 | } 63 | .l-btn-icon-left .l-btn-icon { 64 | left: 4px; 65 | } 66 | .l-btn-icon-right .l-btn-text { 67 | margin: 0 24px 0 4px; 68 | } 69 | .l-btn-icon-right .l-btn-icon { 70 | right: 4px; 71 | } 72 | .l-btn-icon-top .l-btn-text { 73 | margin: 20px 4px 0 4px; 74 | } 75 | .l-btn-icon-top .l-btn-icon { 76 | top: 4px; 77 | left: 50%; 78 | margin: 0 0 0 -8px; 79 | } 80 | .l-btn-icon-bottom .l-btn-text { 81 | margin: 0 4px 20px 4px; 82 | } 83 | .l-btn-icon-bottom .l-btn-icon { 84 | top: auto; 85 | bottom: 4px; 86 | left: 50%; 87 | margin: 0 0 0 -8px; 88 | } 89 | .l-btn-left .l-btn-empty { 90 | margin: 0 4px; 91 | width: 16px; 92 | } 93 | .l-btn-plain:hover { 94 | padding: 0; 95 | } 96 | .l-btn-focus { 97 | outline: #0000FF dotted thin; 98 | } 99 | .l-btn-large .l-btn-text { 100 | line-height: 40px; 101 | } 102 | .l-btn-large .l-btn-icon { 103 | width: 32px; 104 | height: 32px; 105 | line-height: 32px; 106 | margin-top: -16px; 107 | } 108 | .l-btn-large .l-btn-icon-left .l-btn-text { 109 | margin-left: 40px; 110 | } 111 | .l-btn-large .l-btn-icon-right .l-btn-text { 112 | margin-right: 40px; 113 | } 114 | .l-btn-large .l-btn-icon-top .l-btn-text { 115 | margin-top: 36px; 116 | line-height: 24px; 117 | min-width: 32px; 118 | } 119 | .l-btn-large .l-btn-icon-top .l-btn-icon { 120 | margin: 0 0 0 -16px; 121 | } 122 | .l-btn-large .l-btn-icon-bottom .l-btn-text { 123 | margin-bottom: 36px; 124 | line-height: 24px; 125 | min-width: 32px; 126 | } 127 | .l-btn-large .l-btn-icon-bottom .l-btn-icon { 128 | margin: 0 0 0 -16px; 129 | } 130 | .l-btn-large .l-btn-left .l-btn-empty { 131 | margin: 0 4px; 132 | width: 32px; 133 | } 134 | .l-btn { 135 | color: #444; 136 | background: #f5f5f5; 137 | background-repeat: repeat-x; 138 | border: 1px solid #bbb; 139 | background: -webkit-linear-gradient(top,#ffffff 0,#e6e6e6 100%); 140 | background: -moz-linear-gradient(top,#ffffff 0,#e6e6e6 100%); 141 | background: -o-linear-gradient(top,#ffffff 0,#e6e6e6 100%); 142 | background: linear-gradient(to bottom,#ffffff 0,#e6e6e6 100%); 143 | background-repeat: repeat-x; 144 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#ffffff,endColorstr=#e6e6e6,GradientType=0); 145 | -moz-border-radius: 5px 5px 5px 5px; 146 | -webkit-border-radius: 5px 5px 5px 5px; 147 | border-radius: 5px 5px 5px 5px; 148 | } 149 | .l-btn:hover { 150 | background: #e6e6e6; 151 | color: #00438a; 152 | border: 1px solid #ddd; 153 | filter: none; 154 | } 155 | .l-btn-plain { 156 | background: transparent; 157 | border-width: 0; 158 | filter: none; 159 | } 160 | .l-btn-outline { 161 | border-width: 1px; 162 | border-color: #ddd; 163 | padding: 0; 164 | } 165 | .l-btn-plain:hover { 166 | background: #e6e6e6; 167 | color: #00438a; 168 | border: 1px solid #ddd; 169 | -moz-border-radius: 5px 5px 5px 5px; 170 | -webkit-border-radius: 5px 5px 5px 5px; 171 | border-radius: 5px 5px 5px 5px; 172 | } 173 | .l-btn-disabled, 174 | .l-btn-disabled:hover { 175 | opacity: 0.5; 176 | cursor: default; 177 | background: #f5f5f5; 178 | color: #444; 179 | background: -webkit-linear-gradient(top,#ffffff 0,#e6e6e6 100%); 180 | background: -moz-linear-gradient(top,#ffffff 0,#e6e6e6 100%); 181 | background: -o-linear-gradient(top,#ffffff 0,#e6e6e6 100%); 182 | background: linear-gradient(to bottom,#ffffff 0,#e6e6e6 100%); 183 | background-repeat: repeat-x; 184 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#ffffff,endColorstr=#e6e6e6,GradientType=0); 185 | } 186 | .l-btn-disabled .l-btn-text, 187 | .l-btn-disabled .l-btn-icon { 188 | filter: alpha(opacity=50); 189 | } 190 | .l-btn-plain-disabled, 191 | .l-btn-plain-disabled:hover { 192 | background: transparent; 193 | filter: alpha(opacity=50); 194 | } 195 | .l-btn-selected, 196 | .l-btn-selected:hover { 197 | background: #ddd; 198 | filter: none; 199 | } 200 | .l-btn-plain-selected, 201 | .l-btn-plain-selected:hover { 202 | background: #ddd; 203 | } 204 | -------------------------------------------------------------------------------- /microsystem_server/public/themes/bootstrap/menu.css: -------------------------------------------------------------------------------- 1 | .menu { 2 | position: absolute; 3 | margin: 0; 4 | padding: 2px; 5 | border-width: 1px; 6 | border-style: solid; 7 | overflow: hidden; 8 | } 9 | .menu-inline { 10 | position: relative; 11 | } 12 | .menu-item { 13 | position: relative; 14 | margin: 0; 15 | padding: 0; 16 | overflow: hidden; 17 | white-space: nowrap; 18 | cursor: pointer; 19 | border-width: 1px; 20 | border-style: solid; 21 | } 22 | .menu-text { 23 | height: 20px; 24 | line-height: 20px; 25 | float: left; 26 | padding-left: 28px; 27 | } 28 | .menu-icon { 29 | position: absolute; 30 | width: 16px; 31 | height: 16px; 32 | left: 2px; 33 | top: 50%; 34 | margin-top: -8px; 35 | } 36 | .menu-rightarrow { 37 | position: absolute; 38 | width: 16px; 39 | height: 16px; 40 | right: 0; 41 | top: 50%; 42 | margin-top: -8px; 43 | } 44 | .menu-line { 45 | position: absolute; 46 | left: 26px; 47 | top: 0; 48 | height: 2000px; 49 | font-size: 1px; 50 | } 51 | .menu-sep { 52 | margin: 3px 0px 3px 25px; 53 | font-size: 1px; 54 | } 55 | .menu-noline .menu-line { 56 | display: none; 57 | } 58 | .menu-noline .menu-sep { 59 | margin-left: 0; 60 | margin-right: 0; 61 | } 62 | .menu-active { 63 | -moz-border-radius: 5px 5px 5px 5px; 64 | -webkit-border-radius: 5px 5px 5px 5px; 65 | border-radius: 5px 5px 5px 5px; 66 | } 67 | .menu-item-disabled { 68 | opacity: 0.5; 69 | filter: alpha(opacity=50); 70 | cursor: default; 71 | } 72 | .menu-text, 73 | .menu-text span { 74 | font-size: 12px; 75 | } 76 | .menu-shadow { 77 | position: absolute; 78 | -moz-border-radius: 5px 5px 5px 5px; 79 | -webkit-border-radius: 5px 5px 5px 5px; 80 | border-radius: 5px 5px 5px 5px; 81 | background: #ccc; 82 | -moz-box-shadow: 2px 2px 3px #cccccc; 83 | -webkit-box-shadow: 2px 2px 3px #cccccc; 84 | box-shadow: 2px 2px 3px #cccccc; 85 | filter: progid:DXImageTransform.Microsoft.Blur(pixelRadius=2,MakeShadow=false,ShadowOpacity=0.2); 86 | } 87 | .menu-rightarrow { 88 | background: url('images/menu_arrows.png') no-repeat -32px center; 89 | } 90 | .menu-line { 91 | border-left: 1px solid #ccc; 92 | border-right: 1px solid #fff; 93 | } 94 | .menu-sep { 95 | border-top: 1px solid #ccc; 96 | border-bottom: 1px solid #fff; 97 | } 98 | .menu { 99 | background-color: #fff; 100 | border-color: #e6e6e6; 101 | color: #333; 102 | } 103 | .menu-content { 104 | background: #ffffff; 105 | } 106 | .menu-item { 107 | border-color: transparent; 108 | _border-color: #fff; 109 | } 110 | .menu-active { 111 | border-color: #ddd; 112 | color: #00438a; 113 | background: #e6e6e6; 114 | } 115 | .menu-active-disabled { 116 | border-color: transparent; 117 | background: transparent; 118 | color: #333; 119 | } 120 | -------------------------------------------------------------------------------- /microsystem_server/public/themes/bootstrap/menubutton.css: -------------------------------------------------------------------------------- 1 | .m-btn-downarrow, 2 | .s-btn-downarrow { 3 | display: inline-block; 4 | position: absolute; 5 | width: 16px; 6 | height: 16px; 7 | font-size: 1px; 8 | right: 0; 9 | top: 50%; 10 | margin-top: -8px; 11 | } 12 | .m-btn-active, 13 | .s-btn-active { 14 | background: #e6e6e6; 15 | color: #00438a; 16 | border: 1px solid #ddd; 17 | filter: none; 18 | } 19 | .m-btn-plain-active, 20 | .s-btn-plain-active { 21 | background: transparent; 22 | padding: 0; 23 | border-width: 1px; 24 | border-style: solid; 25 | -moz-border-radius: 5px 5px 5px 5px; 26 | -webkit-border-radius: 5px 5px 5px 5px; 27 | border-radius: 5px 5px 5px 5px; 28 | } 29 | .m-btn .l-btn-left .l-btn-text { 30 | margin-right: 20px; 31 | } 32 | .m-btn .l-btn-icon-right .l-btn-text { 33 | margin-right: 40px; 34 | } 35 | .m-btn .l-btn-icon-right .l-btn-icon { 36 | right: 20px; 37 | } 38 | .m-btn .l-btn-icon-top .l-btn-text { 39 | margin-right: 4px; 40 | margin-bottom: 14px; 41 | } 42 | .m-btn .l-btn-icon-bottom .l-btn-text { 43 | margin-right: 4px; 44 | margin-bottom: 34px; 45 | } 46 | .m-btn .l-btn-icon-bottom .l-btn-icon { 47 | top: auto; 48 | bottom: 20px; 49 | } 50 | .m-btn .l-btn-icon-top .m-btn-downarrow, 51 | .m-btn .l-btn-icon-bottom .m-btn-downarrow { 52 | top: auto; 53 | bottom: 0px; 54 | left: 50%; 55 | margin-left: -8px; 56 | } 57 | .m-btn-line { 58 | display: inline-block; 59 | position: absolute; 60 | font-size: 1px; 61 | display: none; 62 | } 63 | .m-btn .l-btn-left .m-btn-line { 64 | right: 0; 65 | width: 16px; 66 | height: 500px; 67 | border-style: solid; 68 | border-color: #bbb; 69 | border-width: 0 0 0 1px; 70 | } 71 | .m-btn .l-btn-icon-top .m-btn-line, 72 | .m-btn .l-btn-icon-bottom .m-btn-line { 73 | left: 0; 74 | bottom: 0; 75 | width: 500px; 76 | height: 16px; 77 | border-width: 1px 0 0 0; 78 | } 79 | .m-btn-large .l-btn-icon-right .l-btn-text { 80 | margin-right: 56px; 81 | } 82 | .m-btn-large .l-btn-icon-bottom .l-btn-text { 83 | margin-bottom: 50px; 84 | } 85 | .m-btn-downarrow, 86 | .s-btn-downarrow { 87 | background: url('images/menu_arrows.png') no-repeat 0 center; 88 | } 89 | .m-btn-plain-active, 90 | .s-btn-plain-active { 91 | border-color: #ddd; 92 | background-color: #e6e6e6; 93 | color: #00438a; 94 | } 95 | -------------------------------------------------------------------------------- /microsystem_server/public/themes/bootstrap/messager.css: -------------------------------------------------------------------------------- 1 | .messager-body { 2 | padding: 10px 10px 30px 10px; 3 | overflow: auto; 4 | } 5 | .messager-button { 6 | text-align: center; 7 | padding: 5px; 8 | } 9 | .messager-button .l-btn { 10 | width: 70px; 11 | } 12 | .messager-icon { 13 | float: left; 14 | width: 32px; 15 | height: 32px; 16 | margin: 0 10px 10px 0; 17 | } 18 | .messager-error { 19 | background: url('images/messager_icons.png') no-repeat scroll -64px 0; 20 | } 21 | .messager-info { 22 | background: url('images/messager_icons.png') no-repeat scroll 0 0; 23 | } 24 | .messager-question { 25 | background: url('images/messager_icons.png') no-repeat scroll -32px 0; 26 | } 27 | .messager-warning { 28 | background: url('images/messager_icons.png') no-repeat scroll -96px 0; 29 | } 30 | .messager-progress { 31 | padding: 10px; 32 | } 33 | .messager-p-msg { 34 | margin-bottom: 5px; 35 | } 36 | .messager-body .messager-input { 37 | width: 100%; 38 | padding: 4px 0; 39 | outline-style: none; 40 | border: 1px solid #D4D4D4; 41 | } 42 | .window-thinborder .messager-button { 43 | padding-bottom: 8px; 44 | } 45 | -------------------------------------------------------------------------------- /microsystem_server/public/themes/bootstrap/numberbox.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xukai871105/the_beginning_of_coap/8410596cb2e8d5eef5196429ecbb98771fd1261e/microsystem_server/public/themes/bootstrap/numberbox.css -------------------------------------------------------------------------------- /microsystem_server/public/themes/bootstrap/pagination.css: -------------------------------------------------------------------------------- 1 | .pagination { 2 | zoom: 1; 3 | } 4 | .pagination table { 5 | float: left; 6 | height: 30px; 7 | } 8 | .pagination td { 9 | border: 0; 10 | } 11 | .pagination-btn-separator { 12 | float: left; 13 | height: 24px; 14 | border-left: 1px solid #ccc; 15 | border-right: 1px solid #fff; 16 | margin: 3px 1px; 17 | } 18 | .pagination .pagination-num { 19 | border-width: 1px; 20 | border-style: solid; 21 | margin: 0 2px; 22 | padding: 2px; 23 | width: 2em; 24 | height: auto; 25 | } 26 | .pagination-page-list { 27 | margin: 0px 6px; 28 | padding: 1px 2px; 29 | width: auto; 30 | height: auto; 31 | border-width: 1px; 32 | border-style: solid; 33 | } 34 | .pagination-info { 35 | float: right; 36 | margin: 0 6px 0 0; 37 | padding: 0; 38 | height: 30px; 39 | line-height: 30px; 40 | font-size: 12px; 41 | } 42 | .pagination span { 43 | font-size: 12px; 44 | } 45 | .pagination-link .l-btn-text { 46 | width: 24px; 47 | text-align: center; 48 | margin: 0; 49 | } 50 | .pagination-first { 51 | background: url('images/pagination_icons.png') no-repeat 0 center; 52 | } 53 | .pagination-prev { 54 | background: url('images/pagination_icons.png') no-repeat -16px center; 55 | } 56 | .pagination-next { 57 | background: url('images/pagination_icons.png') no-repeat -32px center; 58 | } 59 | .pagination-last { 60 | background: url('images/pagination_icons.png') no-repeat -48px center; 61 | } 62 | .pagination-load { 63 | background: url('images/pagination_icons.png') no-repeat -64px center; 64 | } 65 | .pagination-loading { 66 | background: url('images/loading.gif') no-repeat center center; 67 | } 68 | .pagination-page-list, 69 | .pagination .pagination-num { 70 | border-color: #D4D4D4; 71 | } 72 | -------------------------------------------------------------------------------- /microsystem_server/public/themes/bootstrap/panel.css: -------------------------------------------------------------------------------- 1 | .panel { 2 | overflow: hidden; 3 | text-align: left; 4 | margin: 0; 5 | border: 0; 6 | -moz-border-radius: 0 0 0 0; 7 | -webkit-border-radius: 0 0 0 0; 8 | border-radius: 0 0 0 0; 9 | } 10 | .panel-header, 11 | .panel-body { 12 | border-width: 1px; 13 | border-style: solid; 14 | } 15 | .panel-header { 16 | padding: 5px; 17 | position: relative; 18 | } 19 | .panel-title { 20 | background: url('images/blank.gif') no-repeat; 21 | } 22 | .panel-header-noborder { 23 | border-width: 0 0 1px 0; 24 | } 25 | .panel-body { 26 | overflow: auto; 27 | border-top-width: 0; 28 | padding: 0; 29 | } 30 | .panel-body-noheader { 31 | border-top-width: 1px; 32 | } 33 | .panel-body-noborder { 34 | border-width: 0px; 35 | } 36 | .panel-body-nobottom { 37 | border-bottom-width: 0; 38 | } 39 | .panel-with-icon { 40 | padding-left: 18px; 41 | } 42 | .panel-icon, 43 | .panel-tool { 44 | position: absolute; 45 | top: 50%; 46 | margin-top: -8px; 47 | height: 16px; 48 | overflow: hidden; 49 | } 50 | .panel-icon { 51 | left: 5px; 52 | width: 16px; 53 | } 54 | .panel-tool { 55 | right: 5px; 56 | width: auto; 57 | } 58 | .panel-tool a { 59 | display: inline-block; 60 | width: 16px; 61 | height: 16px; 62 | opacity: 0.6; 63 | filter: alpha(opacity=60); 64 | margin: 0 0 0 2px; 65 | vertical-align: top; 66 | } 67 | .panel-tool a:hover { 68 | opacity: 1; 69 | filter: alpha(opacity=100); 70 | background-color: #e6e6e6; 71 | -moz-border-radius: 3px 3px 3px 3px; 72 | -webkit-border-radius: 3px 3px 3px 3px; 73 | border-radius: 3px 3px 3px 3px; 74 | } 75 | .panel-loading { 76 | padding: 11px 0px 10px 30px; 77 | } 78 | .panel-noscroll { 79 | overflow: hidden; 80 | } 81 | .panel-fit, 82 | .panel-fit body { 83 | height: 100%; 84 | margin: 0; 85 | padding: 0; 86 | border: 0; 87 | overflow: hidden; 88 | } 89 | .panel-loading { 90 | background: url('images/loading.gif') no-repeat 10px 10px; 91 | } 92 | .panel-tool-close { 93 | background: url('images/panel_tools.png') no-repeat -16px 0px; 94 | } 95 | .panel-tool-min { 96 | background: url('images/panel_tools.png') no-repeat 0px 0px; 97 | } 98 | .panel-tool-max { 99 | background: url('images/panel_tools.png') no-repeat 0px -16px; 100 | } 101 | .panel-tool-restore { 102 | background: url('images/panel_tools.png') no-repeat -16px -16px; 103 | } 104 | .panel-tool-collapse { 105 | background: url('images/panel_tools.png') no-repeat -32px 0; 106 | } 107 | .panel-tool-expand { 108 | background: url('images/panel_tools.png') no-repeat -32px -16px; 109 | } 110 | .panel-header, 111 | .panel-body { 112 | border-color: #D4D4D4; 113 | } 114 | .panel-header { 115 | background-color: #F2F2F2; 116 | background: -webkit-linear-gradient(top,#ffffff 0,#F2F2F2 100%); 117 | background: -moz-linear-gradient(top,#ffffff 0,#F2F2F2 100%); 118 | background: -o-linear-gradient(top,#ffffff 0,#F2F2F2 100%); 119 | background: linear-gradient(to bottom,#ffffff 0,#F2F2F2 100%); 120 | background-repeat: repeat-x; 121 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#ffffff,endColorstr=#F2F2F2,GradientType=0); 122 | } 123 | .panel-body { 124 | background-color: #ffffff; 125 | color: #333; 126 | font-size: 12px; 127 | } 128 | .panel-title { 129 | font-size: 12px; 130 | font-weight: bold; 131 | color: #777; 132 | height: 16px; 133 | line-height: 16px; 134 | } 135 | .panel-footer { 136 | border: 1px solid #D4D4D4; 137 | overflow: hidden; 138 | background: #F5F5F5; 139 | } 140 | .panel-footer-noborder { 141 | border-width: 1px 0 0 0; 142 | } 143 | -------------------------------------------------------------------------------- /microsystem_server/public/themes/bootstrap/progressbar.css: -------------------------------------------------------------------------------- 1 | .progressbar { 2 | border-width: 1px; 3 | border-style: solid; 4 | -moz-border-radius: 5px 5px 5px 5px; 5 | -webkit-border-radius: 5px 5px 5px 5px; 6 | border-radius: 5px 5px 5px 5px; 7 | overflow: hidden; 8 | position: relative; 9 | } 10 | .progressbar-text { 11 | text-align: center; 12 | position: absolute; 13 | } 14 | .progressbar-value { 15 | position: relative; 16 | overflow: hidden; 17 | width: 0; 18 | -moz-border-radius: 5px 0 0 5px; 19 | -webkit-border-radius: 5px 0 0 5px; 20 | border-radius: 5px 0 0 5px; 21 | } 22 | .progressbar { 23 | border-color: #D4D4D4; 24 | } 25 | .progressbar-text { 26 | color: #333; 27 | font-size: 12px; 28 | } 29 | .progressbar-value .progressbar-text { 30 | background-color: #0081c2; 31 | color: #fff; 32 | } 33 | -------------------------------------------------------------------------------- /microsystem_server/public/themes/bootstrap/propertygrid.css: -------------------------------------------------------------------------------- 1 | .propertygrid .datagrid-view1 .datagrid-body td { 2 | padding-bottom: 1px; 3 | border-width: 0 1px 0 0; 4 | } 5 | .propertygrid .datagrid-group { 6 | height: 21px; 7 | overflow: hidden; 8 | border-width: 0 0 1px 0; 9 | border-style: solid; 10 | } 11 | .propertygrid .datagrid-group span { 12 | font-weight: bold; 13 | } 14 | .propertygrid .datagrid-view1 .datagrid-body td { 15 | border-color: #e6e6e6; 16 | } 17 | .propertygrid .datagrid-view1 .datagrid-group { 18 | border-color: #F2F2F2; 19 | } 20 | .propertygrid .datagrid-view2 .datagrid-group { 21 | border-color: #e6e6e6; 22 | } 23 | .propertygrid .datagrid-group, 24 | .propertygrid .datagrid-view1 .datagrid-body, 25 | .propertygrid .datagrid-view1 .datagrid-row-over, 26 | .propertygrid .datagrid-view1 .datagrid-row-selected { 27 | background: #F2F2F2; 28 | } 29 | -------------------------------------------------------------------------------- /microsystem_server/public/themes/bootstrap/searchbox.css: -------------------------------------------------------------------------------- 1 | .searchbox-button { 2 | width: 18px; 3 | height: 20px; 4 | overflow: hidden; 5 | display: inline-block; 6 | vertical-align: top; 7 | cursor: pointer; 8 | opacity: 0.6; 9 | filter: alpha(opacity=60); 10 | } 11 | .searchbox-button-hover { 12 | opacity: 1.0; 13 | filter: alpha(opacity=100); 14 | } 15 | .searchbox .l-btn-plain { 16 | border: 0; 17 | padding: 0; 18 | vertical-align: top; 19 | opacity: 0.6; 20 | filter: alpha(opacity=60); 21 | -moz-border-radius: 0 0 0 0; 22 | -webkit-border-radius: 0 0 0 0; 23 | border-radius: 0 0 0 0; 24 | } 25 | .searchbox .l-btn-plain:hover { 26 | border: 0; 27 | padding: 0; 28 | opacity: 1.0; 29 | filter: alpha(opacity=100); 30 | -moz-border-radius: 0 0 0 0; 31 | -webkit-border-radius: 0 0 0 0; 32 | border-radius: 0 0 0 0; 33 | } 34 | .searchbox a.m-btn-plain-active { 35 | -moz-border-radius: 0 0 0 0; 36 | -webkit-border-radius: 0 0 0 0; 37 | border-radius: 0 0 0 0; 38 | } 39 | .searchbox .m-btn-active { 40 | border-width: 0 1px 0 0; 41 | -moz-border-radius: 0 0 0 0; 42 | -webkit-border-radius: 0 0 0 0; 43 | border-radius: 0 0 0 0; 44 | } 45 | .searchbox .textbox-button-right { 46 | border-width: 0 0 0 1px; 47 | } 48 | .searchbox .textbox-button-left { 49 | border-width: 0 1px 0 0; 50 | } 51 | .searchbox-button { 52 | background: url('images/searchbox_button.png') no-repeat center center; 53 | } 54 | .searchbox .l-btn-plain { 55 | background: #F2F2F2; 56 | } 57 | .searchbox .l-btn-plain-disabled, 58 | .searchbox .l-btn-plain-disabled:hover { 59 | opacity: 0.5; 60 | filter: alpha(opacity=50); 61 | } 62 | -------------------------------------------------------------------------------- /microsystem_server/public/themes/bootstrap/slider.css: -------------------------------------------------------------------------------- 1 | .slider-disabled { 2 | opacity: 0.5; 3 | filter: alpha(opacity=50); 4 | } 5 | .slider-h { 6 | height: 22px; 7 | } 8 | .slider-v { 9 | width: 22px; 10 | } 11 | .slider-inner { 12 | position: relative; 13 | height: 6px; 14 | top: 7px; 15 | border-width: 1px; 16 | border-style: solid; 17 | border-radius: 5px; 18 | } 19 | .slider-handle { 20 | position: absolute; 21 | display: block; 22 | outline: none; 23 | width: 20px; 24 | height: 20px; 25 | top: 50%; 26 | margin-top: -10px; 27 | margin-left: -10px; 28 | } 29 | .slider-tip { 30 | position: absolute; 31 | display: inline-block; 32 | line-height: 12px; 33 | font-size: 12px; 34 | white-space: nowrap; 35 | top: -22px; 36 | } 37 | .slider-rule { 38 | position: relative; 39 | top: 15px; 40 | } 41 | .slider-rule span { 42 | position: absolute; 43 | display: inline-block; 44 | font-size: 0; 45 | height: 5px; 46 | border-width: 0 0 0 1px; 47 | border-style: solid; 48 | } 49 | .slider-rulelabel { 50 | position: relative; 51 | top: 20px; 52 | } 53 | .slider-rulelabel span { 54 | position: absolute; 55 | display: inline-block; 56 | font-size: 12px; 57 | } 58 | .slider-v .slider-inner { 59 | width: 6px; 60 | left: 7px; 61 | top: 0; 62 | float: left; 63 | } 64 | .slider-v .slider-handle { 65 | left: 50%; 66 | margin-top: -10px; 67 | } 68 | .slider-v .slider-tip { 69 | left: -10px; 70 | margin-top: -6px; 71 | } 72 | .slider-v .slider-rule { 73 | float: left; 74 | top: 0; 75 | left: 16px; 76 | } 77 | .slider-v .slider-rule span { 78 | width: 5px; 79 | height: 'auto'; 80 | border-left: 0; 81 | border-width: 1px 0 0 0; 82 | border-style: solid; 83 | } 84 | .slider-v .slider-rulelabel { 85 | float: left; 86 | top: 0; 87 | left: 23px; 88 | } 89 | .slider-handle { 90 | background: url('images/slider_handle.png') no-repeat; 91 | } 92 | .slider-inner { 93 | border-color: #D4D4D4; 94 | background: #F2F2F2; 95 | } 96 | .slider-rule span { 97 | border-color: #D4D4D4; 98 | } 99 | .slider-rulelabel span { 100 | color: #333; 101 | } 102 | -------------------------------------------------------------------------------- /microsystem_server/public/themes/bootstrap/spinner.css: -------------------------------------------------------------------------------- 1 | .spinner-arrow { 2 | background-color: #F2F2F2; 3 | display: inline-block; 4 | overflow: hidden; 5 | vertical-align: top; 6 | margin: 0; 7 | padding: 0; 8 | opacity: 1.0; 9 | filter: alpha(opacity=100); 10 | width: 18px; 11 | } 12 | .spinner-arrow-up, 13 | .spinner-arrow-down { 14 | opacity: 0.6; 15 | filter: alpha(opacity=60); 16 | display: block; 17 | font-size: 1px; 18 | width: 18px; 19 | height: 10px; 20 | width: 100%; 21 | height: 50%; 22 | color: #444; 23 | outline-style: none; 24 | } 25 | .spinner-arrow-hover { 26 | background-color: #e6e6e6; 27 | opacity: 1.0; 28 | filter: alpha(opacity=100); 29 | } 30 | .spinner-arrow-up:hover, 31 | .spinner-arrow-down:hover { 32 | opacity: 1.0; 33 | filter: alpha(opacity=100); 34 | background-color: #e6e6e6; 35 | } 36 | .textbox-icon-disabled .spinner-arrow-up:hover, 37 | .textbox-icon-disabled .spinner-arrow-down:hover { 38 | opacity: 0.6; 39 | filter: alpha(opacity=60); 40 | background-color: #F2F2F2; 41 | cursor: default; 42 | } 43 | .spinner .textbox-icon-disabled { 44 | opacity: 0.6; 45 | filter: alpha(opacity=60); 46 | } 47 | .spinner-arrow-up { 48 | background: url('images/spinner_arrows.png') no-repeat 1px center; 49 | } 50 | .spinner-arrow-down { 51 | background: url('images/spinner_arrows.png') no-repeat -15px center; 52 | } 53 | -------------------------------------------------------------------------------- /microsystem_server/public/themes/bootstrap/splitbutton.css: -------------------------------------------------------------------------------- 1 | .s-btn:hover .m-btn-line, 2 | .s-btn-active .m-btn-line, 3 | .s-btn-plain-active .m-btn-line { 4 | display: inline-block; 5 | } 6 | .l-btn:hover .s-btn-downarrow, 7 | .s-btn-active .s-btn-downarrow, 8 | .s-btn-plain-active .s-btn-downarrow { 9 | border-style: solid; 10 | border-color: #bbb; 11 | border-width: 0 0 0 1px; 12 | } 13 | -------------------------------------------------------------------------------- /microsystem_server/public/themes/bootstrap/switchbutton.css: -------------------------------------------------------------------------------- 1 | .switchbutton { 2 | text-decoration: none; 3 | display: inline-block; 4 | overflow: hidden; 5 | vertical-align: middle; 6 | margin: 0; 7 | padding: 0; 8 | cursor: pointer; 9 | background: #bbb; 10 | border: 1px solid #bbb; 11 | -moz-border-radius: 5px 5px 5px 5px; 12 | -webkit-border-radius: 5px 5px 5px 5px; 13 | border-radius: 5px 5px 5px 5px; 14 | } 15 | .switchbutton-inner { 16 | display: inline-block; 17 | overflow: hidden; 18 | position: relative; 19 | top: -1px; 20 | left: -1px; 21 | } 22 | .switchbutton-on, 23 | .switchbutton-off, 24 | .switchbutton-handle { 25 | display: inline-block; 26 | text-align: center; 27 | height: 100%; 28 | float: left; 29 | font-size: 12px; 30 | -moz-border-radius: 5px 5px 5px 5px; 31 | -webkit-border-radius: 5px 5px 5px 5px; 32 | border-radius: 5px 5px 5px 5px; 33 | } 34 | .switchbutton-on { 35 | background: #0081c2; 36 | color: #fff; 37 | } 38 | .switchbutton-off { 39 | background-color: #ffffff; 40 | color: #333; 41 | } 42 | .switchbutton-on, 43 | .switchbutton-reversed .switchbutton-off { 44 | -moz-border-radius: 5px 0 0 5px; 45 | -webkit-border-radius: 5px 0 0 5px; 46 | border-radius: 5px 0 0 5px; 47 | } 48 | .switchbutton-off, 49 | .switchbutton-reversed .switchbutton-on { 50 | -moz-border-radius: 0 5px 5px 0; 51 | -webkit-border-radius: 0 5px 5px 0; 52 | border-radius: 0 5px 5px 0; 53 | } 54 | .switchbutton-handle { 55 | position: absolute; 56 | top: 0; 57 | left: 50%; 58 | background-color: #ffffff; 59 | color: #333; 60 | border: 1px solid #bbb; 61 | -moz-box-shadow: 0 0 3px 0 #bbb; 62 | -webkit-box-shadow: 0 0 3px 0 #bbb; 63 | box-shadow: 0 0 3px 0 #bbb; 64 | } 65 | .switchbutton-value { 66 | position: absolute; 67 | top: 0; 68 | left: -5000px; 69 | } 70 | .switchbutton-disabled { 71 | opacity: 0.5; 72 | filter: alpha(opacity=50); 73 | } 74 | .switchbutton-disabled, 75 | .switchbutton-readonly { 76 | cursor: default; 77 | } 78 | -------------------------------------------------------------------------------- /microsystem_server/public/themes/bootstrap/textbox.css: -------------------------------------------------------------------------------- 1 | .textbox { 2 | position: relative; 3 | border: 1px solid #D4D4D4; 4 | background-color: #fff; 5 | vertical-align: middle; 6 | display: inline-block; 7 | overflow: hidden; 8 | white-space: nowrap; 9 | margin: 0; 10 | padding: 0; 11 | -moz-border-radius: 5px 5px 5px 5px; 12 | -webkit-border-radius: 5px 5px 5px 5px; 13 | border-radius: 5px 5px 5px 5px; 14 | } 15 | .textbox .textbox-text { 16 | font-size: 12px; 17 | border: 0; 18 | margin: 0; 19 | padding: 4px; 20 | white-space: normal; 21 | vertical-align: top; 22 | outline-style: none; 23 | resize: none; 24 | -moz-border-radius: 5px 5px 5px 5px; 25 | -webkit-border-radius: 5px 5px 5px 5px; 26 | border-radius: 5px 5px 5px 5px; 27 | } 28 | .textbox .textbox-text::-ms-clear, 29 | .textbox .textbox-text::-ms-reveal { 30 | display: none; 31 | } 32 | .textbox textarea.textbox-text { 33 | white-space: pre-wrap; 34 | } 35 | .textbox .textbox-prompt { 36 | font-size: 12px; 37 | color: #aaa; 38 | } 39 | .textbox .textbox-bgicon { 40 | background-position: 3px center; 41 | padding-left: 21px; 42 | } 43 | .textbox .textbox-button, 44 | .textbox .textbox-button:hover { 45 | position: absolute; 46 | top: 0; 47 | padding: 0; 48 | vertical-align: top; 49 | -moz-border-radius: 0 0 0 0; 50 | -webkit-border-radius: 0 0 0 0; 51 | border-radius: 0 0 0 0; 52 | } 53 | .textbox-button-right, 54 | .textbox-button-right:hover { 55 | border-width: 0 0 0 1px; 56 | } 57 | .textbox-button-left, 58 | .textbox-button-left:hover { 59 | border-width: 0 1px 0 0; 60 | } 61 | .textbox-addon { 62 | position: absolute; 63 | top: 0; 64 | } 65 | .textbox-icon { 66 | display: inline-block; 67 | width: 18px; 68 | height: 20px; 69 | overflow: hidden; 70 | vertical-align: top; 71 | background-position: center center; 72 | cursor: pointer; 73 | opacity: 0.6; 74 | filter: alpha(opacity=60); 75 | text-decoration: none; 76 | outline-style: none; 77 | } 78 | .textbox-icon-disabled, 79 | .textbox-icon-readonly { 80 | cursor: default; 81 | } 82 | .textbox-icon:hover { 83 | opacity: 1.0; 84 | filter: alpha(opacity=100); 85 | } 86 | .textbox-icon-disabled:hover { 87 | opacity: 0.6; 88 | filter: alpha(opacity=60); 89 | } 90 | .textbox-focused { 91 | border-color: #bbbbbb; 92 | -moz-box-shadow: 0 0 3px 0 #D4D4D4; 93 | -webkit-box-shadow: 0 0 3px 0 #D4D4D4; 94 | box-shadow: 0 0 3px 0 #D4D4D4; 95 | } 96 | .textbox-invalid { 97 | border-color: #ffa8a8; 98 | background-color: #fff3f3; 99 | } 100 | -------------------------------------------------------------------------------- /microsystem_server/public/themes/bootstrap/tooltip.css: -------------------------------------------------------------------------------- 1 | .tooltip { 2 | position: absolute; 3 | display: none; 4 | z-index: 9900000; 5 | outline: none; 6 | opacity: 1; 7 | filter: alpha(opacity=100); 8 | padding: 5px; 9 | border-width: 1px; 10 | border-style: solid; 11 | border-radius: 5px; 12 | -moz-border-radius: 5px 5px 5px 5px; 13 | -webkit-border-radius: 5px 5px 5px 5px; 14 | border-radius: 5px 5px 5px 5px; 15 | } 16 | .tooltip-content { 17 | font-size: 12px; 18 | } 19 | .tooltip-arrow-outer, 20 | .tooltip-arrow { 21 | position: absolute; 22 | width: 0; 23 | height: 0; 24 | line-height: 0; 25 | font-size: 0; 26 | border-style: solid; 27 | border-width: 6px; 28 | border-color: transparent; 29 | _border-color: tomato; 30 | _filter: chroma(color=tomato); 31 | } 32 | .tooltip-arrow { 33 | display: none \9; 34 | } 35 | .tooltip-right .tooltip-arrow-outer { 36 | left: 0; 37 | top: 50%; 38 | margin: -6px 0 0 -13px; 39 | } 40 | .tooltip-right .tooltip-arrow { 41 | left: 0; 42 | top: 50%; 43 | margin: -6px 0 0 -12px; 44 | } 45 | .tooltip-left .tooltip-arrow-outer { 46 | right: 0; 47 | top: 50%; 48 | margin: -6px -13px 0 0; 49 | } 50 | .tooltip-left .tooltip-arrow { 51 | right: 0; 52 | top: 50%; 53 | margin: -6px -12px 0 0; 54 | } 55 | .tooltip-top .tooltip-arrow-outer { 56 | bottom: 0; 57 | left: 50%; 58 | margin: 0 0 -13px -6px; 59 | } 60 | .tooltip-top .tooltip-arrow { 61 | bottom: 0; 62 | left: 50%; 63 | margin: 0 0 -12px -6px; 64 | } 65 | .tooltip-bottom .tooltip-arrow-outer { 66 | top: 0; 67 | left: 50%; 68 | margin: -13px 0 0 -6px; 69 | } 70 | .tooltip-bottom .tooltip-arrow { 71 | top: 0; 72 | left: 50%; 73 | margin: -12px 0 0 -6px; 74 | } 75 | .tooltip { 76 | background-color: #ffffff; 77 | border-color: #D4D4D4; 78 | color: #333; 79 | } 80 | .tooltip-right .tooltip-arrow-outer { 81 | border-right-color: #D4D4D4; 82 | } 83 | .tooltip-right .tooltip-arrow { 84 | border-right-color: #ffffff; 85 | } 86 | .tooltip-left .tooltip-arrow-outer { 87 | border-left-color: #D4D4D4; 88 | } 89 | .tooltip-left .tooltip-arrow { 90 | border-left-color: #ffffff; 91 | } 92 | .tooltip-top .tooltip-arrow-outer { 93 | border-top-color: #D4D4D4; 94 | } 95 | .tooltip-top .tooltip-arrow { 96 | border-top-color: #ffffff; 97 | } 98 | .tooltip-bottom .tooltip-arrow-outer { 99 | border-bottom-color: #D4D4D4; 100 | } 101 | .tooltip-bottom .tooltip-arrow { 102 | border-bottom-color: #ffffff; 103 | } 104 | -------------------------------------------------------------------------------- /microsystem_server/public/themes/bootstrap/tree.css: -------------------------------------------------------------------------------- 1 | .tree { 2 | margin: 0; 3 | padding: 0; 4 | list-style-type: none; 5 | } 6 | .tree li { 7 | white-space: nowrap; 8 | } 9 | .tree li ul { 10 | list-style-type: none; 11 | margin: 0; 12 | padding: 0; 13 | } 14 | .tree-node { 15 | height: 18px; 16 | white-space: nowrap; 17 | cursor: pointer; 18 | } 19 | .tree-hit { 20 | cursor: pointer; 21 | } 22 | .tree-expanded, 23 | .tree-collapsed, 24 | .tree-folder, 25 | .tree-file, 26 | .tree-checkbox, 27 | .tree-indent { 28 | display: inline-block; 29 | width: 16px; 30 | height: 18px; 31 | vertical-align: top; 32 | overflow: hidden; 33 | } 34 | .tree-expanded { 35 | background: url('images/tree_icons.png') no-repeat -18px 0px; 36 | } 37 | .tree-expanded-hover { 38 | background: url('images/tree_icons.png') no-repeat -50px 0px; 39 | } 40 | .tree-collapsed { 41 | background: url('images/tree_icons.png') no-repeat 0px 0px; 42 | } 43 | .tree-collapsed-hover { 44 | background: url('images/tree_icons.png') no-repeat -32px 0px; 45 | } 46 | .tree-lines .tree-expanded, 47 | .tree-lines .tree-root-first .tree-expanded { 48 | background: url('images/tree_icons.png') no-repeat -144px 0; 49 | } 50 | .tree-lines .tree-collapsed, 51 | .tree-lines .tree-root-first .tree-collapsed { 52 | background: url('images/tree_icons.png') no-repeat -128px 0; 53 | } 54 | .tree-lines .tree-node-last .tree-expanded, 55 | .tree-lines .tree-root-one .tree-expanded { 56 | background: url('images/tree_icons.png') no-repeat -80px 0; 57 | } 58 | .tree-lines .tree-node-last .tree-collapsed, 59 | .tree-lines .tree-root-one .tree-collapsed { 60 | background: url('images/tree_icons.png') no-repeat -64px 0; 61 | } 62 | .tree-line { 63 | background: url('images/tree_icons.png') no-repeat -176px 0; 64 | } 65 | .tree-join { 66 | background: url('images/tree_icons.png') no-repeat -192px 0; 67 | } 68 | .tree-joinbottom { 69 | background: url('images/tree_icons.png') no-repeat -160px 0; 70 | } 71 | .tree-folder { 72 | background: url('images/tree_icons.png') no-repeat -208px 0; 73 | } 74 | .tree-folder-open { 75 | background: url('images/tree_icons.png') no-repeat -224px 0; 76 | } 77 | .tree-file { 78 | background: url('images/tree_icons.png') no-repeat -240px 0; 79 | } 80 | .tree-loading { 81 | background: url('images/loading.gif') no-repeat center center; 82 | } 83 | .tree-checkbox0 { 84 | background: url('images/tree_icons.png') no-repeat -208px -18px; 85 | } 86 | .tree-checkbox1 { 87 | background: url('images/tree_icons.png') no-repeat -224px -18px; 88 | } 89 | .tree-checkbox2 { 90 | background: url('images/tree_icons.png') no-repeat -240px -18px; 91 | } 92 | .tree-title { 93 | font-size: 12px; 94 | display: inline-block; 95 | text-decoration: none; 96 | vertical-align: top; 97 | white-space: nowrap; 98 | padding: 0 2px; 99 | height: 18px; 100 | line-height: 18px; 101 | } 102 | .tree-node-proxy { 103 | font-size: 12px; 104 | line-height: 20px; 105 | padding: 0 2px 0 20px; 106 | border-width: 1px; 107 | border-style: solid; 108 | z-index: 9900000; 109 | } 110 | .tree-dnd-icon { 111 | display: inline-block; 112 | position: absolute; 113 | width: 16px; 114 | height: 18px; 115 | left: 2px; 116 | top: 50%; 117 | margin-top: -9px; 118 | } 119 | .tree-dnd-yes { 120 | background: url('images/tree_icons.png') no-repeat -256px 0; 121 | } 122 | .tree-dnd-no { 123 | background: url('images/tree_icons.png') no-repeat -256px -18px; 124 | } 125 | .tree-node-top { 126 | border-top: 1px dotted red; 127 | } 128 | .tree-node-bottom { 129 | border-bottom: 1px dotted red; 130 | } 131 | .tree-node-append .tree-title { 132 | border: 1px dotted red; 133 | } 134 | .tree-editor { 135 | border: 1px solid #D4D4D4; 136 | font-size: 12px; 137 | line-height: 16px; 138 | padding: 0 4px; 139 | margin: 0; 140 | width: 80px; 141 | outline-style: none; 142 | vertical-align: top; 143 | position: absolute; 144 | top: 0; 145 | } 146 | .tree-node-proxy { 147 | background-color: #ffffff; 148 | color: #333; 149 | border-color: #D4D4D4; 150 | } 151 | .tree-node-hover { 152 | background: #e6e6e6; 153 | color: #00438a; 154 | } 155 | .tree-node-selected { 156 | background: #0081c2; 157 | color: #fff; 158 | } 159 | .tree-node-hidden { 160 | display: none; 161 | } 162 | -------------------------------------------------------------------------------- /microsystem_server/public/themes/bootstrap/validatebox.css: -------------------------------------------------------------------------------- 1 | .validatebox-invalid { 2 | border-color: #ffa8a8; 3 | background-color: #fff3f3; 4 | color: #000; 5 | } 6 | -------------------------------------------------------------------------------- /microsystem_server/public/themes/bootstrap/window.css: -------------------------------------------------------------------------------- 1 | .window { 2 | overflow: hidden; 3 | padding: 5px; 4 | border-width: 1px; 5 | border-style: solid; 6 | } 7 | .window .window-header { 8 | background: transparent; 9 | padding: 0px 0px 6px 0px; 10 | } 11 | .window .window-body { 12 | border-width: 1px; 13 | border-style: solid; 14 | border-top-width: 0px; 15 | } 16 | .window .window-body-noheader { 17 | border-top-width: 1px; 18 | } 19 | .window .panel-body-nobottom { 20 | border-bottom-width: 0; 21 | } 22 | .window .window-header .panel-icon, 23 | .window .window-header .panel-tool { 24 | top: 50%; 25 | margin-top: -11px; 26 | } 27 | .window .window-header .panel-icon { 28 | left: 1px; 29 | } 30 | .window .window-header .panel-tool { 31 | right: 1px; 32 | } 33 | .window .window-header .panel-with-icon { 34 | padding-left: 18px; 35 | } 36 | .window-proxy { 37 | position: absolute; 38 | overflow: hidden; 39 | } 40 | .window-proxy-mask { 41 | position: absolute; 42 | filter: alpha(opacity=5); 43 | opacity: 0.05; 44 | } 45 | .window-mask { 46 | position: absolute; 47 | left: 0; 48 | top: 0; 49 | width: 100%; 50 | height: 100%; 51 | filter: alpha(opacity=40); 52 | opacity: 0.40; 53 | font-size: 1px; 54 | overflow: hidden; 55 | } 56 | .window, 57 | .window-shadow { 58 | position: absolute; 59 | -moz-border-radius: 5px 5px 5px 5px; 60 | -webkit-border-radius: 5px 5px 5px 5px; 61 | border-radius: 5px 5px 5px 5px; 62 | } 63 | .window-shadow { 64 | background: #ccc; 65 | -moz-box-shadow: 2px 2px 3px #cccccc; 66 | -webkit-box-shadow: 2px 2px 3px #cccccc; 67 | box-shadow: 2px 2px 3px #cccccc; 68 | filter: progid:DXImageTransform.Microsoft.Blur(pixelRadius=2,MakeShadow=false,ShadowOpacity=0.2); 69 | } 70 | .window, 71 | .window .window-body { 72 | border-color: #D4D4D4; 73 | } 74 | .window { 75 | background-color: #F2F2F2; 76 | background: -webkit-linear-gradient(top,#ffffff 0,#F2F2F2 20%); 77 | background: -moz-linear-gradient(top,#ffffff 0,#F2F2F2 20%); 78 | background: -o-linear-gradient(top,#ffffff 0,#F2F2F2 20%); 79 | background: linear-gradient(to bottom,#ffffff 0,#F2F2F2 20%); 80 | background-repeat: repeat-x; 81 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#ffffff,endColorstr=#F2F2F2,GradientType=0); 82 | } 83 | .window-proxy { 84 | border: 1px dashed #D4D4D4; 85 | } 86 | .window-proxy-mask, 87 | .window-mask { 88 | background: #ccc; 89 | } 90 | .window .panel-footer { 91 | border: 1px solid #D4D4D4; 92 | position: relative; 93 | top: -1px; 94 | } 95 | .window-thinborder { 96 | padding: 0; 97 | } 98 | .window-thinborder .window-header { 99 | padding: 5px 5px 6px 5px; 100 | } 101 | .window-thinborder .window-body { 102 | border-width: 0px; 103 | } 104 | .window-thinborder .window-header .panel-icon, 105 | .window-thinborder .window-header .panel-tool { 106 | margin-top: -9px; 107 | margin-left: 5px; 108 | margin-right: 5px; 109 | } 110 | .window-noborder { 111 | border: 0; 112 | } 113 | -------------------------------------------------------------------------------- /microsystem_server/public/themes/icon.css: -------------------------------------------------------------------------------- 1 | .icon-blank{ 2 | background:url('icons/blank.gif') no-repeat center center; 3 | } 4 | .icon-add{ 5 | background:url('icons/edit_add.png') no-repeat center center; 6 | } 7 | .icon-edit{ 8 | background:url('icons/pencil.png') no-repeat center center; 9 | } 10 | .icon-clear{ 11 | background:url('icons/clear.png') no-repeat center center; 12 | } 13 | .icon-remove{ 14 | background:url('icons/edit_remove.png') no-repeat center center; 15 | } 16 | .icon-save{ 17 | background:url('icons/filesave.png') no-repeat center center; 18 | } 19 | .icon-cut{ 20 | background:url('icons/cut.png') no-repeat center center; 21 | } 22 | .icon-ok{ 23 | background:url('icons/ok.png') no-repeat center center; 24 | } 25 | .icon-no{ 26 | background:url('icons/no.png') no-repeat center center; 27 | } 28 | .icon-cancel{ 29 | background:url('icons/cancel.png') no-repeat center center; 30 | } 31 | .icon-reload{ 32 | background:url('icons/reload.png') no-repeat center center; 33 | } 34 | .icon-search{ 35 | background:url('icons/search.png') no-repeat center center; 36 | } 37 | .icon-print{ 38 | background:url('icons/print.png') no-repeat center center; 39 | } 40 | .icon-help{ 41 | background:url('icons/help.png') no-repeat center center; 42 | } 43 | .icon-undo{ 44 | background:url('icons/undo.png') no-repeat center center; 45 | } 46 | .icon-redo{ 47 | background:url('icons/redo.png') no-repeat center center; 48 | } 49 | .icon-back{ 50 | background:url('icons/back.png') no-repeat center center; 51 | } 52 | .icon-sum{ 53 | background:url('icons/sum.png') no-repeat center center; 54 | } 55 | .icon-tip{ 56 | background:url('icons/tip.png') no-repeat center center; 57 | } 58 | .icon-filter{ 59 | background:url('icons/filter.png') no-repeat center center; 60 | } 61 | .icon-man{ 62 | background:url('icons/man.png') no-repeat center center; 63 | } 64 | .icon-lock{ 65 | background:url('icons/lock.png') no-repeat center center; 66 | } 67 | .icon-more{ 68 | background:url('icons/more.png') no-repeat center center; 69 | } 70 | 71 | 72 | .icon-mini-add{ 73 | background:url('icons/mini_add.png') no-repeat center center; 74 | } 75 | .icon-mini-edit{ 76 | background:url('icons/mini_edit.png') no-repeat center center; 77 | } 78 | .icon-mini-refresh{ 79 | background:url('icons/mini_refresh.png') no-repeat center center; 80 | } 81 | 82 | .icon-large-picture{ 83 | background:url('icons/large_picture.png') no-repeat center center; 84 | } 85 | .icon-large-clipart{ 86 | background:url('icons/large_clipart.png') no-repeat center center; 87 | } 88 | .icon-large-shapes{ 89 | background:url('icons/large_shapes.png') no-repeat center center; 90 | } 91 | .icon-large-smartart{ 92 | background:url('icons/large_smartart.png') no-repeat center center; 93 | } 94 | .icon-large-chart{ 95 | background:url('icons/large_chart.png') no-repeat center center; 96 | } 97 | -------------------------------------------------------------------------------- /microsystem_server/public/themes/icons/back.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xukai871105/the_beginning_of_coap/8410596cb2e8d5eef5196429ecbb98771fd1261e/microsystem_server/public/themes/icons/back.png -------------------------------------------------------------------------------- /microsystem_server/public/themes/icons/blank.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xukai871105/the_beginning_of_coap/8410596cb2e8d5eef5196429ecbb98771fd1261e/microsystem_server/public/themes/icons/blank.gif -------------------------------------------------------------------------------- /microsystem_server/public/themes/icons/cancel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xukai871105/the_beginning_of_coap/8410596cb2e8d5eef5196429ecbb98771fd1261e/microsystem_server/public/themes/icons/cancel.png -------------------------------------------------------------------------------- /microsystem_server/public/themes/icons/clear.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xukai871105/the_beginning_of_coap/8410596cb2e8d5eef5196429ecbb98771fd1261e/microsystem_server/public/themes/icons/clear.png -------------------------------------------------------------------------------- /microsystem_server/public/themes/icons/cut.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xukai871105/the_beginning_of_coap/8410596cb2e8d5eef5196429ecbb98771fd1261e/microsystem_server/public/themes/icons/cut.png -------------------------------------------------------------------------------- /microsystem_server/public/themes/icons/edit_add.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xukai871105/the_beginning_of_coap/8410596cb2e8d5eef5196429ecbb98771fd1261e/microsystem_server/public/themes/icons/edit_add.png -------------------------------------------------------------------------------- /microsystem_server/public/themes/icons/edit_remove.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xukai871105/the_beginning_of_coap/8410596cb2e8d5eef5196429ecbb98771fd1261e/microsystem_server/public/themes/icons/edit_remove.png -------------------------------------------------------------------------------- /microsystem_server/public/themes/icons/filesave.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xukai871105/the_beginning_of_coap/8410596cb2e8d5eef5196429ecbb98771fd1261e/microsystem_server/public/themes/icons/filesave.png -------------------------------------------------------------------------------- /microsystem_server/public/themes/icons/filter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xukai871105/the_beginning_of_coap/8410596cb2e8d5eef5196429ecbb98771fd1261e/microsystem_server/public/themes/icons/filter.png -------------------------------------------------------------------------------- /microsystem_server/public/themes/icons/help.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xukai871105/the_beginning_of_coap/8410596cb2e8d5eef5196429ecbb98771fd1261e/microsystem_server/public/themes/icons/help.png -------------------------------------------------------------------------------- /microsystem_server/public/themes/icons/large_chart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xukai871105/the_beginning_of_coap/8410596cb2e8d5eef5196429ecbb98771fd1261e/microsystem_server/public/themes/icons/large_chart.png -------------------------------------------------------------------------------- /microsystem_server/public/themes/icons/large_clipart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xukai871105/the_beginning_of_coap/8410596cb2e8d5eef5196429ecbb98771fd1261e/microsystem_server/public/themes/icons/large_clipart.png -------------------------------------------------------------------------------- /microsystem_server/public/themes/icons/large_picture.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xukai871105/the_beginning_of_coap/8410596cb2e8d5eef5196429ecbb98771fd1261e/microsystem_server/public/themes/icons/large_picture.png -------------------------------------------------------------------------------- /microsystem_server/public/themes/icons/large_shapes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xukai871105/the_beginning_of_coap/8410596cb2e8d5eef5196429ecbb98771fd1261e/microsystem_server/public/themes/icons/large_shapes.png -------------------------------------------------------------------------------- /microsystem_server/public/themes/icons/large_smartart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xukai871105/the_beginning_of_coap/8410596cb2e8d5eef5196429ecbb98771fd1261e/microsystem_server/public/themes/icons/large_smartart.png -------------------------------------------------------------------------------- /microsystem_server/public/themes/icons/lock.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xukai871105/the_beginning_of_coap/8410596cb2e8d5eef5196429ecbb98771fd1261e/microsystem_server/public/themes/icons/lock.png -------------------------------------------------------------------------------- /microsystem_server/public/themes/icons/man.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xukai871105/the_beginning_of_coap/8410596cb2e8d5eef5196429ecbb98771fd1261e/microsystem_server/public/themes/icons/man.png -------------------------------------------------------------------------------- /microsystem_server/public/themes/icons/mini_add.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xukai871105/the_beginning_of_coap/8410596cb2e8d5eef5196429ecbb98771fd1261e/microsystem_server/public/themes/icons/mini_add.png -------------------------------------------------------------------------------- /microsystem_server/public/themes/icons/mini_edit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xukai871105/the_beginning_of_coap/8410596cb2e8d5eef5196429ecbb98771fd1261e/microsystem_server/public/themes/icons/mini_edit.png -------------------------------------------------------------------------------- /microsystem_server/public/themes/icons/mini_refresh.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xukai871105/the_beginning_of_coap/8410596cb2e8d5eef5196429ecbb98771fd1261e/microsystem_server/public/themes/icons/mini_refresh.png -------------------------------------------------------------------------------- /microsystem_server/public/themes/icons/more.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xukai871105/the_beginning_of_coap/8410596cb2e8d5eef5196429ecbb98771fd1261e/microsystem_server/public/themes/icons/more.png -------------------------------------------------------------------------------- /microsystem_server/public/themes/icons/no.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xukai871105/the_beginning_of_coap/8410596cb2e8d5eef5196429ecbb98771fd1261e/microsystem_server/public/themes/icons/no.png -------------------------------------------------------------------------------- /microsystem_server/public/themes/icons/ok.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xukai871105/the_beginning_of_coap/8410596cb2e8d5eef5196429ecbb98771fd1261e/microsystem_server/public/themes/icons/ok.png -------------------------------------------------------------------------------- /microsystem_server/public/themes/icons/pencil.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xukai871105/the_beginning_of_coap/8410596cb2e8d5eef5196429ecbb98771fd1261e/microsystem_server/public/themes/icons/pencil.png -------------------------------------------------------------------------------- /microsystem_server/public/themes/icons/print.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xukai871105/the_beginning_of_coap/8410596cb2e8d5eef5196429ecbb98771fd1261e/microsystem_server/public/themes/icons/print.png -------------------------------------------------------------------------------- /microsystem_server/public/themes/icons/redo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xukai871105/the_beginning_of_coap/8410596cb2e8d5eef5196429ecbb98771fd1261e/microsystem_server/public/themes/icons/redo.png -------------------------------------------------------------------------------- /microsystem_server/public/themes/icons/reload.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xukai871105/the_beginning_of_coap/8410596cb2e8d5eef5196429ecbb98771fd1261e/microsystem_server/public/themes/icons/reload.png -------------------------------------------------------------------------------- /microsystem_server/public/themes/icons/search.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xukai871105/the_beginning_of_coap/8410596cb2e8d5eef5196429ecbb98771fd1261e/microsystem_server/public/themes/icons/search.png -------------------------------------------------------------------------------- /microsystem_server/public/themes/icons/sum.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xukai871105/the_beginning_of_coap/8410596cb2e8d5eef5196429ecbb98771fd1261e/microsystem_server/public/themes/icons/sum.png -------------------------------------------------------------------------------- /microsystem_server/public/themes/icons/tip.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xukai871105/the_beginning_of_coap/8410596cb2e8d5eef5196429ecbb98771fd1261e/microsystem_server/public/themes/icons/tip.png -------------------------------------------------------------------------------- /microsystem_server/public/themes/icons/undo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xukai871105/the_beginning_of_coap/8410596cb2e8d5eef5196429ecbb98771fd1261e/microsystem_server/public/themes/icons/undo.png -------------------------------------------------------------------------------- /microsystem_server/readme.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xukai871105/the_beginning_of_coap/8410596cb2e8d5eef5196429ecbb98771fd1261e/microsystem_server/readme.md -------------------------------------------------------------------------------- /microsystem_server/routes/coap_index.js: -------------------------------------------------------------------------------- 1 | var coap = require('coap'); 2 | var router = require('../lib/coap-router'); 3 | var mysql = require('mysql'); 4 | 5 | var route = new router(); 6 | 7 | var config = require('../config/db-config.json'); 8 | var pool = mysql.createPool(config); 9 | 10 | route.post('/devices/{device_id}', function(req, res) { 11 | console.log('----------------------------------------'); 12 | console.log(new Date().toLocaleString()); 13 | var ts = Math.round(new Date().getTime()/1000) 14 | console.log(ts); 15 | console.log('add sensor datapoint to database'); 16 | 17 | var device_id = req.params.device_id; 18 | console.log('device id: %s', device_id); 19 | 20 | var payload = JSON.parse(req.payload); 21 | var temp = payload.temp; 22 | var hum = payload.hum; 23 | var light = payload.light; 24 | console.log('temp, hum, light', temp, hum, light); 25 | 26 | pool.getConnection(function(err, connection) { 27 | connection.query('INSERT INTO sensor_history SET device_id=?, temp=?, hum=?, light=?, time=NOW()', 28 | [device_id, temp, hum, light], 29 | function(err, results) { 30 | if (err) { 31 | console.log(err.message); 32 | } 33 | connection.release(); 34 | }); 35 | }); 36 | 37 | res.code = '2.04'; 38 | res.setOption('Content-Format', 'application/json'); 39 | res.end(JSON.stringify({ts: Math.round(new Date().getTime()/1000)})) 40 | }); 41 | 42 | // 测试目的路由,没有具体含义 43 | route.get('/test-db', function(req, res) { 44 | var conn = mysql.createConnection(config); 45 | conn.connect(); 46 | 47 | conn.query('SELECT 1+2 AS result', 48 | function(err, rows) { 49 | var result = rows[0].result; 50 | res.code = '2.05'; 51 | res.setOption('Content-Format', 'application/json'); 52 | res.end(JSON.stringify({result: result})); 53 | }); 54 | 55 | conn.end(); 56 | }); 57 | 58 | // 测试目的路由,没有具体含义 59 | route.get('/test-time', function(req, res) { 60 | res.code = '2.05'; 61 | console.log(new Date().toLocaleString()); 62 | res.end(new Date().toLocaleString()) 63 | }); 64 | 65 | module.exports = route; -------------------------------------------------------------------------------- /microsystem_server/routes/index.js: -------------------------------------------------------------------------------- 1 | var express = require('express'); 2 | var router = express.Router(); 3 | var mysql = require('mysql'); 4 | 5 | var config = require('../config/db-config.json'); 6 | 7 | router.get('/test', function (req, res) { 8 | var hello = 'Hello IoT Mircosystem'; 9 | res.render('test.html', {hello: hello}); 10 | }); 11 | 12 | router.get('/', function (req, res) { 13 | get_device_list(function(rows){ 14 | var device_id = rows[0].device_id 15 | var url = '/devices/' + device_id + '/data.json'; 16 | res.render('admin.html', {url: url, device_id: device_id, devices: rows}); 17 | }) 18 | }); 19 | 20 | router.get('/devices/:device_id/page', function (req, res) { 21 | var device_id = req.params.device_id; 22 | var url = '/devices/' + device_id +'/data.json'; 23 | get_device_list(function(rows){ 24 | res.render('admin.html', {url: url, device_id: device_id, devices: rows}); 25 | }) 26 | }); 27 | 28 | router.get('/devices/:device_id/data.json', function (req, res) { 29 | console.log('------------------------------'); 30 | console.log('get device json'); 31 | var device_id = req.params.device_id; 32 | var offset = parseInt(req.query.offset) || 0; 33 | var limit = parseInt(req.query.limit) || 10; 34 | var total = 0; 35 | var rows = null; 36 | 37 | console.log('device_id: ' + device_id); 38 | console.log('offset: ' + offset); 39 | console.log('limit: ' + limit); 40 | 41 | var conn = mysql.createConnection(config); 42 | conn.connect(); 43 | 44 | conn.query('SELECT COUNT(*) as total FROM sensor_history WHERE device_id=?', 45 | [device_id], 46 | function(err, result) { 47 | total = result[0].total; 48 | }); 49 | 50 | conn.query('SELECT * FROM sensor_history WHERE device_id=? order by id desc limit ?, ?', 51 | [device_id, offset, limit], 52 | function(err, result) { 53 | rows = result; 54 | }); 55 | 56 | conn.end(function(err) { 57 | res.json({total:total, rows:rows}); 58 | }); 59 | }); 60 | 61 | function get_device_list(callback) { 62 | var conn = mysql.createConnection(config); 63 | conn.connect(); 64 | 65 | conn.query("SELECT DISTINCT device_id FROM sensor_history", 66 | function(err, rows) { 67 | callback(rows); 68 | }); 69 | 70 | conn.end(); 71 | } 72 | module.exports = router; 73 | -------------------------------------------------------------------------------- /microsystem_server/sensor_history.sql: -------------------------------------------------------------------------------- 1 | 2 | SET FOREIGN_KEY_CHECKS=0; 3 | 4 | -- ---------------------------- 5 | -- Table structure for `sensor_history` 6 | -- ---------------------------- 7 | DROP TABLE IF EXISTS `sensor_history`; 8 | CREATE TABLE `sensor_history` ( 9 | `id` int(11) NOT NULL AUTO_INCREMENT, 10 | `device_id` char(255) NOT NULL COMMENT '设备编号', 11 | `temp` double(11,1) NOT NULL COMMENT '温度传感器结果', 12 | `hum` double(11,1) NOT NULL COMMENT '湿度传感器结果', 13 | `light` double(11,1) NOT NULL COMMENT '光照传感器结果', 14 | `time` datetime NOT NULL, 15 | PRIMARY KEY (`id`) 16 | ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8; 17 | 18 | -- ---------------------------- 19 | -- Records of sensor_history 20 | -- ---------------------------- 21 | INSERT INTO `sensor_history` VALUES ('1', '12CD', '18.0', '58.0', '1802.0', '2016-09-03 21:14:51'); 22 | INSERT INTO `sensor_history` VALUES ('2', 'CD12', '28.0', '68.0', '2300.0', '2016-09-03 21:16:49'); 23 | INSERT INTO `sensor_history` VALUES ('3', 'EE12', '32.0', '70.0', '1900.0', '2016-09-03 21:17:07'); 24 | -------------------------------------------------------------------------------- /microsystem_server/test/post_sensor_data.js: -------------------------------------------------------------------------------- 1 | const coap = require('coap') 2 | 3 | var host = 'localhost' 4 | // var host = '192.168.0.6' // change to raspberry ip address 5 | var device_id = 'CD12' 6 | 7 | var temp = Math.round(10 + (20 - 10) * Math.random()); 8 | var hum = Math.round(60 + (90 - 60) * Math.random()); 9 | var light = Math.round(2000 + (3000 - 2000) * Math.random()); 10 | console.log('temp, hum, light', temp, hum, light); 11 | 12 | var pathname = 'devices/' + device_id; 13 | var req = coap.request({ 14 | host: host, 15 | pathname: pathname, 16 | method: 'POST' 17 | }); 18 | req.setOption('Content-Format', 'application/json'); 19 | 20 | var payload = { 21 | temp: temp, 22 | hum: hum, 23 | light: light 24 | } 25 | req.write(JSON.stringify(payload)); 26 | 27 | req.on('response', function(res) { 28 | console.log('response code: ' + res.code) 29 | console.log('response payload: ' + res.payload) 30 | }) 31 | 32 | req.end() 33 | -------------------------------------------------------------------------------- /microsystem_server/views/admin.html: -------------------------------------------------------------------------------- 1 | {% extends 'layout.html' %} 2 | 3 | {% block title%} 4 | 微型物联网系统 5 | {% endblock %} 6 | 7 | {% block content %} 8 |
9 | 10 |
11 |
12 |
13 | 设备列表 14 | {% for item in devices %} 15 | 16 | {{item.device_id}} 17 | 18 | {% endfor %} 19 |
20 |
21 |
22 | 26 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 |
序号设备编号温度湿度光照时间
46 |
47 |
48 |
49 | 50 | 64 | 65 | {% endblock %} -------------------------------------------------------------------------------- /microsystem_server/views/layout.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | {% block head%} 4 | 5 | 6 | {% block title %}title{% endblock %} 7 | 8 | {% block meta %} 9 | 10 | {% endblock %} 11 | 12 | {% block styles %} 13 | 14 | 15 | 16 | 17 | {% endblock %} 18 | 19 | {% block scripts %} 20 | 21 | 22 | 23 | 24 | {% endblock %} 25 | 26 | {% endblock %} 27 | 28 | 29 | {% block content %} 30 | {% endblock %} 31 | 32 | 33 | -------------------------------------------------------------------------------- /microsystem_server/views/test.html: -------------------------------------------------------------------------------- 1 | {% extends 'layout.html' %} 2 | 3 | {% block content %} 4 |
5 |

{{hello}}

6 |
7 | 8 | 13 | 14 | {% endblock %} -------------------------------------------------------------------------------- /review_demo/http_demo/app.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | from flask import Flask, jsonify, render_template, request 3 | app = Flask(__name__) 4 | 5 | @app.route("/") 6 | def index(): 7 | return render_template('index.html') 8 | 9 | @app.route('/value', methods=['POST']) 10 | def cal_value(): 11 | if request.method == 'POST': 12 | a = request.form.get('a', 0, type=int) 13 | b = request.form.get('b', 0, type=int) 14 | return jsonify(result = a + b) 15 | 16 | if __name__=="__main__": 17 | app.run(host = '0.0.0.0',port = 8080, debug = True) 18 | -------------------------------------------------------------------------------- /review_demo/http_demo/templates/index.html: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | HTTP Demo 6 | 7 | 8 | 11 | 31 | 32 | 33 |

34 | + 35 | = 36 | ? 37 |

38 |

39 | 40 | -------------------------------------------------------------------------------- /review_demo/tcp_echo_demo/tcp_client.py: -------------------------------------------------------------------------------- 1 | import asyncio 2 | # replace ip address here 3 | raspberry_ip_addrss = '192.168.0.8' 4 | class EchoClientProtocol(asyncio.Protocol): 5 | def __init__(self, message, loop): 6 | self.message = message 7 | self.loop = loop 8 | 9 | def connection_made(self, transport): 10 | transport.write(self.message.encode()) 11 | print('Data sent: {!r}'.format(self.message)) 12 | 13 | def data_received(self, data): 14 | print('Data received: {!r}'.format(data.decode())) 15 | 16 | def connection_lost(self, exc): 17 | print('The server closed the connection') 18 | print('Stop the event loop') 19 | self.loop.stop() 20 | 21 | loop = asyncio.get_event_loop() 22 | message = 'Hello World!' 23 | coro = loop.create_connection(lambda: EchoClientProtocol(message, loop), 24 | raspberry_ip_addrss, 8090) 25 | loop.run_until_complete(coro) 26 | loop.run_forever() 27 | loop.close() -------------------------------------------------------------------------------- /review_demo/tcp_echo_demo/tcp_server.py: -------------------------------------------------------------------------------- 1 | import asyncio 2 | 3 | class EchoServerClientProtocol(asyncio.Protocol): 4 | def connection_made(self, transport): 5 | peername = transport.get_extra_info('peername') 6 | print('Connection from {}'.format(peername)) 7 | self.transport = transport 8 | 9 | def data_received(self, data): 10 | message = data.decode() 11 | print('Data received: {!r}'.format(message)) 12 | 13 | print('Send: {!r}'.format(message)) 14 | self.transport.write(data) 15 | 16 | print('Close the client socket') 17 | self.transport.close() 18 | 19 | loop = asyncio.get_event_loop() 20 | # Each client connection will create a new protocol instance 21 | coro = loop.create_server(EchoServerClientProtocol, '0.0.0.0', 8090) 22 | server = loop.run_until_complete(coro) 23 | 24 | # Serve requests until Ctrl+C is pressed 25 | print('Serving on {}'.format(server.sockets[0].getsockname())) 26 | try: 27 | loop.run_forever() 28 | except KeyboardInterrupt: 29 | pass 30 | 31 | # Close the server 32 | server.close() 33 | loop.run_until_complete(server.wait_closed()) 34 | loop.close() 35 | 36 | -------------------------------------------------------------------------------- /review_demo/udp_echo_demo/udp_client.py: -------------------------------------------------------------------------------- 1 | import asyncio 2 | # replace ip address 3 | raspberry_ip_addrss = '192.168.0.8' 4 | class EchoClientProtocol: 5 | def __init__(self, message, loop): 6 | self.message = message 7 | self.loop = loop 8 | self.transport = None 9 | 10 | def connection_made(self, transport): 11 | self.transport = transport 12 | print('Send:', self.message) 13 | self.transport.sendto(self.message.encode()) 14 | 15 | def datagram_received(self, data, addr): 16 | print("Received:", data.decode()) 17 | 18 | print("Close the socket") 19 | self.transport.close() 20 | 21 | def error_received(self, exc): 22 | print('Error received:', exc) 23 | 24 | def connection_lost(self, exc): 25 | print("Socket closed, stop the event loop") 26 | loop = asyncio.get_event_loop() 27 | loop.stop() 28 | 29 | loop = asyncio.get_event_loop() 30 | message = "Hello World!" 31 | connect = loop.create_datagram_endpoint( 32 | lambda: EchoClientProtocol(message, loop), 33 | remote_addr=(raspberry_ip_addrss, 5683)) 34 | transport, protocol = loop.run_until_complete(connect) 35 | loop.run_forever() 36 | transport.close() 37 | loop.close() 38 | -------------------------------------------------------------------------------- /review_demo/udp_echo_demo/udp_server.py: -------------------------------------------------------------------------------- 1 | import asyncio 2 | 3 | class EchoServerProtocol: 4 | def connection_made(self, transport): 5 | self.transport = transport 6 | 7 | def datagram_received(self, data, addr): 8 | message = data.decode() 9 | print('Received %r from %s' % (message, addr)) 10 | print('Send %r to %s' % (message, addr)) 11 | self.transport.sendto(data, addr) 12 | 13 | loop = asyncio.get_event_loop() 14 | print("Starting UDP server") 15 | # One protocol instance will be created to serve all client requests 16 | listen = loop.create_datagram_endpoint( 17 | EchoServerProtocol, local_addr=('0.0.0.0', 5678)) 18 | transport, protocol = loop.run_until_complete(listen) 19 | 20 | try: 21 | loop.run_forever() 22 | except KeyboardInterrupt: 23 | pass 24 | 25 | transport.close() 26 | loop.close() 27 | -------------------------------------------------------------------------------- /simple_demo/aiocoap_demo/.gitignore: -------------------------------------------------------------------------------- 1 | # Pycharm 2 | .idea/ 3 | 4 | -------------------------------------------------------------------------------- /simple_demo/aiocoap_demo/README.md: -------------------------------------------------------------------------------- 1 | # the_beginning_of_coap -------------------------------------------------------------------------------- /simple_demo/aiocoap_demo/rpi_gpio_server.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | import logging 3 | 4 | import asyncio 5 | import aiocoap.resource as resource 6 | import aiocoap 7 | 8 | import RPi.GPIO as GPIO 9 | import json 10 | 11 | led_pin = 11 12 | class GPIOResource(resource.Resource): 13 | def __init__(self): 14 | super(GPIOResource, self).__init__() 15 | led_status = {'value': 0} 16 | self.content = json.dumps(led_status).encode("ascii") 17 | 18 | async def render_get(self, request): 19 | return aiocoap.Message(code=aiocoap.Code.CONTENT, payload=self.content) 20 | 21 | async def render_put(self, request): 22 | print('PUT payload: %s' % request.payload) 23 | led_status = json.loads(request.payload.decode()) 24 | if led_status['value'] == 1 : 25 | print('open led') 26 | GPIO.output(led_pin, GPIO.HIGH) 27 | else : 28 | print('close led') 29 | GPIO.output(led_pin, GPIO.LOW) 30 | self.content = json.dumps(led_status).encode("ascii") 31 | return aiocoap.Message(code=aiocoap.Code.CHANGED, payload=self.content) 32 | 33 | logging.basicConfig(level=logging.INFO) 34 | logging.getLogger("coap-server").setLevel(logging.DEBUG) 35 | 36 | def main(): 37 | # setup gpio 38 | GPIO.setmode(GPIO.BOARD) 39 | GPIO.setup(led_pin, GPIO.OUT) 40 | 41 | # Resource tree creation 42 | root = resource.Site() 43 | root.add_resource(('.well-known', 'core'), resource.WKCResource(root.get_resources_as_linkheader)) 44 | root.add_resource(('gpio',), GPIOResource()) 45 | asyncio.Task(aiocoap.Context.create_server_context(root)) 46 | asyncio.get_event_loop().run_forever() 47 | 48 | if __name__ == "__main__": 49 | main() 50 | -------------------------------------------------------------------------------- /simple_demo/aiocoap_demo/test-client.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | import logging 4 | import asyncio 5 | 6 | import aiocoap 7 | 8 | logging.basicConfig(level=logging.INFO) 9 | 10 | async def main(): 11 | protocol = await aiocoap.Context.create_client_context() 12 | 13 | request = aiocoap.Message(code=aiocoap.Code.GET, uri='coap://192.168.0.6/time') 14 | 15 | try: 16 | response = await protocol.request(request).response 17 | except Exception as e: 18 | print('Failed to fetch resource:') 19 | print(e) 20 | else: 21 | print('Result: %s\n%r' % (response.code, response.payload)) 22 | 23 | if __name__ == "__main__": 24 | asyncio.get_event_loop().run_until_complete(main()) 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /simple_demo/aiocoap_demo/test-server.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | import datetime 3 | import logging 4 | import asyncio 5 | 6 | import aiocoap.resource as resource 7 | import aiocoap 8 | 9 | class TimeResource(resource.Resource): 10 | def __init__(self): 11 | super(TimeResource, self).__init__() 12 | 13 | async def render_get(self, request): 14 | payload = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S").encode('ascii') 15 | return aiocoap.Message(code=aiocoap.Code.CONTENT, payload=payload) 16 | 17 | class BlockResource(resource.Resource): 18 | def __init__(self): 19 | super(BlockResource, self).__init__() 20 | self.content = ("123456789ABCDEF\n" * 16).encode("ascii") 21 | 22 | async def render_get(self, request): 23 | return aiocoap.Message(code=aiocoap.Code.CONTENT, payload=self.content) 24 | 25 | logging.basicConfig(level=logging.INFO) 26 | logging.getLogger("coap-server").setLevel(logging.DEBUG) 27 | 28 | def main(): 29 | root = resource.Site() 30 | root.add_resource(('.well-known', 'core'), resource.WKCResource(root.get_resources_as_linkheader)) 31 | root.add_resource(('time',), TimeResource()) 32 | root.add_resource(('other', 'block'), BlockResource()) 33 | asyncio.Task(aiocoap.Context.create_server_context(root)) 34 | asyncio.get_event_loop().run_forever() 35 | 36 | if __name__ == "__main__": 37 | main() 38 | 39 | -------------------------------------------------------------------------------- /simple_demo/cf_demo/.gitignore: -------------------------------------------------------------------------------- 1 | .metadata/ 2 | RemoteSystemsTempFiles/ 3 | .recommenders/ 4 | .project 5 | -------------------------------------------------------------------------------- /simple_demo/cf_demo/runnable_jar/.gitignore: -------------------------------------------------------------------------------- 1 | Californium.properties 2 | -------------------------------------------------------------------------------- /simple_demo/cf_demo/runnable_jar/test-coap-client.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xukai871105/the_beginning_of_coap/8410596cb2e8d5eef5196429ecbb98771fd1261e/simple_demo/cf_demo/runnable_jar/test-coap-client.jar -------------------------------------------------------------------------------- /simple_demo/cf_demo/runnable_jar/test-coap-server.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xukai871105/the_beginning_of_coap/8410596cb2e8d5eef5196429ecbb98771fd1261e/simple_demo/cf_demo/runnable_jar/test-coap-server.jar -------------------------------------------------------------------------------- /simple_demo/cf_demo/sources/californium-core-2.0.0-M2-sources.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xukai871105/the_beginning_of_coap/8410596cb2e8d5eef5196429ecbb98771fd1261e/simple_demo/cf_demo/sources/californium-core-2.0.0-M2-sources.jar -------------------------------------------------------------------------------- /simple_demo/cf_demo/sources/element-connector-2.0.0-M2-sources.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xukai871105/the_beginning_of_coap/8410596cb2e8d5eef5196429ecbb98771fd1261e/simple_demo/cf_demo/sources/element-connector-2.0.0-M2-sources.jar -------------------------------------------------------------------------------- /simple_demo/cf_demo/test-coap-client/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /simple_demo/cf_demo/test-coap-client/.gitignore: -------------------------------------------------------------------------------- 1 | /bin/ 2 | -------------------------------------------------------------------------------- /simple_demo/cf_demo/test-coap-client/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | test-coap-client 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.jdt.core.javanature 16 | 17 | 18 | -------------------------------------------------------------------------------- /simple_demo/cf_demo/test-coap-client/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 4 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve 5 | org.eclipse.jdt.core.compiler.compliance=1.8 6 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate 7 | org.eclipse.jdt.core.compiler.debug.localVariable=generate 8 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate 9 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 10 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 11 | org.eclipse.jdt.core.compiler.source=1.8 12 | -------------------------------------------------------------------------------- /simple_demo/cf_demo/test-coap-client/Californium.properties: -------------------------------------------------------------------------------- 1 | #Californium CoAP Properties file 2 | #Mon Dec 19 09:34:10 CST 2016 3 | HTTP_SERVER_SOCKET_BUFFER_SIZE=8192 4 | UDP_CONNECTOR_OUT_CAPACITY=2147483647 5 | CONGESTION_CONTROL_ALGORITHM=Cocoa 6 | USE_CONGESTION_CONTROL=false 7 | ACK_TIMEOUT=2000 8 | TCP_CONNECT_TIMEOUT=10000 9 | NOTIFICATION_CHECK_INTERVAL_COUNT=100 10 | MAX_MESSAGE_SIZE=1024 11 | DEDUPLICATOR=DEDUPLICATOR_MARK_AND_SWEEP 12 | TCP_CONNECTION_IDLE_TIMEOUT=10 13 | COAP_PORT=5683 14 | ACK_TIMEOUT_SCALE=2.0 15 | PREFERRED_BLOCK_SIZE=512 16 | NETWORK_STAGE_RECEIVER_THREAD_COUNT=4 17 | PROTOCOL_STAGE_THREAD_COUNT=4 18 | MAX_TRANSMIT_WAIT=93000 19 | USE_STRICT_RESPONSE_MATCHING=false 20 | UDP_CONNECTOR_RECEIVE_BUFFER=0 21 | EXCHANGE_LIFETIME=247000 22 | HTTP_SERVER_SOCKET_TIMEOUT=100000 23 | CROP_ROTATION_PERIOD=2000 24 | UDP_CONNECTOR_DATAGRAM_SIZE=2048 25 | MAX_RETRANSMIT=4 26 | NOTIFICATION_CHECK_INTERVAL=86400000 27 | LEISURE=5000 28 | HTTP_CACHE_RESPONSE_MAX_AGE=86400 29 | BLOCKWISE_STATUS_LIFETIME=600000 30 | UDP_CONNECTOR_SEND_BUFFER=0 31 | TCP_WORKER_THREADS=1 32 | HEALTH_STATUS_PRINT_LEVEL=FINEST 33 | NETWORK_STAGE_SENDER_THREAD_COUNT=4 34 | NON_LIFETIME=145000 35 | TOKEN_SIZE_LIMIT=8 36 | HTTP_PORT=8080 37 | MARK_AND_SWEEP_INTERVAL=10000 38 | HEALTH_STATUS_INTERVAL=60 39 | ACK_RANDOM_FACTOR=1.5 40 | NSTART=1 41 | USE_RANDOM_MID_START=true 42 | HTTP_CACHE_SIZE=32 43 | PROBING_RATE=1.0 44 | NOTIFICATION_REREGISTRATION_BACKOFF=2000 45 | COAP_SECURE_PORT=5684 46 | -------------------------------------------------------------------------------- /simple_demo/cf_demo/test-coap-client/lib/californium-core-2.0.0-M2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xukai871105/the_beginning_of_coap/8410596cb2e8d5eef5196429ecbb98771fd1261e/simple_demo/cf_demo/test-coap-client/lib/californium-core-2.0.0-M2.jar -------------------------------------------------------------------------------- /simple_demo/cf_demo/test-coap-client/lib/element-connector-2.0.0-M2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xukai871105/the_beginning_of_coap/8410596cb2e8d5eef5196429ecbb98771fd1261e/simple_demo/cf_demo/test-coap-client/lib/element-connector-2.0.0-M2.jar -------------------------------------------------------------------------------- /simple_demo/cf_demo/test-coap-client/src/org/wsncoap/GETClient.java: -------------------------------------------------------------------------------- 1 | package org.wsncoap; 2 | 3 | import java.net.URI; 4 | import java.net.URISyntaxException; 5 | 6 | import org.eclipse.californium.core.CoapClient; 7 | import org.eclipse.californium.core.CoapResponse; 8 | import org.eclipse.californium.core.Utils; 9 | 10 | public class GETClient { 11 | 12 | public static void main(String args[]) { 13 | 14 | URI uri = null; 15 | 16 | if (args.length > 0) { 17 | 18 | try { 19 | uri = new URI(args[0]); 20 | } catch (URISyntaxException e) { 21 | System.err.println("Invalid URI: " + e.getMessage()); 22 | System.exit(-1); 23 | } 24 | 25 | CoapClient client = new CoapClient(uri); 26 | CoapResponse response = client.get(); 27 | if (response!=null) { 28 | 29 | System.out.println(response.getCode()); 30 | System.out.println(response.getOptions()); 31 | System.out.println(response.getResponseText()); 32 | 33 | System.out.println("\nADVANCED\n"); 34 | // access advanced API with access to more details through .advanced() 35 | System.out.println(Utils.prettyPrint(response)); 36 | 37 | } else { 38 | System.out.println("No response received."); 39 | } 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /simple_demo/cf_demo/test-coap-server/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /simple_demo/cf_demo/test-coap-server/.gitignore: -------------------------------------------------------------------------------- 1 | /bin/ 2 | -------------------------------------------------------------------------------- /simple_demo/cf_demo/test-coap-server/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | test-coap-server 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.jdt.core.javanature 16 | 17 | 18 | -------------------------------------------------------------------------------- /simple_demo/cf_demo/test-coap-server/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 4 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve 5 | org.eclipse.jdt.core.compiler.compliance=1.8 6 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate 7 | org.eclipse.jdt.core.compiler.debug.localVariable=generate 8 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate 9 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 10 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 11 | org.eclipse.jdt.core.compiler.source=1.8 12 | -------------------------------------------------------------------------------- /simple_demo/cf_demo/test-coap-server/Californium.properties: -------------------------------------------------------------------------------- 1 | #Californium CoAP Properties file 2 | #Sun Dec 18 15:41:09 CST 2016 3 | HTTP_SERVER_SOCKET_BUFFER_SIZE=8192 4 | UDP_CONNECTOR_OUT_CAPACITY=2147483647 5 | CONGESTION_CONTROL_ALGORITHM=Cocoa 6 | USE_CONGESTION_CONTROL=false 7 | ACK_TIMEOUT=2000 8 | TCP_CONNECT_TIMEOUT=10000 9 | NOTIFICATION_CHECK_INTERVAL_COUNT=100 10 | MAX_MESSAGE_SIZE=1024 11 | DEDUPLICATOR=DEDUPLICATOR_MARK_AND_SWEEP 12 | TCP_CONNECTION_IDLE_TIMEOUT=10 13 | COAP_PORT=5683 14 | ACK_TIMEOUT_SCALE=2.0 15 | PREFERRED_BLOCK_SIZE=512 16 | NETWORK_STAGE_RECEIVER_THREAD_COUNT=4 17 | PROTOCOL_STAGE_THREAD_COUNT=4 18 | MAX_TRANSMIT_WAIT=93000 19 | USE_STRICT_RESPONSE_MATCHING=false 20 | UDP_CONNECTOR_RECEIVE_BUFFER=0 21 | EXCHANGE_LIFETIME=247000 22 | HTTP_SERVER_SOCKET_TIMEOUT=100000 23 | CROP_ROTATION_PERIOD=2000 24 | UDP_CONNECTOR_DATAGRAM_SIZE=2048 25 | MAX_RETRANSMIT=4 26 | NOTIFICATION_CHECK_INTERVAL=86400000 27 | LEISURE=5000 28 | HTTP_CACHE_RESPONSE_MAX_AGE=86400 29 | BLOCKWISE_STATUS_LIFETIME=600000 30 | UDP_CONNECTOR_SEND_BUFFER=0 31 | TCP_WORKER_THREADS=1 32 | HEALTH_STATUS_PRINT_LEVEL=FINEST 33 | NETWORK_STAGE_SENDER_THREAD_COUNT=4 34 | NON_LIFETIME=145000 35 | TOKEN_SIZE_LIMIT=8 36 | HTTP_PORT=8080 37 | MARK_AND_SWEEP_INTERVAL=10000 38 | HEALTH_STATUS_INTERVAL=60 39 | ACK_RANDOM_FACTOR=1.5 40 | NSTART=1 41 | USE_RANDOM_MID_START=true 42 | HTTP_CACHE_SIZE=32 43 | PROBING_RATE=1.0 44 | NOTIFICATION_REREGISTRATION_BACKOFF=2000 45 | COAP_SECURE_PORT=5684 46 | -------------------------------------------------------------------------------- /simple_demo/cf_demo/test-coap-server/lib/californium-core-2.0.0-M2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xukai871105/the_beginning_of_coap/8410596cb2e8d5eef5196429ecbb98771fd1261e/simple_demo/cf_demo/test-coap-server/lib/californium-core-2.0.0-M2.jar -------------------------------------------------------------------------------- /simple_demo/cf_demo/test-coap-server/lib/element-connector-2.0.0-M2.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xukai871105/the_beginning_of_coap/8410596cb2e8d5eef5196429ecbb98771fd1261e/simple_demo/cf_demo/test-coap-server/lib/element-connector-2.0.0-M2.jar -------------------------------------------------------------------------------- /simple_demo/cf_demo/test-coap-server/src/org/wsncoap/HelloCoAPServer.java: -------------------------------------------------------------------------------- 1 | package org.wsncoap; 2 | 3 | import java.text.SimpleDateFormat; 4 | import java.util.Date; 5 | 6 | import org.eclipse.californium.core.CoapResource; 7 | import org.eclipse.californium.core.CoapServer; 8 | import org.eclipse.californium.core.coap.CoAP.ResponseCode; 9 | import org.eclipse.californium.core.server.resources.CoapExchange; 10 | 11 | public class HelloCoAPServer { 12 | 13 | public static void main(String[] args) { 14 | 15 | CoapServer server = new CoapServer(); 16 | server.add(new CoapResource("hello") { 17 | @Override 18 | public void handleGET(CoapExchange exchange) { 19 | exchange.respond(ResponseCode.CONTENT, "Hello CoAP!"); 20 | } 21 | }); 22 | server.add(new CoapResource("time") { 23 | @Override 24 | public void handleGET(CoapExchange exchange) { 25 | 26 | Date date = new Date(); 27 | exchange.respond(ResponseCode.CONTENT, 28 | new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(date)); 29 | } 30 | }); 31 | server.start(); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /simple_demo/nodecoap_demo/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .project 3 | .settings -------------------------------------------------------------------------------- /simple_demo/nodecoap_demo/client.js: -------------------------------------------------------------------------------- 1 | const coap = require('coap') 2 | const req = coap.request({host:'localhost', pathname:'time', method:'GET'}) 3 | 4 | req.on('response', function(res) { 5 | console.log('response code: ' + res.code) 6 | console.log('response payload: ' + res.payload) 7 | }) 8 | 9 | req.end() 10 | -------------------------------------------------------------------------------- /simple_demo/nodecoap_demo/json_server.js: -------------------------------------------------------------------------------- 1 | const coap = require('coap') 2 | const server = coap.createServer() 3 | 4 | server.on('request', function(req, res) { 5 | console.log('method:' + req.method + ' url:' + req.url) 6 | if (req.method == 'PUT' && req.url.split('/')[1] == 'multi-format') { 7 | if (req.headers['Accept'] == 'application/json') { 8 | res.code = '2.04' 9 | res.setOption('Content-Format', 'application/json') 10 | res.end(JSON.stringify({payload: req.payload.toString()})) 11 | } else { 12 | res.code = '2.04' 13 | res.end('payload: ' + req.payload.toString()) 14 | } 15 | } 16 | }) 17 | 18 | server.listen(function() { 19 | console.log('server started') 20 | }) 21 | -------------------------------------------------------------------------------- /simple_demo/nodecoap_demo/server.js: -------------------------------------------------------------------------------- 1 | const coap = require('coap') 2 | const server = coap.createServer() 3 | 4 | server.on('request', function(req, res) { 5 | console.log('method:' + req.method + ' url:' + req.url) 6 | if (req.method == 'GET' && req.url.split('/')[1] == 'time') { 7 | console.log(new Date().toLocaleString()) 8 | res.end(new Date().toLocaleString()) 9 | } 10 | }) 11 | 12 | server.listen(function() { 13 | console.log('server started') 14 | }) 15 | --------------------------------------------------------------------------------