forked from Elara6331/itd
Generalize socket cancellation and update API accordingly
This commit is contained in:
+13
-2
@@ -31,7 +31,18 @@ func (c *Client) FirmwareUpgrade(upgType UpgradeType, files ...string) (<-chan D
|
||||
return nil, err
|
||||
}
|
||||
|
||||
c.dfuProgressCh = make(chan DFUProgress, 5)
|
||||
c.dfuProgressCh = make(chan types.Response, 5)
|
||||
|
||||
return c.dfuProgressCh, nil
|
||||
out := make(chan DFUProgress, 5)
|
||||
go func() {
|
||||
for res := range c.dfuProgressCh {
|
||||
progress, err := decodeDFUProgress(res.Value)
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
out <- progress
|
||||
}
|
||||
}()
|
||||
|
||||
return out, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user