phodal/diaonan

View on GitHub
app/views/home.hbs

Summary

Maintainability
Test Coverage

<!-- Main hero unit for a primary marketing message or call to action -->
<div class="jumbo">
  <div class="row">
    <div class="span1"></div>
    <div class="span4 logo">
        <h3 itemprop="headline">让我们创造、连接一切的节点。</h3>
    </div>
    <div class="span4">
      <form id="go" method="get">
        <h2>打开节点</h2>
        <div class="input-append">
          <input type="text" id="topic" name="topic" class="input-large" rows="10" placeholder="输入节点名,如Phodal">
          <input type="submit" class="btn btn-success" value="GO!">
        </div>
      </form>
        <h2>最近的节点</h2>
        {{#if topics.length }}
            <ul>
                {{#each topics}}
                    <li><a href="/topics/{{this}}">{{this}}</a></li>
                {{/each}}
            </ul>
        {{else}}
            <p>
                没有节点,创建新的节点!
            </p>
        {{/if}}
    </div>

    </div>
  </div>
</div>

<div class="row" itemprop="releaseNotes">
  <div class="span6">
    <h2>创建</h2>

<p ><span itemprop="about"><strong>吊兰</strong>是一个在线的物联网测试平台,用他来测试你的物联网设备。</span>
    你可以在上面打开一个节点,也可以直接用<span item="keywords">MQTT,REST,CoAP,WebSocket</span>等相应的来测试你的代码、硬件等等。</p>
<div> 
{{#markdown}}

REST示例如下所示:

    $ curl -X PUT -d '{ "dream": 1 }' -H "Content-Type: application/json" http://mqtt.phodal.com/topics/lettuce

    $ curl http://mqtt.phodal.com/topics/lettuce
    { "dream": 1 }

Mosquitto示例

    mosquitto_pub -h mqtt.phodal.com -d -t lettuce -m "Hello, MQTT. This is my first message."

Python MQTT示例:

    import mosquitto
    mqttc = mosquitto.Mosquitto("python_pub")
    mqttc.connect("mqtt.phodal.com", 1883, 60, True)

    mqttc.publish("lettuce", "Hello, World!")

CoAP GET示例:

    coap-client -m get coap://mqtt.phodal.com:5683/topics/zero

CoAP POST示例

    echo -n 'hello world' | coap post coap://mqtt.phodal.com/topics/zero
    echo -n '{"lettuce": 123}' | coap post coap://mqtt.phodal.com/topics/zero

Arduino MQTT示例

    #include <SPI.h>
    #include <Ethernet.h>
    #include <PubSubClient.h>

    byte mac[]    = {  0xDE, 0xED, 0xBA, 0xFE, 0xFE, 0xED };
    byte server[] = { 192, 168, 168, 78 }; // MQTT服务地址
    byte ip[]     = { 192, 168, 168, 250 }; // 设备IP

    void callback(char* topic, byte* payload, unsigned int length) {
    // handle message arrived
    }

    EthernetClient ethClient;
    PubSubClient client(server, 1883, callback, ethClient);

    void setup()
    {
        Ethernet.begin(mac, ip);
        if (client.connect("arduinoClient")) {
            client.publish("outTopic","hello world");
            client.subscribe("inTopic");
        }
    }

    void loop()
    {
        client.loop();
    }

让我们用物联网做一些有趣的事!

{{/markdown}}
</div>
  </div>
  <div class="span6">
    <h2>More</h2>

{{#markdown}}

###协议支持###

 - MQTT
 - RESTful(HTTP GET/POST)
 - WebSocket
 - CoAP
{{/markdown}}

<div itemprop="device">
<h3>支持设备</h3>
{{#markdown}}

- Arduino
- 8051/51 Family
- Raspberry Pi
- PCduino
- STM32
- ARM
- Android Devices
- iOS Devices
- Windows Phone Devices
- ...

{{/markdown}}
</div>

{{#markdown}}

###APP

[教你设计物联网](https://play.google.com/store/apps/details?id=com.phodal.designiot)

###开源物联网项目

[最小物联网系统HTTP版(PHP)](https://github.com/phodal/iot)

[最小物联网系统CoAP版(NODE.JS)](https://github.com/phodal/iot-coap)

[《物联网相关资料收集》](https://github.com/phodal/collection-iot)

[《一步步搭建物联网系统》](https://github.com/phodal/designiot)

###交流

QQ群:348100589

###联系我

[h@phodal.com](mailto:h@phodal.com)

{{/markdown}}
  </div>

</div>
{{ js "home.js" }}