Skip to content

Commit 3bef9e4

Browse files
author
Roberto Sora
authored
Merge pull request #458 from arduino/devel
Port devel branch on master branch
2 parents 83043b2 + 79c5559 commit 3bef9e4

14 files changed

+78
-77
lines changed

README.md

+26-23
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1+
[![License: GPL v2](https://img.shields.io/badge/License-GPL%20v2-blue.svg)](https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html)
12

23
arduino-create-agent
34
====================
45

6+
57
## GOA 2 refactoring
68
The agent is currently transitioning to the v2 of the GOA framework for API management, please refer to the following
79
[documentation](https://github.com/goadesign/goa/tree/v2) in order to install tools and libraries
@@ -16,18 +18,18 @@ goa gen github.com/arduino/arduino-create-agent/design
1618
Get the latest version of the Agent for all supported platforms:
1719

1820
### Windows
19-
* [Windows with Edge](http://downloads.arduino.cc/CreateBridgeStable/ArduinoCreateAgent-1.1-windows-installer-edge.exe)
20-
* [Windows with Chrome](http://downloads.arduino.cc/CreateBridgeStable/ArduinoCreateAgent-1.1-windows-installer-chrome.exe)
21-
* [Windows with Firefox](http://downloads.arduino.cc/CreateBridgeStable/ArduinoCreateAgent-1.1-windows-installer-firefox.exe)
21+
* [Windows with Edge](https://downloads.arduino.cc/CreateBridgeStable/ArduinoCreateAgent-1.1-windows-installer-edge.exe)
22+
* [Windows with Chrome](https://downloads.arduino.cc/CreateBridgeStable/ArduinoCreateAgent-1.1-windows-installer-chrome.exe)
23+
* [Windows with Firefox](https://downloads.arduino.cc/CreateBridgeStable/ArduinoCreateAgent-1.1-windows-installer-firefox.exe)
2224

2325
### MacOSX
24-
* [MacOSX with Safari](http://downloads.arduino.cc/CreateBridgeStable/ArduinoCreateAgent-1.1-osx-installer-safari.dmg)
25-
* [MacOSX with Chrome](http://downloads.arduino.cc/CreateBridgeStable/ArduinoCreateAgent-1.1-osx-installer-chrome.dmg)
26-
* [MacOSX with Firefox](http://downloads.arduino.cc/CreateBridgeStable/ArduinoCreateAgent-1.1-osx-installer-firefox.dmg)
26+
* [MacOSX with Safari](https://downloads.arduino.cc/CreateBridgeStable/ArduinoCreateAgent-1.1-osx-installer-safari.dmg)
27+
* [MacOSX with Chrome](https://downloads.arduino.cc/CreateBridgeStable/ArduinoCreateAgent-1.1-osx-installer-chrome.dmg)
28+
* [MacOSX with Firefox](https://downloads.arduino.cc/CreateBridgeStable/ArduinoCreateAgent-1.1-osx-installer-firefox.dmg)
2729

2830
### Linux
29-
* [Linux x64 with Chrome](http://downloads.arduino.cc/CreateBridgeStable/ArduinoCreateAgent-1.1-linux-x64-installer-chrome.tar.gz)
30-
* [Linux x64 with Firefox](http://downloads.arduino.cc/CreateBridgeStable/ArduinoCreateAgent-1.1-linux-x64-installer-firefox.tar.gz)
31+
* [Linux x64 with Chrome](https://downloads.arduino.cc/CreateBridgeStable/ArduinoCreateAgent-1.1-linux-x64-installer-chrome.tar.gz)
32+
* [Linux x64 with Firefox](https://downloads.arduino.cc/CreateBridgeStable/ArduinoCreateAgent-1.1-linux-x64-installer-firefox.tar.gz)
3133

3234
arduino-create-agent is a fork of @[johnlauer](https://github.com/johnlauer)'s [serial-port-json-server](https://github.com/johnlauer/serial-port-json-server) (which we really want to thank for his kindness and great work)
3335

@@ -146,18 +148,18 @@ or in the location selected during the installation
146148
Please use the current latest version:
147149
148150
### Windows
149-
* [Windows with Edge dev](http://downloads.arduino.cc/CreateBridge/staging/ArduinoCreateAgent-1.0-windows-installer-edge.exe)
150-
* [Windows with Chrome dev](http://downloads.arduino.cc/CreateBridge/staging/ArduinoCreateAgent-1.0-windows-installer.exe)
151-
* [Windows with Firefox dev](http://downloads.arduino.cc/CreateBridge/staging/ArduinoCreateAgent-1.0-windows-installer-firefox.exe)
151+
* [Windows with Edge dev](https://downloads.arduino.cc/CreateBridge/staging/ArduinoCreateAgent-1.0-windows-installer-edge.exe)
152+
* [Windows with Chrome dev](https://downloads.arduino.cc/CreateBridge/staging/ArduinoCreateAgent-1.0-windows-installer.exe)
153+
* [Windows with Firefox dev](https://downloads.arduino.cc/CreateBridge/staging/ArduinoCreateAgent-1.0-windows-installer-firefox.exe)
152154
153155
### MacOSX
154-
* [MacOSX with Safari dev](http://downloads.arduino.cc/CreateBridge/staging/ArduinoCreateAgent-1.0-osx-installer-safari.dmg)
155-
* [MacOSX with Chrome dev](http://downloads.arduino.cc/CreateBridge/staging/ArduinoCreateAgent-1.0-osx-installer-chrome.dmg)
156-
* [MacOSX with Firefox dev](http://downloads.arduino.cc/CreateBridge/staging/ArduinoCreateAgent-1.0-osx-installer-firefox.dmg)
156+
* [MacOSX with Safari dev](https://downloads.arduino.cc/CreateBridge/staging/ArduinoCreateAgent-1.0-osx-installer-safari.dmg)
157+
* [MacOSX with Chrome dev](https://downloads.arduino.cc/CreateBridge/staging/ArduinoCreateAgent-1.0-osx-installer-chrome.dmg)
158+
* [MacOSX with Firefox dev](https://downloads.arduino.cc/CreateBridge/staging/ArduinoCreateAgent-1.0-osx-installer-firefox.dmg)
157159
158160
### Linux
159-
* [Linux x64 with Chrome dev](http://downloads.arduino.cc/CreateBridge/staging/ArduinoCreateAgent-1.0-linux-x64-installer-chrome.run)
160-
* [Linux x64 with Firefox dev](http://downloads.arduino.cc/CreateBridge/staging/ArduinoCreateAgent-1.0-linux-x64-installer-firefox.run)
161+
* [Linux x64 with Chrome dev](https://downloads.arduino.cc/CreateBridge/staging/ArduinoCreateAgent-1.0-linux-x64-installer-chrome.run)
162+
* [Linux x64 with Firefox dev](https://downloads.arduino.cc/CreateBridge/staging/ArduinoCreateAgent-1.0-linux-x64-installer-firefox.run)
161163
162164
163165
## How to use it
@@ -242,7 +244,7 @@ You will receive an object of all the boards connected with USB or over the netw
242244
}
243245
```
244246

245-
## Open/Close ports
247+
### Open/Close ports
246248

247249
To read input from a board connected to USB you must first open the port with the command
248250

@@ -350,7 +352,7 @@ The payload is a json object that looks like this:
350352
{
351353
"board":"arduino:avr:leonardo",
352354
"port":"/dev/ttyACM1",
353-
"commandline":"\"{runtime.tools.avrdude.path}/bin/avrdude\" \"-C{runtime.tools.avrdude.path}/etc/avrdude.conf\" {upload.verbose} -patmega32u4 -cavr109 -P{serial.port} -b57600 -D \"-Uflash:w:{build.path}/{build.project_name}.hex:i\"",
355+
"commandline":"\"{runtime.tools.avrdude.path}/bin/avrdude\" \"-C{runtime.tools.avrdude.path}/etc/avrdude.conf\" -v -patmega32u4 -cavr109 -P{serial.port} -b57600 -D \"-Uflash:w:{build.path}/{build.project_name}.hex:i\"",
354356
"signature":"97db97ced2c",
355357
"hex":"OjEwMDAwMDAwMEM5NEU1MDAwQzk0MEQwMTBDOTQwRDAxMEM5NDBEMDE2MQ0KOjEwMDAxMDAwMEM5NDBEMDEwQzk0M",
356358
"filename":"Blink.ino.hex",
@@ -365,16 +367,13 @@ The payload is a json object that looks like this:
365367
"wait_for_upload_port":true,
366368
"use_1200bps_touch":true,
367369
"network":false,
368-
"params_verbose":"-v",
369-
"params_quiet":"-q -q",
370-
"verbose":true
371370
}
372371
}
373372
```
374373

375374
- commandline is the command to execute to perform the upload. This is, for example, avrdude on a Leonardo.
376375

377-
- hex contains the sketch hex encoded in base64
376+
- hex contains the sketch binary encoded in base64 (could decode in Intel hex or raw binary)
378377

379378
- signature is the signature of the commandline signed with the private key that matches the public key contained in the config.ini of the arduino-create-agent
380379

@@ -386,6 +385,10 @@ The results of the upload will be delivered via websocket with messages that loo
386385
{"Flash":"Ok","ProgrammerStatus":"Done"}
387386
```
388387

388+
### Javacript client library
389+
390+
You can install the [arduino-create-agent-js-client](https://github.com/arduino/arduino-create-agent-js-client) in your client application
391+
389392
---
390393

391394
## Development
@@ -469,4 +472,4 @@ By making a contribution to this project, I certify that:
469472

470473
## Creating a release
471474
Just create a new release on GitHub, and our drone server will build and upload
472-
the compiled binaries for every architecture in a zip file in the release itself.
475+
the compiled binaries for every architecture in a zip file in the release itself.

config.ini

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ hostname = unknown-hostname # Override the hostname we get from the OS
33
regex = usb|acm|com # Regular expression to filter serial port list
44
v = true # show debug logging
55
appName = CreateBridge
6-
updateUrl = http://downloads.arduino.cc/
6+
updateUrl = https://downloads.arduino.cc/
77
origins = http://local.arduino.cc:8000
88
#httpProxy = http://your.proxy:port # Proxy server for HTTP requests

conn.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ type Upload struct {
7070
ExtraFiles []AdditionalFile `json:"extrafiles"`
7171
}
7272

73-
var uploadStatusStr string = "ProgrammerStatus"
73+
var uploadStatusStr = "ProgrammerStatus"
7474

7575
func uploadHandler(c *gin.Context) {
7676

@@ -156,7 +156,7 @@ func uploadHandler(c *gin.Context) {
156156
return
157157
}
158158

159-
l := PLogger{Verbose: data.Extra.Verbose}
159+
l := PLogger{Verbose: true}
160160

161161
// Upload
162162
if data.Extra.Network {
@@ -183,7 +183,7 @@ type PLogger struct {
183183
Verbose bool
184184
}
185185

186-
// Debug only sends messages if verbose is true
186+
// Debug only sends messages if verbose is true (always true for now)
187187
func (l PLogger) Debug(args ...interface{}) {
188188
if l.Verbose {
189189
l.Info(args...)

design/pkgs.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ var IndexPayload = Type("arduino.index", func() {
8484
TypeName("IndexPayload")
8585

8686
Attribute("url", String, "The url of the index file", func() {
87-
Example("http://downloads.arduino.cc/packages/package_index.json")
87+
Example("https://downloads.arduino.cc/packages/package_index.json")
8888
})
8989
Required("url")
9090
})

docs/tools.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Usage: You have to instantiate the struct by passing it the required parameters:
2727

2828
_tools := tools.Tools{
2929
Directory: "/home/user/.arduino-create",
30-
IndexURL: "http://downloads.arduino.cc/packages/package_index.json"
30+
IndexURL: "https://downloads.arduino.cc/packages/package_index.json"
3131
Logger: log.Logger
3232
}
3333

main.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ func loop() {
253253

254254
extraOrigins := []string{
255255
"https://create.arduino.cc",
256-
"http://create.arduino.cc", "https://create-dev.arduino.cc", "http://create-dev.arduino.cc", "https://create-intel.arduino.cc", "http://create-intel.arduino.cc",
256+
"https://create-dev.arduino.cc", "https://create-intel.arduino.cc",
257257
}
258258

259259
for i := 8990; i < 9001; i++ {
@@ -357,9 +357,8 @@ const homeTemplateHtml = `<!DOCTYPE html>
357357
if (messages.length > 2000) {
358358
messages.shift();
359359
}
360-
var doScroll = log.scrollTop == log.scrollHeight - log.clientHeight;
361360
log.innerHTML = messages.join('<br>');
362-
if (autoscroll.checked && doScroll) {
361+
if (autoscroll.checked) {
363362
log.scrollTop = log.scrollHeight - log.clientHeight;
364363
}
365364
}
@@ -429,6 +428,7 @@ body {
429428
}
430429
431430
.buttons {
431+
align-items: center;
432432
display: flex;
433433
padding: 0 .5em;
434434
margin: 0;

tools/download_test.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,12 @@ func Test_findBaseDir(t *testing.T) {
4040

4141
func TestTools_DownloadAndUnpackBehaviour(t *testing.T) {
4242
urls := []string{
43-
"http://downloads.arduino.cc/tools/avrdude-6.3.0-arduino14-armhf-pc-linux-gnu.tar.bz2",
44-
"http://downloads.arduino.cc/tools/avrdude-6.3.0-arduino14-aarch64-pc-linux-gnu.tar.bz2",
45-
"http://downloads.arduino.cc/tools/avrdude-6.3.0-arduino14-i386-apple-darwin11.tar.bz2",
46-
"http://downloads.arduino.cc/tools/avrdude-6.3.0-arduino14-x86_64-pc-linux-gnu.tar.bz2",
47-
"http://downloads.arduino.cc/tools/avrdude-6.3.0-arduino14-i686-pc-linux-gnu.tar.bz2",
48-
"http://downloads.arduino.cc/tools/avrdude-6.3.0-arduino14-i686-w64-mingw32.zip",
43+
"https://downloads.arduino.cc/tools/avrdude-6.3.0-arduino14-armhf-pc-linux-gnu.tar.bz2",
44+
"https://downloads.arduino.cc/tools/avrdude-6.3.0-arduino14-aarch64-pc-linux-gnu.tar.bz2",
45+
"https://downloads.arduino.cc/tools/avrdude-6.3.0-arduino14-i386-apple-darwin11.tar.bz2",
46+
"https://downloads.arduino.cc/tools/avrdude-6.3.0-arduino14-x86_64-pc-linux-gnu.tar.bz2",
47+
"https://downloads.arduino.cc/tools/avrdude-6.3.0-arduino14-i686-pc-linux-gnu.tar.bz2",
48+
"https://downloads.arduino.cc/tools/avrdude-6.3.0-arduino14-i686-w64-mingw32.zip",
4949
}
5050
expectedDirList := []string{"bin", "etc"}
5151

tools/tools.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import (
2626
// You have to instantiate the struct by passing it the required parameters:
2727
// _tools := tools.Tools{
2828
// Directory: "/home/user/.arduino-create",
29-
// IndexURL: "http://downloads.arduino.cc/packages/package_index.json"
29+
// IndexURL: "https://downloads.arduino.cc/packages/package_index.json"
3030
// Logger: log.Logger
3131
// }
3232
type Tools struct {

trayicon.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ func setupSysTrayReal() {
166166
go func() {
167167
for {
168168
<-mUrl.ClickedCh
169-
open.Start("http://create.arduino.cc")
169+
open.Start("https://create.arduino.cc")
170170
}
171171
}()
172172
}

upload/README.md

-3
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,6 @@ type Extra struct {
113113
WaitForUploadPort bool `json:"wait_for_upload_port"`
114114
Network bool `json:"network"`
115115
Auth Auth `json:"auth"`
116-
Verbose bool `json:"verbose"`
117-
ParamsVerbose string `json:"params_verbose"`
118-
ParamsQuiet string `json:"params_quiet"`
119116
}
120117
```
121118
Extra contains some options used during the upload

upload/doc.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
// commandline = upload.Resolve("/dev/ttyACM0", "arduino:avr:leonardo", "./sketch.hex", commandline, upload.Extra{}, t)
3232
// ```
3333
//
34-
// t must implement the locater interface (the Tools package does!)
34+
// 't' must implement the locater interface (the Tools package does!)
3535
//
3636
// **Logging**
3737
// If you're interested in the output of the commands, you can implement the logger interface. Here's an example:

upload/upload.go

+5-14
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,11 @@ type Auth struct {
3939

4040
// Extra contains some options used during the upload
4141
type Extra struct {
42-
Use1200bpsTouch bool `json:"use_1200bps_touch"`
43-
WaitForUploadPort bool `json:"wait_for_upload_port"`
44-
Network bool `json:"network"`
45-
Auth Auth `json:"auth"`
46-
Verbose bool `json:"verbose"`
47-
ParamsVerbose string `json:"params_verbose"`
48-
ParamsQuiet string `json:"params_quiet"`
49-
SSH bool `json:"ssh,omitempty"`
42+
Use1200bpsTouch bool `json:"use_1200bps_touch"`
43+
WaitForUploadPort bool `json:"wait_for_upload_port"`
44+
Network bool `json:"network"`
45+
Auth Auth `json:"auth"`
46+
SSH bool `json:"ssh,omitempty"`
5047
}
5148

5249
// PartiallyResolve replaces some symbols in the commandline with the appropriate values
@@ -57,12 +54,6 @@ func PartiallyResolve(board, file, platformPath, commandline string, extra Extra
5754
commandline = strings.Replace(commandline, "{network.password}", extra.Auth.Password, -1)
5855
commandline = strings.Replace(commandline, "{runtime.platform.path}", filepath.ToSlash(platformPath), -1)
5956

60-
if extra.Verbose == true {
61-
commandline = strings.Replace(commandline, "{upload.verbose}", extra.ParamsVerbose, -1)
62-
} else {
63-
commandline = strings.Replace(commandline, "{upload.verbose}", extra.ParamsQuiet, -1)
64-
}
65-
6657
// search for runtime variables and replace with values from Locater
6758
var runtimeRe = regexp.MustCompile("\\{(.*?)\\}")
6859
runtimeVars := runtimeRe.FindAllString(commandline, -1)

upload/upload_test.go

+25-15
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,23 @@ var TestNetworkData = []struct {
4545
Name string
4646
Port string
4747
Board string
48-
File string
48+
Files []string
4949
Commandline string
50-
Auth upload.Auth
50+
Extra upload.Extra
5151
}{
5252
{
53-
"yun", "", "", "",
54-
``, upload.Auth{}},
53+
"yun",
54+
"",
55+
"",
56+
[]string{"filename"},
57+
"",
58+
upload.Extra{
59+
Use1200bpsTouch: true,
60+
WaitForUploadPort: true,
61+
Network: true,
62+
Auth: upload.Auth{},
63+
},
64+
},
5565
}
5666

5767
func TestNetwork(t *testing.T) {
@@ -62,27 +72,27 @@ func TestNetwork(t *testing.T) {
6272

6373
for _, test := range TestNetworkData {
6474
commandline := strings.Replace(test.Commandline, "$HOME", home, -1)
65-
err := upload.Network(test.Port, test.Board, test.File, commandline, test.Auth, logger)
75+
err := upload.Network(test.Port, test.Board, test.Files, commandline, test.Extra.Auth, logger, test.Extra.SSH)
6676
log.Println(err)
6777
}
6878
}
6979

7080
var TestResolveData = []struct {
71-
Port string
72-
Board string
73-
File string
74-
Commandline string
75-
Extra upload.Extra
76-
Result string
81+
Board string
82+
File string
83+
PlatformPath string
84+
Commandline string
85+
Extra upload.Extra
86+
Result string
7787
}{
78-
{"/dev/ttyACM0", "arduino:avr:leonardo", "./upload_test.hex",
79-
`"{runtime.tools.avrdude.path}/bin/avrdude" "-C{runtime.tools.avrdude.path}/etc/avrdude.conf" {upload.verbose} {upload.verify} -patmega32u4 -cavr109 -P{serial.port} -b57600 -D "-Uflash:w:{build.path}/{build.project_name}.hex:i"`, upload.Extra{Use1200bpsTouch: true, WaitForUploadPort: true},
80-
`"$loc$loc{runtime.tools.avrdude.path}/bin/avrdude" "-C{runtime.tools.avrdude.path}/etc/avrdude.conf" $loc{upload.verify} -patmega32u4 -cavr109 -P/dev/ttyACM0 -b57600 -D "-Uflash:w:./upload_test.hex:i"`},
88+
{"arduino:avr:leonardo", "./upload_test.hex", "",
89+
`"{runtime.tools.avrdude.path}/bin/avrdude" "-C{runtime.tools.avrdude.path}/etc/avrdude.conf" -v {upload.verify} -patmega32u4 -cavr109 -P/dev/ttyACM0 -b57600 -D "-Uflash:w:{build.path}/{build.project_name}.hex:i"`, upload.Extra{Use1200bpsTouch: true, WaitForUploadPort: true},
90+
`"$loc$loc{runtime.tools.avrdude.path}/bin/avrdude" "-C{runtime.tools.avrdude.path}/etc/avrdude.conf" -v $loc{upload.verify} -patmega32u4 -cavr109 -P/dev/ttyACM0 -b57600 -D "-Uflash:w:./upload_test.hex:i"`},
8191
}
8292

8393
func TestResolve(t *testing.T) {
8494
for _, test := range TestResolveData {
85-
result, _ := upload.Resolve(test.Port, test.Board, test.File, test.Commandline, test.Extra, mockTools{})
95+
result, _ := upload.PartiallyResolve(test.Board, test.File, test.PlatformPath, test.Commandline, test.Extra, mockTools{})
8696
if result != test.Result {
8797
t.Error("expected " + test.Result + ", got " + result)
8898
continue

v2/pkgs/tools_test.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -144,10 +144,10 @@ func strpoint(s string) *string {
144144

145145
func url() string {
146146
urls := map[string]string{
147-
"linuxamd64": "http://downloads.arduino.cc/tools/avrdude-6.0.1-arduino2-x86_64-pc-linux-gnu.tar.bz2",
148-
"linux386": "http://downloads.arduino.cc/tools/avrdude-6.0.1-arduino2-i686-pc-linux-gnu.tar.bz2",
149-
"darwinamd64": "http://downloads.arduino.cc/tools/avrdude-6.0.1-arduino2-i386-apple-darwin11.tar.bz2",
150-
"windows386": "http://downloads.arduino.cc/tools/avrdude-6.0.1-arduino2-i686-mingw32.zip",
147+
"linuxamd64": "https://downloads.arduino.cc/tools/avrdude-6.0.1-arduino2-x86_64-pc-linux-gnu.tar.bz2",
148+
"linux386": "https://downloads.arduino.cc/tools/avrdude-6.0.1-arduino2-i686-pc-linux-gnu.tar.bz2",
149+
"darwinamd64": "https://downloads.arduino.cc/tools/avrdude-6.0.1-arduino2-i386-apple-darwin11.tar.bz2",
150+
"windows386": "https://downloads.arduino.cc/tools/avrdude-6.0.1-arduino2-i686-mingw32.zip",
151151
}
152152

153153
return urls[runtime.GOOS+runtime.GOARCH]

0 commit comments

Comments
 (0)