Skip to content

Commit

Permalink
Merge pull request #59 from Mediatek-Cloud/MCS-2768-Image-data-channel
Browse files Browse the repository at this point in the history
MCS-2768 image data channel format
  • Loading branch information
anchi1216 committed Jan 7, 2016
2 parents 93ba2ad + a4412aa commit d5789af
Show file tree
Hide file tree
Showing 6 changed files with 193 additions and 95 deletions.
28 changes: 17 additions & 11 deletions content/en/api_references/command_server_format.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ The command Format:
### Switch

```
deviceId,deviceKey,timestamp,dataChannelId,{0 or 1}
deviceId,deviceKey,timestamp,dataChnId,{0 or 1}
```
0 stands for OFF, and 1 stands for ON.
Expand All @@ -59,34 +59,34 @@ To turn the switch01 to on state, and do not give the timestamp.

### Category
```
deviceId,deviceKey,timestamp,dataChannelId,{Key Value}
deviceId,deviceKey,timestamp,dataChnId,{Key Value}
```
The Key value will correspond to the Key name that you’ve set.

### Integer
```
deviceId,deviceKey,timestamp,dataChannelId,{Integer}
deviceId,deviceKey,timestamp,dataChnId,{Integer}
```

### Float
```
deviceId,deviceKey,timestamp,dataChannelId,{Float}
deviceId,deviceKey,timestamp,dataChnId,{Float}
```

### Hex
```
deviceId,deviceKey,timestamp,dataChannelId,{Hex value}
deviceId,deviceKey,timestamp,dataChnId,{Hex value}
```
Hex is referred to hexadecimal value which only takes value from A-D and 0-9.

### String
```
deviceId,deviceKey,timestamp,dataChannelId,{string}
deviceId,deviceKey,timestamp,dataChnId,{string}
```

### GPS
```
deviceId,deviceKey,timestamp,dataChannelId,{latitude},{longitude},{altitude}
deviceId,deviceKey,timestamp,dataChnId,{latitude},{longitude},{altitude}
```

The range of latitude is from -90 to 90. 0 to 90 stands for North and 0 to -90 stands for South.
Expand All @@ -97,24 +97,30 @@ The range of altitude is from 0 to 20000 in meter.

### GPIO
```
deviceId,deviceKey,timestamp,dataChannelId,{0 ot 1}
deviceId,deviceKey,timestamp,dataChnId,{0 ot 1}
```
0 stands for Low, and 1 stands for High.

### PWM
```
deviceId,deviceKey,timestamp,dataChannelId,{value},{period}
deviceId,deviceKey,timestamp,dataChnId,{value},{period}
```

### Analog
```
deviceId,deviceKey,timestamp,dataChannelId,{value}
deviceId,deviceKey,timestamp,dataChnId,{value}
```

### Gamepad
```
deviceId,deviceKey,timestamp,dataChannelId,{up/down/right/left/A/B value| press(1) or release(0)}
deviceId,deviceKey,timestamp,dataChnId,{up/down/right/left/A/B value| press(1) or release(0)}
```

