浏览代码

更新说明

lijian 6 年之前
父节点
当前提交
336c6bc179
共有 5 个文件被更改,包括 19 次插入5 次删除
  1. 14 1
      README.md
  2. 1 1
      pkg/coap/manager.go
  3. 0 1
      pkg/mqtt/broker.go
  4. 3 1
      pkg/mqtt/connection.go
  5. 1 1
      pkg/mqtt/utils_test.go

+ 14 - 1
README.md

@@ -10,4 +10,17 @@
 * `mqttaccess`: MQTT接入服务 [文档说明](mqttaccess.md)
 * `knowoapi`: 开放平台管理中心api接口服务 [文档说明](knowoapi.md)
 * `fileaccess`: 静态文件服务器 [文档说明](./services/fileaccess/readme.markdown)
-* `coapaccess`: CoAP接入服务[文档说明](./services/coapaccess/readme.md)
+* `coapaccess`: CoAP接入服务[文档说明](./services/coapaccess/readme.md)
+
+
+## 开发编译
+
+```bash
+./install.sh
+```
+
+## 运行
+
+```bash
+./run.sh
+```

+ 1 - 1
pkg/coap/manager.go

@@ -195,7 +195,7 @@ func (m *Manager) serve(w *Request) {
 			return
 		}
 	} else {
-		//无效请求
+		//TODO:无效请求
 	}
 }
 

+ 0 - 1
pkg/mqtt/broker.go

@@ -16,7 +16,6 @@ func NewBroker(p Provider) *Broker {
 	mgr := NewManager(p)
 
 	handler := &Broker{mgr: mgr}
-
 	return handler
 }
 

+ 3 - 1
pkg/mqtt/connection.go

@@ -82,7 +82,7 @@ func (c *Connection) Publish(msg Message, timeout time.Duration) error {
 		<-timer.C
 		waitCh, exist := c.MessageWaitChan[message.MessageID]
 		if exist {
-			waitCh <- errors.New("timeout pushlishing message.")
+			waitCh <- errors.New("timeout pushlishing message")
 			delete(c.MessageWaitChan, message.MessageID)
 			close(waitCh)
 		}
@@ -101,6 +101,7 @@ func (c *Connection) confirmPublish(MessageID uint16) {
 	}
 }
 
+// ValidateToken validate token
 func (c *Connection) ValidateToken(token []byte) error {
 
 	err := c.Mgr.Provider.ValidateDeviceToken(c.DeviceID, token)
@@ -113,6 +114,7 @@ func (c *Connection) ValidateToken(token []byte) error {
 	return nil
 }
 
+// Close close
 func (c *Connection) Close() {
 	DeviceID := c.DeviceID
 	server.Log.Infof("closing connection of device %v", DeviceID)

+ 1 - 1
pkg/mqtt/utils_test.go

@@ -3,7 +3,7 @@ package mqtt
 import "testing"
 
 func TestClientIdToDeviceId(t *testing.T) {
-	id, err := ClientIdToDeviceId("ff")
+	id, err := ClientIDToDeviceID("ff")
 	if err != nil {
 		t.Fatal(err)
 	}