hybridgroup/gobot — pull request #88 by tangsoft (2014-08-05 15:38:32+00:00)
Title: pass argument DeviceID to func craftPacket to identify virtual device

To have "DeviceID(did)" as a var passed to func craftPacket other than as a fixed value, to identify which virtual device the packet is intended for. Since the Sphero has several virtual devices.
And change the all related API func as well.

-func (s *SpheroDriver) craftPacket(body []uint8, cid byte) *packet {
+func (s *SpheroDriver) craftPacket(body []uint8, did byte, cid byte) *packet {
packet := new(packet)
packet.body = body
dlen := len(packet.body) + 1
-	packet.header = []uint8{0xFF, 0xFF, 0x02, cid, s.seq, uint8(dlen)}
+	packet.header = []uint8{0xFF, 0xFF, did, cid, s.seq, uint8(dlen)}
packet.checksum = s.calculateChecksum(packet)
return packet
}