### Image
```
deviceId,deviceKey,timestamp,dataChnId,{image file base64 encoding string value}
```
71 changes: 50 additions & 21 deletions content/en/api_references/data_channel_format.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ For json:
{
"datapoints":[
{
"dataChnId":"dataChanId",
"dataChnId":"dataChnId",
"values":{
"value":"{0 or 1}"
}
Expand All @@ -29,7 +29,7 @@ For json:
For csv:

```
dataChannelId,timestamp,{0 or 1}
dataChnId,timestamp,{0 or 1}
```
0 stands for OFF, and 1 stands for ON.
Expand All @@ -48,7 +48,7 @@ For json:
{
"datapoints":[
{
"dataChnId":"dataChanId",
"dataChnId":"dataChnId",
"values":{
"value":"{Key value}"
}
Expand All @@ -62,7 +62,7 @@ For json:
For csv:

```
dataChannelId,timestamp,{Key Value}
dataChnId,timestamp,{Key Value}
```
The Key value will correspond to the Key name that you’ve set.

Expand All @@ -74,7 +74,7 @@ For json:
{
"datapoints":[
{
"dataChnId":"dataChanId",
"dataChnId":"dataChnId",
"values":{
"value":"{Integer value}"
}
Expand All @@ -88,7 +88,7 @@ For json:
For csv:

```
dataChannelId,timestamp,{Integer}
dataChnId,timestamp,{Integer}
```

## Float
Expand All @@ -99,7 +99,7 @@ For json:
{
"datapoints":[
{
"dataChnId":"dataChanId",
"dataChnId":"dataChnId",
"values":{
"value":"{Float value}"
}
Expand All @@ -113,7 +113,7 @@ For json:
For csv:

```
dataChannelId,timestamp,{Float}
dataChnId,timestamp,{Float}
```

## Hex
Expand All @@ -124,7 +124,7 @@ For json:
{
"datapoints":[
{
"dataChnId":"dataChanId",
"dataChnId":"dataChnId",
"values":{
"value":"{HEX value}"
}
Expand All @@ -138,7 +138,7 @@ For json:
For csv:

```
dataChannelId,timestamp,{Hex value}
dataChnId,timestamp,{Hex value}
```
Hex is referred to hexadecimal value which only takes value from A-D and 0-9.

Expand All @@ -150,7 +150,7 @@ For json:
{
"datapoints":[
{
"dataChnId":"dataChanId",
"dataChnId":"dataChnId",
"values":{
"value":"{string value}"
}
Expand All @@ -164,7 +164,7 @@ For json:
For csv:

```
dataChannelId,timestamp,{string}
dataChnId,timestamp,{string}
```

## GPS
Expand All @@ -190,7 +190,7 @@ For json:
For csv:

```
dataChannelId,timestamp,{latitude},{longitude},{altitude}
dataChnId,timestamp,{latitude},{longitude},{altitude}
```

The range of latitude is from -90 to 90. 0 to 90 stands for North and 0 to -90 stands for South.
Expand All @@ -207,7 +207,7 @@ For json:
{
"datapoints":[
{
"dataChnId":"dataChanId",
"dataChnId":"dataChnId",
"values":{
"value":"{0 or 1}"
}
Expand All @@ -221,7 +221,7 @@ For json:
For csv:

```
dataChannelId,timestamp,{0 ot 1}
dataChnId,timestamp,{0 ot 1}
```
0 stands for Low, and 1 stands for High.

Expand All @@ -232,7 +232,7 @@ For json:
{
"datapoints":[
{
"dataChnId":"dataChanId",
"dataChnId":"dataChnId",
"values":{
"value":"{string value}",
"period":"{period value}"
Expand All @@ -248,7 +248,7 @@ The range of Period and Value is from 0 to 1000.
For csv:

```
dataChannelId,timestamp,{Value},{Period}
dataChnId,timestamp,{Value},{Period}
```

## Analog
Expand All @@ -258,7 +258,7 @@ For json:
{
"datapoints":[
{
"dataChnId":"dataChanId",
"dataChnId":"dataChnId",
"values":{
"value":"{Integer value}"
}
Expand All @@ -271,7 +271,7 @@ For json:
For csv:

```
dataChannelId,timestamp,{Integer value}
dataChnId,timestamp,{Integer value}
```
The range of Integer value is defined by users.

Expand All @@ -282,7 +282,7 @@ For json:
{
"datapoints":[
{
"dataChnId":"dataChanId",
"dataChnId":"dataChnId",
"values":{
"value":"{up/down/right/left/A/B value| press(1) or release(0)}"
}
Expand All @@ -295,7 +295,7 @@ For json:
For csv:

```
dataChannelId,timestamp,{up/down/right/left/A/B value| press(1) or release(0)}
dataChnId,timestamp,{up/down/right/left/A/B value| press(1) or release(0)}
```

User can decide to only have the up/down/right/left value only or to have the A/B value together at the same time.
Expand All @@ -315,3 +315,32 @@ You can use pre-defined hotkeys on keyboard to control this data channel:
`Key A = ,`

`Key B = .`

## Image

For json:

```
{
"datapoints":[
{
"dataChnId":"dataChnId",
"values":{
"value":"{image file base64 encoding string value}"
}
}
]
}
```


For csv:

```
dataChnId,timestamp,{image file base64 encoding string value}
```

To upload an image to the image display data channel, you have to convert the image file to base64 encoding. Upload the base 64 encoding string to the data channel, then the image will saved and shown.

Please be noted that the image data channel supports uploading files in JPG, JPEG, and PNG formats. However, after uploaded to MCS, all types of files will be saved in .PNG format.
25 changes: 15 additions & 10 deletions content/zh-CN/api_references/command_server_format.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Heartbeat 格式:
### 开关

```
deviceId,deviceKey,timestamp,dataChannelId,{0 or 1}
deviceId,deviceKey,timestamp,dataChnId,{0 or 1}
```
0 代表关,1 代表开。
Expand All @@ -63,33 +63,33 @@ switch01,, 1

### 分类
```
deviceId,deviceKey,timestamp,dataChannelId,{Key Value}
deviceId,deviceKey,timestamp,dataChnId,{Key Value}
```

### 整数
```
deviceId,deviceKey,timestamp,dataChannelId,{Integer}
deviceId,deviceKey,timestamp,dataChnId,{Integer}
```

### 浮点数
```
deviceId,deviceKey,timestamp,dataChannelId,{Float}
deviceId,deviceKey,timestamp,dataChnId,{Float}
```

### 十六进位数
```
deviceId,deviceKey,timestamp,dataChannelId,{Hex value}
deviceId,deviceKey,timestamp,dataChnId,{Hex value}
```
十六进位数的值为 A-F 以及 0-9。

### 字串
```
deviceId,deviceKey,timestamp,dataChannelId,{string}
deviceId,deviceKey,timestamp,dataChnId,{string}
```

### GPS
```
deviceId,deviceKey,timestamp,dataChannelId,{latitude},{longitude},{altitude}
deviceId,deviceKey,timestamp,dataChnId,{latitude},{longitude},{altitude}
```

纬度范围从 -90 至 90。 0 至 90 代表北纬,0 至 -90 代表南纬。
Expand All @@ -100,13 +100,13 @@ deviceId,deviceKey,timestamp,dataChannelId,{latitude},{longitude},{altitude}

### GPIO
```
deviceId,deviceKey,timestamp,dataChannelId,{0 ot 1}
deviceId,deviceKey,timestamp,dataChnId,{0 ot 1}
```
0 代表低,1 代表高。

### PWM
```
deviceId,deviceKey,timestamp,dataChannelId,{value},{period}
deviceId,deviceKey,timestamp,dataChnId,{value},{period}
```

Expand All @@ -118,5 +118,10 @@ deviceId,deviceKey,timestamp,dataChannelId,{value}

### 游戏控制器
```
deviceId,deviceKey,timestamp,dataChannelId,{up/down/right/left/A/B value| press(1) or release(0)}
deviceId,deviceKey,timestamp,dataChnId,{up/down/right/left/A/B value| press(1) or release(0)}
```

### 图片
```
deviceId,deviceKey,timestamp,dataChnId,{image file base64 encoding string value}
```
Loading

0 comments on commit d5789af

Please sign in to comment.