-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
registry server intial implementation.
- Loading branch information
Showing
5 changed files
with
256 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package rpcs | ||
|
||
// device register args | ||
type DeviceRegisterArgs struct { | ||
ProductKey string | ||
DeviceCode string | ||
DeviceVersion string | ||
} | ||
|
||
// device update args | ||
type DeviceUpdateArgs struct { | ||
DeviceIdentifier string | ||
DeviceName string | ||
DeviceDescription string | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package main | ||
|
||
import ( | ||
"strconv" | ||
) | ||
|
||
func genDeviceIdentifier(vendor int32, product int32, device string) string { | ||
return strconv.FormatInt(int64(vendor), 16) + "-" + strconv.FormatInt(int64(product), 16) + "-" + device | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package main | ||
|
||
import ( | ||
"testing" | ||
) | ||
|
||
func TestGenDeviceIdentifier(t *testing.T) { | ||
vendorid, productid, devicecode := int32(100), int32(100), "ffaf4fffeeaa" | ||
identifier := genDeviceIdentifier(vendorid, productid, devicecode) | ||
if identifier != "64-64-ffaf4fffeeaa" { | ||
t.Errorf("gen identifier error, need %s, got %s ", "64-64-ffaf4fffeeaa", identifier) | ||
} | ||
} |