# 给TCP设备发送消息

## OpenAPI Specification

```yaml
openapi: 3.0.1
info:
  title: ''
  description: ''
  version: 1.0.0
paths:
  /api/sendMsg:
    get:
      summary: 给TCP设备发送消息
      deprecated: false
      description: >-
        签名校验方法：将url中的参数按ASC的顺序排列(ksort($array))，然后进行md5加密，加密后长度为32位。例如：{"api_key":"734af80ad44b8704a1c358cc6130c8d1","api_secret":"7f476393d4db6f177c8918854c72ced6","device_code":"3PJcHCs5nynJGdb","msg":"1234","vtype":"0","eol":"0"}

        加密方式：对以下字符串进行md5加密

        api_key734af80ad44b8704a1c358cc6130c8d1api_secret7f476393d4db6f177c8918854c72ced6device_code3PJcHCs5nynJGdbeol0msg1234vtype0

        加密结果：de354c39d8248734b864c6a9ec26933f

        完整请求url：

        http://47.104.225.241:6767/api/sendMsg?device_code=3PJcHCs5nynJGdb&api_key=734af80ad44b8704a1c358cc6130c8d1&msg=1234&vtype=0&eol=0&sign=de354c39d8248734b864c6a9ec26933f

        注意：

        1、本接口只支持给TCP设备发送消息，如需给MQTT设备发送消息，请使用MQTT设备发送消息接口

        2、本接口适用于：

        　　私有化部署https://www.workerman.net/app/preview/488
      tags: []
      parameters:
        - name: device_code
          in: query
          description: 设备注册包
          required: true
          example: 3PJcHCs5nynJGdb
          schema:
            type: string
        - name: api_key
          in: query
          description: api_key
          required: true
          example: 734af80ad44b8704a1c358cc6130c8d1
          schema:
            type: string
        - name: msg
          in: query
          description: 发送的消息内容
          required: true
          example: '1234'
          schema:
            type: string
        - name: vtype
          in: query
          description: 数据类型:0ASCII,1HEX16进制,2:GB2312
          required: true
          example: 0
          schema:
            type: integer
        - name: eol
          in: query
          description: 是否在消息末尾加换行符,0不加,1加换行符"\n"
          required: true
          example: 0
          schema:
            type: integer
        - name: sign
          in: query
          description: 签名
          required: true
          example: de354c39d8248734b864c6a9ec26933f
          schema:
            type: string
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: integer
                    description: 0执行成功,其他:执行失败
                  msg:
                    type: string
                    description: 执行结果
                required:
                  - code
                  - msg
                x-apifox-orders:
                  - code
                  - msg
              example:
                code: 0
                msg: 发送成功
          headers: {}
          x-apifox-name: 成功
      security: []
      x-apifox-folder: ''
      x-apifox-status: released
      x-run-in-apifox: https://app.apifox.com/web/project/2344842/apis/api-189698607-run
components:
  schemas: {}
  securitySchemes: {}
servers: []
security: []

```
