From cd21a165bb88ae0330639e087ec71c7783cd3d5b Mon Sep 17 00:00:00 2001 From: mame82 Date: Fri, 29 Jun 2018 00:46:09 +0000 Subject: [PATCH] MILESTONE: Added file upload and foreground (blocking) HIDScripts to CLI client, server and gRPC proto. ToDo: HIDScript background jobs --- cli_client/cmd_hid.go | 224 +++++++ cli_client/rpc_client.go | 128 +++- common/filesys.go | 23 + proto/gopherjs/grpc.pb.gopherjs.go | 921 +++++++++++++++++++++++++++++ proto/grpc.pb.go | 769 +++++++++++++++++++++--- proto/grpc.proto | 66 +++ service/rpc_server.go | 88 +++ 7 files changed, 2119 insertions(+), 100 deletions(-) create mode 100644 cli_client/cmd_hid.go create mode 100644 common/filesys.go diff --git a/cli_client/cmd_hid.go b/cli_client/cmd_hid.go new file mode 100644 index 0000000..7d1eb60 --- /dev/null +++ b/cli_client/cmd_hid.go @@ -0,0 +1,224 @@ +package cli_client + +import ( + "github.com/spf13/cobra" + "fmt" + "strings" + "io" + "bufio" + "os" + "errors" + "log" +) + +var ( + tmpHidCommands = "" + tmpRunFromServerPath = "" + tmpHidTimeout = -1 // values < 0 = endless +) + +var hidCmd = &cobra.Command{ + Use: "HID", + Short: "Use keyboard or mouse functionality", +} + +var hidRunCmd = &cobra.Command{ + Use: "run", + Short: "Run a HID Script", + Long:"Run script provided from standard input, commandline parameter or by path to script file on P4wnP1", + Run: cobraHidRun, +} + +var hidJobCmd = &cobra.Command{ + Use: "job", + Short: "Run a HID Script as background job", + Long:"Run a background script provided from standard input, commandline parameter or by path to script file on P4wnP1", + Run: cobraHidJob, +} + +// Decision on how to run scripts (terms "local"/"remote" from perspective of gRPC server): +// +// 1) `P4wnP1_cli HID run` (no host flag, no additional args) +// Assume that the CLI runs on the same host as the server, read script from STDIN as no parameter is provided +// --> The script has to be run as remote script (content has to be transferred from CLI to gRPC server) +// after reading till EOF. Abort on timeout. +// +// 2) `P4wnP1_cli HID run --host "some hostname"` (host flag, no additional args) +// Assume that the CLI runs on a host different from the gRPC server, read script from STDIN as no parameter is provided +// --> The script has to be run as remote script (content has to be transferred from CLI to gRPC server) +// after reading till EOF. Abort on timeout. +// +// 3) `P4wnP1_cli HID run -c "Some HID script commands"` +// --> Same as 1) but content is read from `-c` instead of STDIN +// +// 4) `P4wnP1_cli HID run --host "some hostname" -c "Some HID script commands"` +// --> Same as 2) but content is read from `-c` instead of STDIN +// +// 5) `P4wnP1_cli HID run /some/path/to/file` +// Assume that the CLI runs on the same host as the server, assume that the given path refers to a file hosted on the +// gRPC server +// --> The script has to be run as local script (content is searched on P4wnP1 device by given path) +// +// 6) `P4wnP1_cli HID run --host "some hostname" -r /some/path/to/file` +// Assume that the CLI runs on a host different from the gRPC server and the given path points to a script on the host +// which runs the gRPC server (indicated by `-r`). +// --> The script has to be run as local script (content is searched on P4wnP1 device by given path) +// +// 7) `P4wnP1_cli HID run --host "some hostname" /some/path/to/file` (no host flag, no additional args) +// Assume that the CLI runs on a host different from the gRPC server and the given path points to a script on the host +// which runs the CLI client. +// --> The script has to be run as remote script (content has to be transferred from CLI to gRPC server) +// after reading it from the file. +// +// --> if flag `-c` is enabled, all following args are interpreted as script content +// --> if flag `-c` isn't set and args are present, the first arg is assumed to represent a filepath +// --> if flag `-c` isn't set and no additional args are provided, it is assumed that the script content has to be read +// from STDIN +// +// --> the two cases, which don't require a script content transfer from gRPC client to server: +// a) `-c` isn't set && --host == localhost && path is given as arg (example 5) +// b) `-c` isn't set && path is given with parameter `-r` (example 6) +// +// The logic above applies to both, running scripts synchronous with `run` or asynchronous with `job` + + +func parseHIDRunScripCmd(cmd *cobra.Command, args []string) (serverScriptPath string, err error) { + /* + readFromStdin := false + localFile := false //if true readFilePath refers to a file on the host of the rpcClient, else to a file on the rpcServer + readFilePath := "" + scriptContent :="" + */ + + var srcReader io.Reader + transferNeeded := false + + + cFlagSet := cmd.Flags().ShorthandLookup("c").Changed + rFlagSet := cmd.Flags().ShorthandLookup("r").Changed + + switch { + case !rFlagSet && !cFlagSet: + // if `-c` and `-r` aren't set and no additional args are provided, we have to read from STDIN + if len(args) == 0 { + //We have to read from STDIN + srcReader = bufio.NewReader(os.Stdin) + transferNeeded = true + } else { + // we assume the arg is a filePath + if strings.ToLower(StrRemoteHost) != "localhost" { + // file not hosted on RPC server, needs to be transferred + transferNeeded=true + f,err := os.OpenFile(args[0], os.O_RDONLY, os.ModePerm) + if err != nil { return "",err } + defer f.Close() + srcReader = bufio.NewReader(f) + } else { + // assume RPC client is run from same host as RPC server and the script path refers to a local file + transferNeeded = false + serverScriptPath = args[0] + } + } + case rFlagSet: + // the flag represents a script path on the RPC server, no matter where the RPC client is running, so we assume the script is already there + transferNeeded = false + serverScriptPath = tmpRunFromServerPath + case cFlagSet: + // script content is provided by parameter and needs to be transferred + transferNeeded = true + srcReader = strings.NewReader(tmpHidCommands) + case cFlagSet && rFlagSet: + return "",errors.New("Couldn't use '-c' and '-r' at the same time") + default: + return "",errors.New("Invalid flag/parameter combination") + } + + /* + if readFromStdin { + buf := make([]byte,1024) + reader := bufio.NewReader(os.Stdin) + for { + n,rErr := reader.Read(buf) + if rErr != nil { + if rErr == io.EOF { break } else { return rErr } + } + chunk := buf[:n] + scriptContent += string(chunk) + fmt.Printf("Read %d bytes: %+q\n", n, string(chunk)) + } + } + + + fmt.Printf("readFromStdIn: %v path: %v content: %v\n", readFromStdin, readFilePath, scriptContent) + */ + + if transferNeeded { + // create random remote file + serverScriptPath, err = ClientCreateTempFile(StrRemoteHost,StrRemotePort,"","HIDscript") + if err != nil { + return "",err + } else { + fmt.Printf("TempFile created: %s\n", serverScriptPath) + } + + //transfer from reader to remote file + err = ClientUploadFile(StrRemoteHost, StrRemotePort, srcReader, serverScriptPath, true) + if err != nil { return "",errors.New(fmt.Sprintf("Error transfering HIDScript content to P4wnP1 Server: %v", err))} + } + + + return +} + +func cobraHidRun(cmd *cobra.Command, args []string) { + serverScriptFilePath, err := parseHIDRunScripCmd(cmd,args) + if err != nil { log.Fatal(err)} + + //ToDo: retrieve result and print it + res,err := ClientHIDRunScript(StrRemoteHost, StrRemotePort, serverScriptFilePath) + if err != nil { log.Fatal(err) } + + fmt.Println(res.ResultJson) + return +} + + +func cobraHidJob(cmd *cobra.Command, args []string) { + parseHIDRunScripCmd(cmd,args) + /* + settings, err := createWifiAPSettings(tmpWifiStrChannel, tmpWifiStrReg, tmpWifiSSID, tmpWifiPSK, tmpWifiHideSSID, tmpWifiDisableNexmon, tmpWifiDisabled) + if err != nil { + fmt.Printf("Error: %v\n", err) + + os.Exit(-1) //exit with error + return + } + + + fmt.Printf("Deploying WiFi inteface settings:\n\t%v\n", settings) + + err = ClientDeployWifiSettings(StrRemoteHost, StrRemotePort, settings) + if err != nil { + fmt.Println(status.Convert(err).Message()) + os.Exit(-1) //exit with error + } + +*/ + return +} + + + +func init() { + rootCmd.AddCommand(hidCmd) + hidCmd.AddCommand(hidRunCmd) + hidCmd.AddCommand(hidJobCmd) + + hidRunCmd.Flags().StringVarP(&tmpHidCommands, "commands","c", "", "HIDScript commands to run, given as string") + hidRunCmd.Flags().StringVarP(&tmpRunFromServerPath, "server-path","r", "", "Load HIDScript from given path on P4wnP1 server") + hidRunCmd.Flags().IntVarP(&tmpHidTimeout, "timeout","t", -1, "Abort waiting for HIDScript result after this timeout (seconds)") + + hidJobCmd.Flags().StringVarP(&tmpHidCommands, "commands","c", "", "HIDScript commands to run, given as string") + hidJobCmd.Flags().StringVarP(&tmpRunFromServerPath, "server-path","r", "", "Load HIDScript from given path on P4wnP1 server") + +} diff --git a/cli_client/rpc_client.go b/cli_client/rpc_client.go index d817091..6bef867 100644 --- a/cli_client/rpc_client.go +++ b/cli_client/rpc_client.go @@ -7,8 +7,13 @@ import ( pb "../proto" "time" "golang.org/x/net/context" + "os" + "fmt" + "io" ) + + func ClientConnectServer(rpcHost string, rpcPort string) ( connection *grpc.ClientConn, client pb.P4WNP1Client, @@ -34,6 +39,91 @@ func ClientConnectServer(rpcHost string, rpcPort string) ( return } +func ClientCreateTempDir(host string, port string, dir string, prefix string) (resultPath string, err error) { + return clientCreateTempDirOfFile(host,port,dir,prefix,true) +} + +func ClientCreateTempFile(host string, port string, dir string, prefix string) (resultPath string, err error) { + return clientCreateTempDirOfFile(host,port,dir,prefix,false) +} + +func clientCreateTempDirOfFile(host string, port string, dir string, prefix string, dirOnlyNoFile bool) (resultPath string, err error) { + address := host + ":" + port + connection, err := grpc.Dial(address, grpc.WithInsecure()) + if err != nil {return} + defer connection.Close() + client := pb.NewP4WNP1Client(connection) + resp, err := client.FSCreateTempDirOrFile( + context.Background(), + &pb.TempDirOrFileRequest{ + Prefix: prefix, + Dir: dir, + OnlyFolder: dirOnlyNoFile, + }) + if err != nil {return} + resultPath = resp.ResultPath + return +} + +func ClientUploadFileFromSrcPath(host string, port string, srcPath string, destPath string, forceOverwrite bool) (err error) { + //open local file for reading + flag := os.O_RDONLY + f, err := os.OpenFile(srcPath, flag, os.ModePerm) + if err != nil { return err } + defer f.Close() + + return ClientUploadFile(host,port,f,destPath,forceOverwrite) +} + +func ClientUploadFile(host string, port string, src io.Reader, destPath string, forceOverwrite bool) (err error) { + + // open gRPC Client + address := host + ":" + port + connection, err := grpc.Dial(address, grpc.WithInsecure()) + if err != nil {return} + defer connection.Close() + client := pb.NewP4WNP1Client(connection) + + //try to create remote file + _, err = client.FSWriteFile( + context.Background(), + &pb.WriteFileRequest{ + Path: destPath, + Data: []byte{}, //empty chunk + Append: false, + MustNotExist: !forceOverwrite, + }) + if err != nil {return} + + fmt.Printf("Start appending to %s\n", destPath) + + // start appending chunks read from source file to remote file (Remote file is closed and opened every time, but + // this avoids client to server streaming, which would be hard to implement for gRPC-web + chunksize := 1024 + buf := make([]byte,chunksize) + pos := int64(0) + for { + n,rErr := src.Read(buf) + if rErr != nil { + if rErr == io.EOF { break } else { return rErr } + } + + sendData := buf[:n] + client.FSWriteFile( + context.Background(), + &pb.WriteFileRequest{ + Path: destPath, + Data: sendData, + Append: true, + MustNotExist: false, + }) + + pos += int64(n) + } + + return nil +} + func ClientGetLED(host string, port string) (ls *pb.LEDSettings, err error) { conn, client, ctx, cancel, err := ClientConnectServer(host, port) defer conn.Close() @@ -170,10 +260,38 @@ func ClientDeployWifiSettings(host string, port string, settings *pb.WiFiSetting return err } -/* -func ClientDisconnectServer(cancel context.CancelFunc, connection *grpc.ClientConn) error { +func ClientHIDRunScript(host string, port string, scriptPath string) (scriptRes *pb.HIDScriptResult, err error) { + scriptReq := &pb.HIDScriptRequest{ + ScriptPath: scriptPath, + } + + address := host + ":" + port + connection, err := grpc.Dial(address, grpc.WithInsecure()) + if err != nil { log.Fatalf("Could not connect to P4wnP1 RPC server: %v", err) } defer connection.Close() - defer cancel() - return nil + + rpcClient := pb.NewP4WNP1Client(connection) +// ctx, cancel := context.WithTimeout(context.Background(), time.Second * 30) +// defer cancel() + + scriptRes,err = rpcClient.HIDRunScript(context.Background(), scriptReq) + return } -*/ \ No newline at end of file + +func ClientHIDRunScriptJob(host string, port string, scriptPath string) (sctipJob *pb.HIDScriptJob, err error) { + scriptReq := &pb.HIDScriptRequest{ + ScriptPath: scriptPath, + } + + address := host + ":" + port + connection, err := grpc.Dial(address, grpc.WithInsecure()) + if err != nil { log.Fatalf("Could not connect to P4wnP1 RPC server: %v", err) } + defer connection.Close() + + rpcClient := pb.NewP4WNP1Client(connection) + ctx, cancel := context.WithTimeout(context.Background(), time.Second * 30) + defer cancel() + + sctipJob,err = rpcClient.HIDRunScriptJob(ctx, scriptReq) + return +} \ No newline at end of file diff --git a/common/filesys.go b/common/filesys.go new file mode 100644 index 0000000..7ad617d --- /dev/null +++ b/common/filesys.go @@ -0,0 +1,23 @@ +package common + +import "os" + +func WriteFile(path string, mustNotExist bool, append bool, data []byte) (error) { + flag := os.O_CREATE | os.O_WRONLY + if mustNotExist { flag |= os.O_EXCL } + if append { flag |= os.O_APPEND } + f, err := os.OpenFile(path, flag, os.ModePerm) + f.Stat() + if err != nil { return err } + defer f.Close() + _,err = f.Write(data) + return err +} + +func ReadFile(path string, start int64, chunk []byte) (n int, err error) { + flag := os.O_RDONLY + f, err := os.OpenFile(path, flag, os.ModePerm) + if err != nil { return 0,err } + defer f.Close() + return f.ReadAt(chunk, start) +} diff --git a/proto/gopherjs/grpc.pb.gopherjs.go b/proto/gopherjs/grpc.pb.gopherjs.go index 60eb1f9..e63fcdd 100644 --- a/proto/gopherjs/grpc.pb.gopherjs.go +++ b/proto/gopherjs/grpc.pb.gopherjs.go @@ -8,6 +8,16 @@ grpc.proto It has these top-level messages: + TempDirOrFileRequest + TempDirOrFileResponse + ReadFileRequest + ReadFileResponse + WriteFileRequest + FileInfoRequest + FileInfoResponse + HIDScriptRequest + HIDScriptJob + HIDScriptResult LEDSettings GadgetSettings GadgetSettingsEthernet @@ -100,6 +110,837 @@ func (x WiFiSettings_APAuthMode) String() string { return WiFiSettings_APAuthMode_name[int(x)] } +// File System +type TempDirOrFileRequest struct { + Dir string + Prefix string + OnlyFolder bool +} + +// GetDir gets the Dir of the TempDirOrFileRequest. +func (m *TempDirOrFileRequest) GetDir() (x string) { + if m == nil { + return x + } + return m.Dir +} + +// GetPrefix gets the Prefix of the TempDirOrFileRequest. +func (m *TempDirOrFileRequest) GetPrefix() (x string) { + if m == nil { + return x + } + return m.Prefix +} + +// GetOnlyFolder gets the OnlyFolder of the TempDirOrFileRequest. +func (m *TempDirOrFileRequest) GetOnlyFolder() (x bool) { + if m == nil { + return x + } + return m.OnlyFolder +} + +// MarshalToWriter marshals TempDirOrFileRequest to the provided writer. +func (m *TempDirOrFileRequest) MarshalToWriter(writer jspb.Writer) { + if m == nil { + return + } + + if len(m.Dir) > 0 { + writer.WriteString(1, m.Dir) + } + + if len(m.Prefix) > 0 { + writer.WriteString(2, m.Prefix) + } + + if m.OnlyFolder { + writer.WriteBool(3, m.OnlyFolder) + } + + return +} + +// Marshal marshals TempDirOrFileRequest to a slice of bytes. +func (m *TempDirOrFileRequest) Marshal() []byte { + writer := jspb.NewWriter() + m.MarshalToWriter(writer) + return writer.GetResult() +} + +// UnmarshalFromReader unmarshals a TempDirOrFileRequest from the provided reader. +func (m *TempDirOrFileRequest) UnmarshalFromReader(reader jspb.Reader) *TempDirOrFileRequest { + for reader.Next() { + if m == nil { + m = &TempDirOrFileRequest{} + } + + switch reader.GetFieldNumber() { + case 1: + m.Dir = reader.ReadString() + case 2: + m.Prefix = reader.ReadString() + case 3: + m.OnlyFolder = reader.ReadBool() + default: + reader.SkipField() + } + } + + return m +} + +// Unmarshal unmarshals a TempDirOrFileRequest from a slice of bytes. +func (m *TempDirOrFileRequest) Unmarshal(rawBytes []byte) (*TempDirOrFileRequest, error) { + reader := jspb.NewReader(rawBytes) + + m = m.UnmarshalFromReader(reader) + + if err := reader.Err(); err != nil { + return nil, err + } + + return m, nil +} + +type TempDirOrFileResponse struct { + ResultPath string +} + +// GetResultPath gets the ResultPath of the TempDirOrFileResponse. +func (m *TempDirOrFileResponse) GetResultPath() (x string) { + if m == nil { + return x + } + return m.ResultPath +} + +// MarshalToWriter marshals TempDirOrFileResponse to the provided writer. +func (m *TempDirOrFileResponse) MarshalToWriter(writer jspb.Writer) { + if m == nil { + return + } + + if len(m.ResultPath) > 0 { + writer.WriteString(1, m.ResultPath) + } + + return +} + +// Marshal marshals TempDirOrFileResponse to a slice of bytes. +func (m *TempDirOrFileResponse) Marshal() []byte { + writer := jspb.NewWriter() + m.MarshalToWriter(writer) + return writer.GetResult() +} + +// UnmarshalFromReader unmarshals a TempDirOrFileResponse from the provided reader. +func (m *TempDirOrFileResponse) UnmarshalFromReader(reader jspb.Reader) *TempDirOrFileResponse { + for reader.Next() { + if m == nil { + m = &TempDirOrFileResponse{} + } + + switch reader.GetFieldNumber() { + case 1: + m.ResultPath = reader.ReadString() + default: + reader.SkipField() + } + } + + return m +} + +// Unmarshal unmarshals a TempDirOrFileResponse from a slice of bytes. +func (m *TempDirOrFileResponse) Unmarshal(rawBytes []byte) (*TempDirOrFileResponse, error) { + reader := jspb.NewReader(rawBytes) + + m = m.UnmarshalFromReader(reader) + + if err := reader.Err(); err != nil { + return nil, err + } + + return m, nil +} + +type ReadFileRequest struct { + Path string + Start int64 + Data []byte +} + +// GetPath gets the Path of the ReadFileRequest. +func (m *ReadFileRequest) GetPath() (x string) { + if m == nil { + return x + } + return m.Path +} + +// GetStart gets the Start of the ReadFileRequest. +func (m *ReadFileRequest) GetStart() (x int64) { + if m == nil { + return x + } + return m.Start +} + +// GetData gets the Data of the ReadFileRequest. +func (m *ReadFileRequest) GetData() (x []byte) { + if m == nil { + return x + } + return m.Data +} + +// MarshalToWriter marshals ReadFileRequest to the provided writer. +func (m *ReadFileRequest) MarshalToWriter(writer jspb.Writer) { + if m == nil { + return + } + + if len(m.Path) > 0 { + writer.WriteString(1, m.Path) + } + + if m.Start != 0 { + writer.WriteInt64(2, m.Start) + } + + if len(m.Data) > 0 { + writer.WriteBytes(3, m.Data) + } + + return +} + +// Marshal marshals ReadFileRequest to a slice of bytes. +func (m *ReadFileRequest) Marshal() []byte { + writer := jspb.NewWriter() + m.MarshalToWriter(writer) + return writer.GetResult() +} + +// UnmarshalFromReader unmarshals a ReadFileRequest from the provided reader. +func (m *ReadFileRequest) UnmarshalFromReader(reader jspb.Reader) *ReadFileRequest { + for reader.Next() { + if m == nil { + m = &ReadFileRequest{} + } + + switch reader.GetFieldNumber() { + case 1: + m.Path = reader.ReadString() + case 2: + m.Start = reader.ReadInt64() + case 3: + m.Data = reader.ReadBytes() + default: + reader.SkipField() + } + } + + return m +} + +// Unmarshal unmarshals a ReadFileRequest from a slice of bytes. +func (m *ReadFileRequest) Unmarshal(rawBytes []byte) (*ReadFileRequest, error) { + reader := jspb.NewReader(rawBytes) + + m = m.UnmarshalFromReader(reader) + + if err := reader.Err(); err != nil { + return nil, err + } + + return m, nil +} + +type ReadFileResponse struct { + ReadCount int64 +} + +// GetReadCount gets the ReadCount of the ReadFileResponse. +func (m *ReadFileResponse) GetReadCount() (x int64) { + if m == nil { + return x + } + return m.ReadCount +} + +// MarshalToWriter marshals ReadFileResponse to the provided writer. +func (m *ReadFileResponse) MarshalToWriter(writer jspb.Writer) { + if m == nil { + return + } + + if m.ReadCount != 0 { + writer.WriteInt64(1, m.ReadCount) + } + + return +} + +// Marshal marshals ReadFileResponse to a slice of bytes. +func (m *ReadFileResponse) Marshal() []byte { + writer := jspb.NewWriter() + m.MarshalToWriter(writer) + return writer.GetResult() +} + +// UnmarshalFromReader unmarshals a ReadFileResponse from the provided reader. +func (m *ReadFileResponse) UnmarshalFromReader(reader jspb.Reader) *ReadFileResponse { + for reader.Next() { + if m == nil { + m = &ReadFileResponse{} + } + + switch reader.GetFieldNumber() { + case 1: + m.ReadCount = reader.ReadInt64() + default: + reader.SkipField() + } + } + + return m +} + +// Unmarshal unmarshals a ReadFileResponse from a slice of bytes. +func (m *ReadFileResponse) Unmarshal(rawBytes []byte) (*ReadFileResponse, error) { + reader := jspb.NewReader(rawBytes) + + m = m.UnmarshalFromReader(reader) + + if err := reader.Err(); err != nil { + return nil, err + } + + return m, nil +} + +type WriteFileRequest struct { + Path string + Append bool + MustNotExist bool + Data []byte +} + +// GetPath gets the Path of the WriteFileRequest. +func (m *WriteFileRequest) GetPath() (x string) { + if m == nil { + return x + } + return m.Path +} + +// GetAppend gets the Append of the WriteFileRequest. +func (m *WriteFileRequest) GetAppend() (x bool) { + if m == nil { + return x + } + return m.Append +} + +// GetMustNotExist gets the MustNotExist of the WriteFileRequest. +func (m *WriteFileRequest) GetMustNotExist() (x bool) { + if m == nil { + return x + } + return m.MustNotExist +} + +// GetData gets the Data of the WriteFileRequest. +func (m *WriteFileRequest) GetData() (x []byte) { + if m == nil { + return x + } + return m.Data +} + +// MarshalToWriter marshals WriteFileRequest to the provided writer. +func (m *WriteFileRequest) MarshalToWriter(writer jspb.Writer) { + if m == nil { + return + } + + if len(m.Path) > 0 { + writer.WriteString(1, m.Path) + } + + if m.Append { + writer.WriteBool(2, m.Append) + } + + if m.MustNotExist { + writer.WriteBool(3, m.MustNotExist) + } + + if len(m.Data) > 0 { + writer.WriteBytes(4, m.Data) + } + + return +} + +// Marshal marshals WriteFileRequest to a slice of bytes. +func (m *WriteFileRequest) Marshal() []byte { + writer := jspb.NewWriter() + m.MarshalToWriter(writer) + return writer.GetResult() +} + +// UnmarshalFromReader unmarshals a WriteFileRequest from the provided reader. +func (m *WriteFileRequest) UnmarshalFromReader(reader jspb.Reader) *WriteFileRequest { + for reader.Next() { + if m == nil { + m = &WriteFileRequest{} + } + + switch reader.GetFieldNumber() { + case 1: + m.Path = reader.ReadString() + case 2: + m.Append = reader.ReadBool() + case 3: + m.MustNotExist = reader.ReadBool() + case 4: + m.Data = reader.ReadBytes() + default: + reader.SkipField() + } + } + + return m +} + +// Unmarshal unmarshals a WriteFileRequest from a slice of bytes. +func (m *WriteFileRequest) Unmarshal(rawBytes []byte) (*WriteFileRequest, error) { + reader := jspb.NewReader(rawBytes) + + m = m.UnmarshalFromReader(reader) + + if err := reader.Err(); err != nil { + return nil, err + } + + return m, nil +} + +type FileInfoRequest struct { + Path string +} + +// GetPath gets the Path of the FileInfoRequest. +func (m *FileInfoRequest) GetPath() (x string) { + if m == nil { + return x + } + return m.Path +} + +// MarshalToWriter marshals FileInfoRequest to the provided writer. +func (m *FileInfoRequest) MarshalToWriter(writer jspb.Writer) { + if m == nil { + return + } + + if len(m.Path) > 0 { + writer.WriteString(1, m.Path) + } + + return +} + +// Marshal marshals FileInfoRequest to a slice of bytes. +func (m *FileInfoRequest) Marshal() []byte { + writer := jspb.NewWriter() + m.MarshalToWriter(writer) + return writer.GetResult() +} + +// UnmarshalFromReader unmarshals a FileInfoRequest from the provided reader. +func (m *FileInfoRequest) UnmarshalFromReader(reader jspb.Reader) *FileInfoRequest { + for reader.Next() { + if m == nil { + m = &FileInfoRequest{} + } + + switch reader.GetFieldNumber() { + case 1: + m.Path = reader.ReadString() + default: + reader.SkipField() + } + } + + return m +} + +// Unmarshal unmarshals a FileInfoRequest from a slice of bytes. +func (m *FileInfoRequest) Unmarshal(rawBytes []byte) (*FileInfoRequest, error) { + reader := jspb.NewReader(rawBytes) + + m = m.UnmarshalFromReader(reader) + + if err := reader.Err(); err != nil { + return nil, err + } + + return m, nil +} + +type FileInfoResponse struct { + Name string + Size int64 + Mode uint32 + ModTime int64 + IsDir bool +} + +// GetName gets the Name of the FileInfoResponse. +func (m *FileInfoResponse) GetName() (x string) { + if m == nil { + return x + } + return m.Name +} + +// GetSize gets the Size of the FileInfoResponse. +func (m *FileInfoResponse) GetSize() (x int64) { + if m == nil { + return x + } + return m.Size +} + +// GetMode gets the Mode of the FileInfoResponse. +func (m *FileInfoResponse) GetMode() (x uint32) { + if m == nil { + return x + } + return m.Mode +} + +// GetModTime gets the ModTime of the FileInfoResponse. +func (m *FileInfoResponse) GetModTime() (x int64) { + if m == nil { + return x + } + return m.ModTime +} + +// GetIsDir gets the IsDir of the FileInfoResponse. +func (m *FileInfoResponse) GetIsDir() (x bool) { + if m == nil { + return x + } + return m.IsDir +} + +// MarshalToWriter marshals FileInfoResponse to the provided writer. +func (m *FileInfoResponse) MarshalToWriter(writer jspb.Writer) { + if m == nil { + return + } + + if len(m.Name) > 0 { + writer.WriteString(1, m.Name) + } + + if m.Size != 0 { + writer.WriteInt64(2, m.Size) + } + + if m.Mode != 0 { + writer.WriteUint32(3, m.Mode) + } + + if m.ModTime != 0 { + writer.WriteInt64(4, m.ModTime) + } + + if m.IsDir { + writer.WriteBool(5, m.IsDir) + } + + return +} + +// Marshal marshals FileInfoResponse to a slice of bytes. +func (m *FileInfoResponse) Marshal() []byte { + writer := jspb.NewWriter() + m.MarshalToWriter(writer) + return writer.GetResult() +} + +// UnmarshalFromReader unmarshals a FileInfoResponse from the provided reader. +func (m *FileInfoResponse) UnmarshalFromReader(reader jspb.Reader) *FileInfoResponse { + for reader.Next() { + if m == nil { + m = &FileInfoResponse{} + } + + switch reader.GetFieldNumber() { + case 1: + m.Name = reader.ReadString() + case 2: + m.Size = reader.ReadInt64() + case 3: + m.Mode = reader.ReadUint32() + case 4: + m.ModTime = reader.ReadInt64() + case 5: + m.IsDir = reader.ReadBool() + default: + reader.SkipField() + } + } + + return m +} + +// Unmarshal unmarshals a FileInfoResponse from a slice of bytes. +func (m *FileInfoResponse) Unmarshal(rawBytes []byte) (*FileInfoResponse, error) { + reader := jspb.NewReader(rawBytes) + + m = m.UnmarshalFromReader(reader) + + if err := reader.Err(); err != nil { + return nil, err + } + + return m, nil +} + +// HID +type HIDScriptRequest struct { + ScriptPath string +} + +// GetScriptPath gets the ScriptPath of the HIDScriptRequest. +func (m *HIDScriptRequest) GetScriptPath() (x string) { + if m == nil { + return x + } + return m.ScriptPath +} + +// MarshalToWriter marshals HIDScriptRequest to the provided writer. +func (m *HIDScriptRequest) MarshalToWriter(writer jspb.Writer) { + if m == nil { + return + } + + if len(m.ScriptPath) > 0 { + writer.WriteString(1, m.ScriptPath) + } + + return +} + +// Marshal marshals HIDScriptRequest to a slice of bytes. +func (m *HIDScriptRequest) Marshal() []byte { + writer := jspb.NewWriter() + m.MarshalToWriter(writer) + return writer.GetResult() +} + +// UnmarshalFromReader unmarshals a HIDScriptRequest from the provided reader. +func (m *HIDScriptRequest) UnmarshalFromReader(reader jspb.Reader) *HIDScriptRequest { + for reader.Next() { + if m == nil { + m = &HIDScriptRequest{} + } + + switch reader.GetFieldNumber() { + case 1: + m.ScriptPath = reader.ReadString() + default: + reader.SkipField() + } + } + + return m +} + +// Unmarshal unmarshals a HIDScriptRequest from a slice of bytes. +func (m *HIDScriptRequest) Unmarshal(rawBytes []byte) (*HIDScriptRequest, error) { + reader := jspb.NewReader(rawBytes) + + m = m.UnmarshalFromReader(reader) + + if err := reader.Err(); err != nil { + return nil, err + } + + return m, nil +} + +type HIDScriptJob struct { + Id uint32 +} + +// GetId gets the Id of the HIDScriptJob. +func (m *HIDScriptJob) GetId() (x uint32) { + if m == nil { + return x + } + return m.Id +} + +// MarshalToWriter marshals HIDScriptJob to the provided writer. +func (m *HIDScriptJob) MarshalToWriter(writer jspb.Writer) { + if m == nil { + return + } + + if m.Id != 0 { + writer.WriteUint32(1, m.Id) + } + + return +} + +// Marshal marshals HIDScriptJob to a slice of bytes. +func (m *HIDScriptJob) Marshal() []byte { + writer := jspb.NewWriter() + m.MarshalToWriter(writer) + return writer.GetResult() +} + +// UnmarshalFromReader unmarshals a HIDScriptJob from the provided reader. +func (m *HIDScriptJob) UnmarshalFromReader(reader jspb.Reader) *HIDScriptJob { + for reader.Next() { + if m == nil { + m = &HIDScriptJob{} + } + + switch reader.GetFieldNumber() { + case 1: + m.Id = reader.ReadUint32() + default: + reader.SkipField() + } + } + + return m +} + +// Unmarshal unmarshals a HIDScriptJob from a slice of bytes. +func (m *HIDScriptJob) Unmarshal(rawBytes []byte) (*HIDScriptJob, error) { + reader := jspb.NewReader(rawBytes) + + m = m.UnmarshalFromReader(reader) + + if err := reader.Err(); err != nil { + return nil, err + } + + return m, nil +} + +type HIDScriptResult struct { + Job *HIDScriptJob + IsFinished bool + ResultJson string +} + +// GetJob gets the Job of the HIDScriptResult. +func (m *HIDScriptResult) GetJob() (x *HIDScriptJob) { + if m == nil { + return x + } + return m.Job +} + +// GetIsFinished gets the IsFinished of the HIDScriptResult. +func (m *HIDScriptResult) GetIsFinished() (x bool) { + if m == nil { + return x + } + return m.IsFinished +} + +// GetResultJson gets the ResultJson of the HIDScriptResult. +func (m *HIDScriptResult) GetResultJson() (x string) { + if m == nil { + return x + } + return m.ResultJson +} + +// MarshalToWriter marshals HIDScriptResult to the provided writer. +func (m *HIDScriptResult) MarshalToWriter(writer jspb.Writer) { + if m == nil { + return + } + + if m.Job != nil { + writer.WriteMessage(1, func() { + m.Job.MarshalToWriter(writer) + }) + } + + if m.IsFinished { + writer.WriteBool(2, m.IsFinished) + } + + if len(m.ResultJson) > 0 { + writer.WriteString(3, m.ResultJson) + } + + return +} + +// Marshal marshals HIDScriptResult to a slice of bytes. +func (m *HIDScriptResult) Marshal() []byte { + writer := jspb.NewWriter() + m.MarshalToWriter(writer) + return writer.GetResult() +} + +// UnmarshalFromReader unmarshals a HIDScriptResult from the provided reader. +func (m *HIDScriptResult) UnmarshalFromReader(reader jspb.Reader) *HIDScriptResult { + for reader.Next() { + if m == nil { + m = &HIDScriptResult{} + } + + switch reader.GetFieldNumber() { + case 1: + reader.ReadMessage(func() { + m.Job = m.Job.UnmarshalFromReader(reader) + }) + case 2: + m.IsFinished = reader.ReadBool() + case 3: + m.ResultJson = reader.ReadString() + default: + reader.SkipField() + } + } + + return m +} + +// Unmarshal unmarshals a HIDScriptResult from a slice of bytes. +func (m *HIDScriptResult) Unmarshal(rawBytes []byte) (*HIDScriptResult, error) { + reader := jspb.NewReader(rawBytes) + + m = m.UnmarshalFromReader(reader) + + if err := reader.Err(); err != nil { + return nil, err + } + + return m, nil +} + // LED type LEDSettings struct { BlinkCount uint32 @@ -1487,6 +2328,14 @@ type P4WNP1Client interface { MountUMSFile(ctx context.Context, in *GadgetSettingsUMS, opts ...grpcweb.CallOption) (*Empty, error) DeployEthernetInterfaceSettings(ctx context.Context, in *EthernetInterfaceSettings, opts ...grpcweb.CallOption) (*Empty, error) DeployWifiSettings(ctx context.Context, in *WiFiSettings, opts ...grpcweb.CallOption) (*Empty, error) + HIDRunScript(ctx context.Context, in *HIDScriptRequest, opts ...grpcweb.CallOption) (*HIDScriptResult, error) + HIDRunScriptJob(ctx context.Context, in *HIDScriptRequest, opts ...grpcweb.CallOption) (*HIDScriptJob, error) + HIDRGetScriptJobResult(ctx context.Context, in *HIDScriptJob, opts ...grpcweb.CallOption) (*HIDScriptResult, error) + HIDRCancelScriptJob(ctx context.Context, in *HIDScriptJob, opts ...grpcweb.CallOption) (*Empty, error) + FSWriteFile(ctx context.Context, in *WriteFileRequest, opts ...grpcweb.CallOption) (*Empty, error) + FSReadFile(ctx context.Context, in *ReadFileRequest, opts ...grpcweb.CallOption) (*ReadFileResponse, error) + FSGetFileInfo(ctx context.Context, in *FileInfoRequest, opts ...grpcweb.CallOption) (*FileInfoResponse, error) + FSCreateTempDirOrFile(ctx context.Context, in *TempDirOrFileRequest, opts ...grpcweb.CallOption) (*TempDirOrFileResponse, error) } type p4WNP1Client struct { @@ -1580,3 +2429,75 @@ func (c *p4WNP1Client) DeployWifiSettings(ctx context.Context, in *WiFiSettings, return new(Empty).Unmarshal(resp) } + +func (c *p4WNP1Client) HIDRunScript(ctx context.Context, in *HIDScriptRequest, opts ...grpcweb.CallOption) (*HIDScriptResult, error) { + resp, err := c.client.RPCCall(ctx, "HIDRunScript", in.Marshal(), opts...) + if err != nil { + return nil, err + } + + return new(HIDScriptResult).Unmarshal(resp) +} + +func (c *p4WNP1Client) HIDRunScriptJob(ctx context.Context, in *HIDScriptRequest, opts ...grpcweb.CallOption) (*HIDScriptJob, error) { + resp, err := c.client.RPCCall(ctx, "HIDRunScriptJob", in.Marshal(), opts...) + if err != nil { + return nil, err + } + + return new(HIDScriptJob).Unmarshal(resp) +} + +func (c *p4WNP1Client) HIDRGetScriptJobResult(ctx context.Context, in *HIDScriptJob, opts ...grpcweb.CallOption) (*HIDScriptResult, error) { + resp, err := c.client.RPCCall(ctx, "HIDRGetScriptJobResult", in.Marshal(), opts...) + if err != nil { + return nil, err + } + + return new(HIDScriptResult).Unmarshal(resp) +} + +func (c *p4WNP1Client) HIDRCancelScriptJob(ctx context.Context, in *HIDScriptJob, opts ...grpcweb.CallOption) (*Empty, error) { + resp, err := c.client.RPCCall(ctx, "HIDRCancelScriptJob", in.Marshal(), opts...) + if err != nil { + return nil, err + } + + return new(Empty).Unmarshal(resp) +} + +func (c *p4WNP1Client) FSWriteFile(ctx context.Context, in *WriteFileRequest, opts ...grpcweb.CallOption) (*Empty, error) { + resp, err := c.client.RPCCall(ctx, "FSWriteFile", in.Marshal(), opts...) + if err != nil { + return nil, err + } + + return new(Empty).Unmarshal(resp) +} + +func (c *p4WNP1Client) FSReadFile(ctx context.Context, in *ReadFileRequest, opts ...grpcweb.CallOption) (*ReadFileResponse, error) { + resp, err := c.client.RPCCall(ctx, "FSReadFile", in.Marshal(), opts...) + if err != nil { + return nil, err + } + + return new(ReadFileResponse).Unmarshal(resp) +} + +func (c *p4WNP1Client) FSGetFileInfo(ctx context.Context, in *FileInfoRequest, opts ...grpcweb.CallOption) (*FileInfoResponse, error) { + resp, err := c.client.RPCCall(ctx, "FSGetFileInfo", in.Marshal(), opts...) + if err != nil { + return nil, err + } + + return new(FileInfoResponse).Unmarshal(resp) +} + +func (c *p4WNP1Client) FSCreateTempDirOrFile(ctx context.Context, in *TempDirOrFileRequest, opts ...grpcweb.CallOption) (*TempDirOrFileResponse, error) { + resp, err := c.client.RPCCall(ctx, "FSCreateTempDirOrFile", in.Marshal(), opts...) + if err != nil { + return nil, err + } + + return new(TempDirOrFileResponse).Unmarshal(resp) +} diff --git a/proto/grpc.pb.go b/proto/grpc.pb.go index f640469..d81599a 100644 --- a/proto/grpc.pb.go +++ b/proto/grpc.pb.go @@ -8,6 +8,16 @@ It is generated from these files: grpc.proto It has these top-level messages: + TempDirOrFileRequest + TempDirOrFileResponse + ReadFileRequest + ReadFileResponse + WriteFileRequest + FileInfoRequest + FileInfoResponse + HIDScriptRequest + HIDScriptJob + HIDScriptResult LEDSettings GadgetSettings GadgetSettingsEthernet @@ -65,7 +75,7 @@ func (x EthernetInterfaceSettings_Mode) String() string { return proto.EnumName(EthernetInterfaceSettings_Mode_name, int32(x)) } func (EthernetInterfaceSettings_Mode) EnumDescriptor() ([]byte, []int) { - return fileDescriptor0, []int{4, 0} + return fileDescriptor0, []int{14, 0} } type WiFiSettings_Mode int32 @@ -90,7 +100,7 @@ var WiFiSettings_Mode_value = map[string]int32{ func (x WiFiSettings_Mode) String() string { return proto.EnumName(WiFiSettings_Mode_name, int32(x)) } -func (WiFiSettings_Mode) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{8, 0} } +func (WiFiSettings_Mode) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{18, 0} } type WiFiSettings_APAuthMode int32 @@ -111,7 +121,273 @@ var WiFiSettings_APAuthMode_value = map[string]int32{ func (x WiFiSettings_APAuthMode) String() string { return proto.EnumName(WiFiSettings_APAuthMode_name, int32(x)) } -func (WiFiSettings_APAuthMode) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{8, 1} } +func (WiFiSettings_APAuthMode) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{18, 1} } + +// File System +type TempDirOrFileRequest struct { + Dir string `protobuf:"bytes,1,opt,name=dir" json:"dir,omitempty"` + Prefix string `protobuf:"bytes,2,opt,name=prefix" json:"prefix,omitempty"` + OnlyFolder bool `protobuf:"varint,3,opt,name=onlyFolder" json:"onlyFolder,omitempty"` +} + +func (m *TempDirOrFileRequest) Reset() { *m = TempDirOrFileRequest{} } +func (m *TempDirOrFileRequest) String() string { return proto.CompactTextString(m) } +func (*TempDirOrFileRequest) ProtoMessage() {} +func (*TempDirOrFileRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } + +func (m *TempDirOrFileRequest) GetDir() string { + if m != nil { + return m.Dir + } + return "" +} + +func (m *TempDirOrFileRequest) GetPrefix() string { + if m != nil { + return m.Prefix + } + return "" +} + +func (m *TempDirOrFileRequest) GetOnlyFolder() bool { + if m != nil { + return m.OnlyFolder + } + return false +} + +type TempDirOrFileResponse struct { + ResultPath string `protobuf:"bytes,1,opt,name=resultPath" json:"resultPath,omitempty"` +} + +func (m *TempDirOrFileResponse) Reset() { *m = TempDirOrFileResponse{} } +func (m *TempDirOrFileResponse) String() string { return proto.CompactTextString(m) } +func (*TempDirOrFileResponse) ProtoMessage() {} +func (*TempDirOrFileResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} } + +func (m *TempDirOrFileResponse) GetResultPath() string { + if m != nil { + return m.ResultPath + } + return "" +} + +type ReadFileRequest struct { + Path string `protobuf:"bytes,1,opt,name=path" json:"path,omitempty"` + Start int64 `protobuf:"varint,2,opt,name=start" json:"start,omitempty"` + Data []byte `protobuf:"bytes,3,opt,name=data,proto3" json:"data,omitempty"` +} + +func (m *ReadFileRequest) Reset() { *m = ReadFileRequest{} } +func (m *ReadFileRequest) String() string { return proto.CompactTextString(m) } +func (*ReadFileRequest) ProtoMessage() {} +func (*ReadFileRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} } + +func (m *ReadFileRequest) GetPath() string { + if m != nil { + return m.Path + } + return "" +} + +func (m *ReadFileRequest) GetStart() int64 { + if m != nil { + return m.Start + } + return 0 +} + +func (m *ReadFileRequest) GetData() []byte { + if m != nil { + return m.Data + } + return nil +} + +type ReadFileResponse struct { + ReadCount int64 `protobuf:"varint,1,opt,name=readCount" json:"readCount,omitempty"` +} + +func (m *ReadFileResponse) Reset() { *m = ReadFileResponse{} } +func (m *ReadFileResponse) String() string { return proto.CompactTextString(m) } +func (*ReadFileResponse) ProtoMessage() {} +func (*ReadFileResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} } + +func (m *ReadFileResponse) GetReadCount() int64 { + if m != nil { + return m.ReadCount + } + return 0 +} + +type WriteFileRequest struct { + Path string `protobuf:"bytes,1,opt,name=path" json:"path,omitempty"` + Append bool `protobuf:"varint,2,opt,name=append" json:"append,omitempty"` + MustNotExist bool `protobuf:"varint,3,opt,name=mustNotExist" json:"mustNotExist,omitempty"` + Data []byte `protobuf:"bytes,4,opt,name=data,proto3" json:"data,omitempty"` +} + +func (m *WriteFileRequest) Reset() { *m = WriteFileRequest{} } +func (m *WriteFileRequest) String() string { return proto.CompactTextString(m) } +func (*WriteFileRequest) ProtoMessage() {} +func (*WriteFileRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4} } + +func (m *WriteFileRequest) GetPath() string { + if m != nil { + return m.Path + } + return "" +} + +func (m *WriteFileRequest) GetAppend() bool { + if m != nil { + return m.Append + } + return false +} + +func (m *WriteFileRequest) GetMustNotExist() bool { + if m != nil { + return m.MustNotExist + } + return false +} + +func (m *WriteFileRequest) GetData() []byte { + if m != nil { + return m.Data + } + return nil +} + +type FileInfoRequest struct { + Path string `protobuf:"bytes,1,opt,name=path" json:"path,omitempty"` +} + +func (m *FileInfoRequest) Reset() { *m = FileInfoRequest{} } +func (m *FileInfoRequest) String() string { return proto.CompactTextString(m) } +func (*FileInfoRequest) ProtoMessage() {} +func (*FileInfoRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{5} } + +func (m *FileInfoRequest) GetPath() string { + if m != nil { + return m.Path + } + return "" +} + +type FileInfoResponse struct { + Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + Size int64 `protobuf:"varint,2,opt,name=size" json:"size,omitempty"` + Mode uint32 `protobuf:"varint,3,opt,name=mode" json:"mode,omitempty"` + ModTime int64 `protobuf:"varint,4,opt,name=modTime" json:"modTime,omitempty"` + IsDir bool `protobuf:"varint,5,opt,name=isDir" json:"isDir,omitempty"` +} + +func (m *FileInfoResponse) Reset() { *m = FileInfoResponse{} } +func (m *FileInfoResponse) String() string { return proto.CompactTextString(m) } +func (*FileInfoResponse) ProtoMessage() {} +func (*FileInfoResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{6} } + +func (m *FileInfoResponse) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *FileInfoResponse) GetSize() int64 { + if m != nil { + return m.Size + } + return 0 +} + +func (m *FileInfoResponse) GetMode() uint32 { + if m != nil { + return m.Mode + } + return 0 +} + +func (m *FileInfoResponse) GetModTime() int64 { + if m != nil { + return m.ModTime + } + return 0 +} + +func (m *FileInfoResponse) GetIsDir() bool { + if m != nil { + return m.IsDir + } + return false +} + +// HID +type HIDScriptRequest struct { + ScriptPath string `protobuf:"bytes,1,opt,name=scriptPath" json:"scriptPath,omitempty"` +} + +func (m *HIDScriptRequest) Reset() { *m = HIDScriptRequest{} } +func (m *HIDScriptRequest) String() string { return proto.CompactTextString(m) } +func (*HIDScriptRequest) ProtoMessage() {} +func (*HIDScriptRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{7} } + +func (m *HIDScriptRequest) GetScriptPath() string { + if m != nil { + return m.ScriptPath + } + return "" +} + +type HIDScriptJob struct { + Id uint32 `protobuf:"varint,1,opt,name=id" json:"id,omitempty"` +} + +func (m *HIDScriptJob) Reset() { *m = HIDScriptJob{} } +func (m *HIDScriptJob) String() string { return proto.CompactTextString(m) } +func (*HIDScriptJob) ProtoMessage() {} +func (*HIDScriptJob) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{8} } + +func (m *HIDScriptJob) GetId() uint32 { + if m != nil { + return m.Id + } + return 0 +} + +type HIDScriptResult struct { + Job *HIDScriptJob `protobuf:"bytes,1,opt,name=job" json:"job,omitempty"` + IsFinished bool `protobuf:"varint,2,opt,name=isFinished" json:"isFinished,omitempty"` + ResultJson string `protobuf:"bytes,3,opt,name=resultJson" json:"resultJson,omitempty"` +} + +func (m *HIDScriptResult) Reset() { *m = HIDScriptResult{} } +func (m *HIDScriptResult) String() string { return proto.CompactTextString(m) } +func (*HIDScriptResult) ProtoMessage() {} +func (*HIDScriptResult) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{9} } + +func (m *HIDScriptResult) GetJob() *HIDScriptJob { + if m != nil { + return m.Job + } + return nil +} + +func (m *HIDScriptResult) GetIsFinished() bool { + if m != nil { + return m.IsFinished + } + return false +} + +func (m *HIDScriptResult) GetResultJson() string { + if m != nil { + return m.ResultJson + } + return "" +} // LED type LEDSettings struct { @@ -121,7 +397,7 @@ type LEDSettings struct { func (m *LEDSettings) Reset() { *m = LEDSettings{} } func (m *LEDSettings) String() string { return proto.CompactTextString(m) } func (*LEDSettings) ProtoMessage() {} -func (*LEDSettings) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } +func (*LEDSettings) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{10} } func (m *LEDSettings) GetBlinkCount() uint32 { if m != nil { @@ -153,7 +429,7 @@ type GadgetSettings struct { func (m *GadgetSettings) Reset() { *m = GadgetSettings{} } func (m *GadgetSettings) String() string { return proto.CompactTextString(m) } func (*GadgetSettings) ProtoMessage() {} -func (*GadgetSettings) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} } +func (*GadgetSettings) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{11} } func (m *GadgetSettings) GetEnabled() bool { if m != nil { @@ -275,7 +551,7 @@ type GadgetSettingsEthernet struct { func (m *GadgetSettingsEthernet) Reset() { *m = GadgetSettingsEthernet{} } func (m *GadgetSettingsEthernet) String() string { return proto.CompactTextString(m) } func (*GadgetSettingsEthernet) ProtoMessage() {} -func (*GadgetSettingsEthernet) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} } +func (*GadgetSettingsEthernet) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{12} } func (m *GadgetSettingsEthernet) GetHostAddr() string { if m != nil { @@ -299,7 +575,7 @@ type GadgetSettingsUMS struct { func (m *GadgetSettingsUMS) Reset() { *m = GadgetSettingsUMS{} } func (m *GadgetSettingsUMS) String() string { return proto.CompactTextString(m) } func (*GadgetSettingsUMS) ProtoMessage() {} -func (*GadgetSettingsUMS) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} } +func (*GadgetSettingsUMS) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{13} } func (m *GadgetSettingsUMS) GetCdrom() bool { if m != nil { @@ -327,7 +603,7 @@ type EthernetInterfaceSettings struct { func (m *EthernetInterfaceSettings) Reset() { *m = EthernetInterfaceSettings{} } func (m *EthernetInterfaceSettings) String() string { return proto.CompactTextString(m) } func (*EthernetInterfaceSettings) ProtoMessage() {} -func (*EthernetInterfaceSettings) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4} } +func (*EthernetInterfaceSettings) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{14} } func (m *EthernetInterfaceSettings) GetName() string { if m != nil { @@ -388,7 +664,7 @@ type DHCPServerSettings struct { func (m *DHCPServerSettings) Reset() { *m = DHCPServerSettings{} } func (m *DHCPServerSettings) String() string { return proto.CompactTextString(m) } func (*DHCPServerSettings) ProtoMessage() {} -func (*DHCPServerSettings) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{5} } +func (*DHCPServerSettings) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{15} } func (m *DHCPServerSettings) GetListenPort() uint32 { if m != nil { @@ -463,7 +739,7 @@ type DHCPServerRange struct { func (m *DHCPServerRange) Reset() { *m = DHCPServerRange{} } func (m *DHCPServerRange) String() string { return proto.CompactTextString(m) } func (*DHCPServerRange) ProtoMessage() {} -func (*DHCPServerRange) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{6} } +func (*DHCPServerRange) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{16} } func (m *DHCPServerRange) GetRangeLower() string { if m != nil { @@ -495,7 +771,7 @@ type DHCPServerStaticHost struct { func (m *DHCPServerStaticHost) Reset() { *m = DHCPServerStaticHost{} } func (m *DHCPServerStaticHost) String() string { return proto.CompactTextString(m) } func (*DHCPServerStaticHost) ProtoMessage() {} -func (*DHCPServerStaticHost) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{7} } +func (*DHCPServerStaticHost) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{17} } func (m *DHCPServerStaticHost) GetMac() string { if m != nil { @@ -527,7 +803,7 @@ type WiFiSettings struct { func (m *WiFiSettings) Reset() { *m = WiFiSettings{} } func (m *WiFiSettings) String() string { return proto.CompactTextString(m) } func (*WiFiSettings) ProtoMessage() {} -func (*WiFiSettings) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{8} } +func (*WiFiSettings) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{18} } func (m *WiFiSettings) GetDisabled() bool { if m != nil { @@ -600,7 +876,7 @@ type BSSCfg struct { func (m *BSSCfg) Reset() { *m = BSSCfg{} } func (m *BSSCfg) String() string { return proto.CompactTextString(m) } func (*BSSCfg) ProtoMessage() {} -func (*BSSCfg) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{9} } +func (*BSSCfg) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{19} } func (m *BSSCfg) GetSSID() string { if m != nil { @@ -622,9 +898,19 @@ type Empty struct { func (m *Empty) Reset() { *m = Empty{} } func (m *Empty) String() string { return proto.CompactTextString(m) } func (*Empty) ProtoMessage() {} -func (*Empty) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{10} } +func (*Empty) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{20} } func init() { + proto.RegisterType((*TempDirOrFileRequest)(nil), "P4wnP1_grpc.TempDirOrFileRequest") + proto.RegisterType((*TempDirOrFileResponse)(nil), "P4wnP1_grpc.TempDirOrFileResponse") + proto.RegisterType((*ReadFileRequest)(nil), "P4wnP1_grpc.ReadFileRequest") + proto.RegisterType((*ReadFileResponse)(nil), "P4wnP1_grpc.ReadFileResponse") + proto.RegisterType((*WriteFileRequest)(nil), "P4wnP1_grpc.WriteFileRequest") + proto.RegisterType((*FileInfoRequest)(nil), "P4wnP1_grpc.FileInfoRequest") + proto.RegisterType((*FileInfoResponse)(nil), "P4wnP1_grpc.FileInfoResponse") + proto.RegisterType((*HIDScriptRequest)(nil), "P4wnP1_grpc.HIDScriptRequest") + proto.RegisterType((*HIDScriptJob)(nil), "P4wnP1_grpc.HIDScriptJob") + proto.RegisterType((*HIDScriptResult)(nil), "P4wnP1_grpc.HIDScriptResult") proto.RegisterType((*LEDSettings)(nil), "P4wnP1_grpc.LEDSettings") proto.RegisterType((*GadgetSettings)(nil), "P4wnP1_grpc.GadgetSettings") proto.RegisterType((*GadgetSettingsEthernet)(nil), "P4wnP1_grpc.GadgetSettingsEthernet") @@ -661,6 +947,14 @@ type P4WNP1Client interface { MountUMSFile(ctx context.Context, in *GadgetSettingsUMS, opts ...grpc.CallOption) (*Empty, error) DeployEthernetInterfaceSettings(ctx context.Context, in *EthernetInterfaceSettings, opts ...grpc.CallOption) (*Empty, error) DeployWifiSettings(ctx context.Context, in *WiFiSettings, opts ...grpc.CallOption) (*Empty, error) + HIDRunScript(ctx context.Context, in *HIDScriptRequest, opts ...grpc.CallOption) (*HIDScriptResult, error) + HIDRunScriptJob(ctx context.Context, in *HIDScriptRequest, opts ...grpc.CallOption) (*HIDScriptJob, error) + HIDRGetScriptJobResult(ctx context.Context, in *HIDScriptJob, opts ...grpc.CallOption) (*HIDScriptResult, error) + HIDRCancelScriptJob(ctx context.Context, in *HIDScriptJob, opts ...grpc.CallOption) (*Empty, error) + FSWriteFile(ctx context.Context, in *WriteFileRequest, opts ...grpc.CallOption) (*Empty, error) + FSReadFile(ctx context.Context, in *ReadFileRequest, opts ...grpc.CallOption) (*ReadFileResponse, error) + FSGetFileInfo(ctx context.Context, in *FileInfoRequest, opts ...grpc.CallOption) (*FileInfoResponse, error) + FSCreateTempDirOrFile(ctx context.Context, in *TempDirOrFileRequest, opts ...grpc.CallOption) (*TempDirOrFileResponse, error) } type p4WNP1Client struct { @@ -752,6 +1046,78 @@ func (c *p4WNP1Client) DeployWifiSettings(ctx context.Context, in *WiFiSettings, return out, nil } +func (c *p4WNP1Client) HIDRunScript(ctx context.Context, in *HIDScriptRequest, opts ...grpc.CallOption) (*HIDScriptResult, error) { + out := new(HIDScriptResult) + err := grpc.Invoke(ctx, "/P4wnP1_grpc.P4WNP1/HIDRunScript", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *p4WNP1Client) HIDRunScriptJob(ctx context.Context, in *HIDScriptRequest, opts ...grpc.CallOption) (*HIDScriptJob, error) { + out := new(HIDScriptJob) + err := grpc.Invoke(ctx, "/P4wnP1_grpc.P4WNP1/HIDRunScriptJob", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *p4WNP1Client) HIDRGetScriptJobResult(ctx context.Context, in *HIDScriptJob, opts ...grpc.CallOption) (*HIDScriptResult, error) { + out := new(HIDScriptResult) + err := grpc.Invoke(ctx, "/P4wnP1_grpc.P4WNP1/HIDRGetScriptJobResult", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *p4WNP1Client) HIDRCancelScriptJob(ctx context.Context, in *HIDScriptJob, opts ...grpc.CallOption) (*Empty, error) { + out := new(Empty) + err := grpc.Invoke(ctx, "/P4wnP1_grpc.P4WNP1/HIDRCancelScriptJob", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *p4WNP1Client) FSWriteFile(ctx context.Context, in *WriteFileRequest, opts ...grpc.CallOption) (*Empty, error) { + out := new(Empty) + err := grpc.Invoke(ctx, "/P4wnP1_grpc.P4WNP1/FSWriteFile", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *p4WNP1Client) FSReadFile(ctx context.Context, in *ReadFileRequest, opts ...grpc.CallOption) (*ReadFileResponse, error) { + out := new(ReadFileResponse) + err := grpc.Invoke(ctx, "/P4wnP1_grpc.P4WNP1/FSReadFile", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *p4WNP1Client) FSGetFileInfo(ctx context.Context, in *FileInfoRequest, opts ...grpc.CallOption) (*FileInfoResponse, error) { + out := new(FileInfoResponse) + err := grpc.Invoke(ctx, "/P4wnP1_grpc.P4WNP1/FSGetFileInfo", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *p4WNP1Client) FSCreateTempDirOrFile(ctx context.Context, in *TempDirOrFileRequest, opts ...grpc.CallOption) (*TempDirOrFileResponse, error) { + out := new(TempDirOrFileResponse) + err := grpc.Invoke(ctx, "/P4wnP1_grpc.P4WNP1/FSCreateTempDirOrFile", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // Server API for P4WNP1 service type P4WNP1Server interface { @@ -764,6 +1130,14 @@ type P4WNP1Server interface { MountUMSFile(context.Context, *GadgetSettingsUMS) (*Empty, error) DeployEthernetInterfaceSettings(context.Context, *EthernetInterfaceSettings) (*Empty, error) DeployWifiSettings(context.Context, *WiFiSettings) (*Empty, error) + HIDRunScript(context.Context, *HIDScriptRequest) (*HIDScriptResult, error) + HIDRunScriptJob(context.Context, *HIDScriptRequest) (*HIDScriptJob, error) + HIDRGetScriptJobResult(context.Context, *HIDScriptJob) (*HIDScriptResult, error) + HIDRCancelScriptJob(context.Context, *HIDScriptJob) (*Empty, error) + FSWriteFile(context.Context, *WriteFileRequest) (*Empty, error) + FSReadFile(context.Context, *ReadFileRequest) (*ReadFileResponse, error) + FSGetFileInfo(context.Context, *FileInfoRequest) (*FileInfoResponse, error) + FSCreateTempDirOrFile(context.Context, *TempDirOrFileRequest) (*TempDirOrFileResponse, error) } func RegisterP4WNP1Server(s *grpc.Server, srv P4WNP1Server) { @@ -932,6 +1306,150 @@ func _P4WNP1_DeployWifiSettings_Handler(srv interface{}, ctx context.Context, de return interceptor(ctx, in, info, handler) } +func _P4WNP1_HIDRunScript_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(HIDScriptRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(P4WNP1Server).HIDRunScript(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/P4wnP1_grpc.P4WNP1/HIDRunScript", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(P4WNP1Server).HIDRunScript(ctx, req.(*HIDScriptRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _P4WNP1_HIDRunScriptJob_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(HIDScriptRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(P4WNP1Server).HIDRunScriptJob(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/P4wnP1_grpc.P4WNP1/HIDRunScriptJob", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(P4WNP1Server).HIDRunScriptJob(ctx, req.(*HIDScriptRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _P4WNP1_HIDRGetScriptJobResult_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(HIDScriptJob) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(P4WNP1Server).HIDRGetScriptJobResult(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/P4wnP1_grpc.P4WNP1/HIDRGetScriptJobResult", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(P4WNP1Server).HIDRGetScriptJobResult(ctx, req.(*HIDScriptJob)) + } + return interceptor(ctx, in, info, handler) +} + +func _P4WNP1_HIDRCancelScriptJob_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(HIDScriptJob) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(P4WNP1Server).HIDRCancelScriptJob(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/P4wnP1_grpc.P4WNP1/HIDRCancelScriptJob", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(P4WNP1Server).HIDRCancelScriptJob(ctx, req.(*HIDScriptJob)) + } + return interceptor(ctx, in, info, handler) +} + +func _P4WNP1_FSWriteFile_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(WriteFileRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(P4WNP1Server).FSWriteFile(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/P4wnP1_grpc.P4WNP1/FSWriteFile", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(P4WNP1Server).FSWriteFile(ctx, req.(*WriteFileRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _P4WNP1_FSReadFile_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ReadFileRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(P4WNP1Server).FSReadFile(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/P4wnP1_grpc.P4WNP1/FSReadFile", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(P4WNP1Server).FSReadFile(ctx, req.(*ReadFileRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _P4WNP1_FSGetFileInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(FileInfoRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(P4WNP1Server).FSGetFileInfo(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/P4wnP1_grpc.P4WNP1/FSGetFileInfo", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(P4WNP1Server).FSGetFileInfo(ctx, req.(*FileInfoRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _P4WNP1_FSCreateTempDirOrFile_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(TempDirOrFileRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(P4WNP1Server).FSCreateTempDirOrFile(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/P4wnP1_grpc.P4WNP1/FSCreateTempDirOrFile", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(P4WNP1Server).FSCreateTempDirOrFile(ctx, req.(*TempDirOrFileRequest)) + } + return interceptor(ctx, in, info, handler) +} + var _P4WNP1_serviceDesc = grpc.ServiceDesc{ ServiceName: "P4wnP1_grpc.P4WNP1", HandlerType: (*P4WNP1Server)(nil), @@ -972,6 +1490,38 @@ var _P4WNP1_serviceDesc = grpc.ServiceDesc{ MethodName: "DeployWifiSettings", Handler: _P4WNP1_DeployWifiSettings_Handler, }, + { + MethodName: "HIDRunScript", + Handler: _P4WNP1_HIDRunScript_Handler, + }, + { + MethodName: "HIDRunScriptJob", + Handler: _P4WNP1_HIDRunScriptJob_Handler, + }, + { + MethodName: "HIDRGetScriptJobResult", + Handler: _P4WNP1_HIDRGetScriptJobResult_Handler, + }, + { + MethodName: "HIDRCancelScriptJob", + Handler: _P4WNP1_HIDRCancelScriptJob_Handler, + }, + { + MethodName: "FSWriteFile", + Handler: _P4WNP1_FSWriteFile_Handler, + }, + { + MethodName: "FSReadFile", + Handler: _P4WNP1_FSReadFile_Handler, + }, + { + MethodName: "FSGetFileInfo", + Handler: _P4WNP1_FSGetFileInfo_Handler, + }, + { + MethodName: "FSCreateTempDirOrFile", + Handler: _P4WNP1_FSCreateTempDirOrFile_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "grpc.proto", @@ -980,85 +1530,114 @@ var _P4WNP1_serviceDesc = grpc.ServiceDesc{ func init() { proto.RegisterFile("grpc.proto", fileDescriptor0) } var fileDescriptor0 = []byte{ - // 1279 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x56, 0xef, 0x6e, 0xdb, 0x36, - 0x10, 0x8f, 0x1d, 0xc7, 0x7f, 0xce, 0x8e, 0xe3, 0xb2, 0x45, 0xa7, 0xa6, 0x5d, 0x9b, 0x69, 0x5d, - 0x11, 0x6c, 0x85, 0x87, 0x7a, 0x01, 0x56, 0x14, 0x18, 0x36, 0x45, 0x56, 0x62, 0x2f, 0xb1, 0x2d, - 0x48, 0x71, 0x83, 0x7d, 0x12, 0x14, 0x91, 0xb1, 0x89, 0xd8, 0x92, 0x20, 0x51, 0xe9, 0xf2, 0x4e, - 0x7b, 0x95, 0x3d, 0xc0, 0x1e, 0x60, 0xcf, 0xb1, 0x81, 0xd4, 0x9f, 0x48, 0x89, 0xdd, 0x16, 0xdb, - 0x37, 0xf2, 0x77, 0x77, 0xbf, 0x3b, 0xf2, 0x78, 0x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f, 0xe7, - 0x63, 0x36, 0x9f, 0x22, 0xfc, 0x05, 0xda, 0xc7, 0x84, 0xe5, 0xbf, 0x9e, 0xab, 0xa2, 0x92, 0x0a, - 0x58, 0x4e, 0x3b, 0x66, 0x30, 0x8b, 0x0c, 0x6b, 0xb5, 0x77, 0x57, 0x70, 0xcb, 0x1b, 0xa8, 0x0f, - 0xad, 0x11, 0xff, 0xd4, 0x4e, 0x47, 0xa6, 0x98, 0x09, 0x9f, 0xf8, 0xa0, 0xac, 0x61, 0xb1, 0xe0, - 0x45, 0x9c, 0xac, 0xf5, 0xbf, 0x83, 0x57, 0x9f, 0x37, 0xfb, 0xd7, 0x38, 0xd0, 0x00, 0xc5, 0x0e, - 0xce, 0xe9, 0xe5, 0x6d, 0x07, 0x7a, 0xb2, 0xb6, 0x19, 0xac, 0xa6, 0xb9, 0xa8, 0x8a, 0xdf, 0xff, - 0x0f, 0xff, 0x06, 0x00, 0x00, 0xff, 0xff, 0x8c, 0x5f, 0xb2, 0xa4, 0x0b, 0x0c, 0x00, 0x00, + // 1741 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x58, 0xeb, 0x72, 0xdc, 0xb6, + 0x15, 0x96, 0x76, 0xe5, 0xbd, 0x9c, 0xbd, 0x1a, 0x76, 0x5c, 0x5a, 0xb1, 0x65, 0x97, 0x4d, 0x32, + 0x9a, 0x26, 0xa3, 0x36, 0xaa, 0x66, 0x92, 0xc9, 0x4c, 0xa7, 0xa5, 0xf6, 0x22, 0xad, 0xa5, 0xbd, + 0x0c, 0x28, 0x45, 0xd3, 0x5f, 0x0c, 0x45, 0x40, 0x5a, 0xd4, 0x5c, 0x92, 0x25, 0x40, 0xc5, 0xea, + 0x8f, 0x3c, 0x50, 0xdf, 0xa5, 0x0f, 0xd0, 0x07, 0xe8, 0x73, 0xb4, 0x03, 0xf0, 0xb2, 0xe4, 0x7a, + 0x57, 0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ed, 0xa4, 0x1f, 0x7f, 0x0b, 0xdb, 0x51, 0x55, 0x3a, + 0x48, 0xf8, 0x4b, 0x2c, 0xd0, 0xff, 0x55, 0x86, 0xe6, 0x15, 0x1b, 0xb2, 0xec, 0x99, 0xee, 0x42, + 0x8d, 0x30, 0x9e, 0x2f, 0x7a, 0xd9, 0x5c, 0xd2, 0x85, 0xf4, 0x36, 0xad, 0x7a, 0x21, 0xbd, 0x45, + 0x87, 0xb9, 0x8f, 0x8f, 0xf6, 0x4a, 0x1e, 0xcc, 0xd3, 0xe6, 0x83, 0xdf, 0x80, 0xba, 0x1d, 0x89, + 0xb9, 0xa5, 0x14, 0x77, 0x94, 0xe2, 0x17, 0x9b, 0x15, 0x8d, 0x99, 0x7c, 0xb2, 0x4a, 0xbd, 0x66, + 0x27, 0x23, 0x59, 0x40, 0xec, 0xc0, 0x72, 0xe6, 0xb6, 0xe7, 0x51, 0x57, 0xbd, 0xd7, 0x16, 0xae, + 0xdb, 0x41, 0x2f, 0x06, 0xd0, 0xef, 0xa0, 0x76, 0xcc, 0x79, 0xef, 0xe6, 0xd6, 0x98, 0x25, 0xe1, + 0xff, 0xac, 0xb0, 0xc1, 0xb1, 0x69, 0xf6, 0x6e, 0x6e, 0x71, 0x26, 0x84, 0xbe, 0x83, 0x66, 0x3c, + 0xee, 0xb9, 0x8c, 0x7a, 0x42, 0x55, 0xd5, 0x0d, 0x4a, 0x05, 0x41, 0xf4, 0x16, 0x9a, 0x76, 0x60, + 0xcd, 0x19, 0xa1, 0x16, 0xe7, 0x8c, 0x24, 0x05, 0x17, 0xec, 0xe0, 0x94, 0x11, 0x6a, 0x72, 0x46, + 0xd0, 0x97, 0xd0, 0x4e, 0xee, 0xcf, 0xf2, 0xe8, 0x87, 0x85, 0xef, 0x25, 0x95, 0xb4, 0x95, 0xa0, + 0x13, 0x05, 0xea, 0xdf, 0x24, 0xa9, 0xa6, 0x02, 0x25, 0x63, 0xd6, 0xdd, 0x42, 0x55, 0x28, 0x9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, 0x51, 0x3f, 0x63, 0xfe, 0xf0, 0xdf, + 0x00, 0x00, 0x00, 0xff, 0xff, 0x40, 0x38, 0x11, 0x29, 0x9a, 0x11, 0x00, 0x00, } diff --git a/proto/grpc.proto b/proto/grpc.proto index b03bef7..6cc7151 100644 --- a/proto/grpc.proto +++ b/proto/grpc.proto @@ -14,6 +14,72 @@ service P4WNP1 { rpc DeployEthernetInterfaceSettings(EthernetInterfaceSettings) returns (Empty) {} rpc DeployWifiSettings(WiFiSettings) returns (Empty) {} + + rpc HIDRunScript(HIDScriptRequest) returns (HIDScriptResult) {} + rpc HIDRunScriptJob(HIDScriptRequest) returns (HIDScriptJob) {} + rpc HIDRGetScriptJobResult(HIDScriptJob) returns (HIDScriptResult) {} + rpc HIDRCancelScriptJob(HIDScriptJob) returns (Empty) {} + + rpc FSWriteFile(WriteFileRequest) returns (Empty) {} + rpc FSReadFile(ReadFileRequest) returns (ReadFileResponse) {} + rpc FSGetFileInfo(FileInfoRequest) returns (FileInfoResponse) {} + rpc FSCreateTempDirOrFile(TempDirOrFileRequest) returns (TempDirOrFileResponse) {} +} + +/* File System */ +message TempDirOrFileRequest { + string dir = 1; + string prefix = 2; + bool onlyFolder = 3; +} + +message TempDirOrFileResponse { + string resultPath = 1; +} + +message ReadFileRequest { + string path = 1; + int64 start = 2; + bytes data = 3; +} + +message ReadFileResponse { + int64 readCount = 1; +} + +message WriteFileRequest { + string path = 1; + bool append = 2; + bool mustNotExist = 3; + bytes data = 4; +} + +message FileInfoRequest { + string path = 1; +} + +message FileInfoResponse { + string name = 1; + int64 size = 2; + uint32 mode = 3; + int64 modTime = 4; //unused + bool isDir = 5; +} + +/* HID */ +message HIDScriptRequest { + string scriptPath = 1; //for scripts hosted on the device +} + +message HIDScriptJob { + uint32 id = 1; +} + +message HIDScriptResult { + HIDScriptJob job = 1; + bool isFinished = 2; + string resultJson = 3; + //string logOutput = 4; //will be used to retrieve log output of unfinished scripts, better implemented in dedicated method with stream } /* LED */ diff --git a/service/rpc_server.go b/service/rpc_server.go index d2e3584..70cbf8d 100644 --- a/service/rpc_server.go +++ b/service/rpc_server.go @@ -17,10 +17,98 @@ import ( "strings" "path" "time" + + "../common" + "os" + "io/ioutil" +) + +var ( + rpcErrNoHid = errors.New("HIDScript engine disabled, as current USB configuration has mouse and keyboard disable") ) type server struct {} +func (s *server) FSWriteFile(ctx context.Context, req *pb.WriteFileRequest) (empty *pb.Empty, err error) { + return &pb.Empty{}, common.WriteFile(req.Path, req.MustNotExist, req.Append, req.Data) + +} + +func (s *server) FSReadFile(ctx context.Context, req *pb.ReadFileRequest) (resp *pb.ReadFileResponse, err error) { + n,err := common.ReadFile(req.Path, req.Start, req.Data) + resp = &pb.ReadFileResponse{ReadCount: int64(n)} + return +} + +func (s *server) FSGetFileInfo(ctx context.Context, req *pb.FileInfoRequest) (resp *pb.FileInfoResponse, err error) { + fi, err := os.Stat(req.Path) + resp = &pb.FileInfoResponse{} + if err != nil { return } + resp.Name = fi.Name() + resp.IsDir = fi.IsDir() + resp.Mode = uint32(fi.Mode()) + resp.ModTime = fi.ModTime().Unix() + resp.Size = fi.Size() + return +} + +func (s *server) FSCreateTempDirOrFile(ctx context.Context, req *pb.TempDirOrFileRequest) (resp *pb.TempDirOrFileResponse, err error) { + resp = &pb.TempDirOrFileResponse{} + if req.OnlyFolder { + name, err := ioutil.TempDir(req.Dir, req.Prefix) + if err != nil { return resp, err } + resp.ResultPath = name + return resp, err + } else { + f,err := ioutil.TempFile(req.Dir, req.Prefix) + if err != nil { return resp,err } + defer f.Close() + resp.ResultPath = f.Name() + return resp, err + } +} + +func (s *server) HIDRCancelScriptJob(ctx context.Context, job *pb.HIDScriptJob) (empty *pb.Empty, err error) { + empty = &pb.Empty{} + if HidCtl == nil { return empty, rpcErrNoHid} + + return +} + +func (s *server) HIDRunScript(ctx context.Context, scriptReq *pb.HIDScriptRequest) (scriptRes *pb.HIDScriptResult, err error) { + if HidCtl == nil { return nil, rpcErrNoHid} + + if scriptFile, err := ioutil.ReadFile(scriptReq.ScriptPath); err != nil { + return nil, errors.New(fmt.Sprintf("Couldn't load HIDScript '%s': %v\n", scriptReq.ScriptPath, err)) + } else { + scriptVal,err := HidCtl.RunScript(string(scriptFile)) + if err != nil { return nil,err } + val,_ := scriptVal.Export() //Convert to Go representation, error is always nil + jsonVal,err := json.Marshal(val) + if err != nil { + return nil, errors.New(fmt.Sprintf("Script seems to have succeeded but result couldn't be converted to JSON: %v\n", err)) + } + scriptRes = &pb.HIDScriptResult{ + IsFinished: true, + Job: &pb.HIDScriptJob{Id:0}, + ResultJson: string(jsonVal), + } + return scriptRes,nil + } +} + +func (s *server) HIDRunScriptJob(ctx context.Context, scriptReq *pb.HIDScriptRequest) (job *pb.HIDScriptJob, err error) { + if HidCtl == nil { return nil, rpcErrNoHid} + + return +} + +func (s *server) HIDRGetScriptJobResult(ctx context.Context,job *pb.HIDScriptJob) (scriptRes *pb.HIDScriptResult, err error) { + if HidCtl == nil { return nil, rpcErrNoHid} + + return +} + func (s *server) DeployWifiSettings(ctx context.Context, ws *pb.WiFiSettings) (empty *pb.Empty, err error) { log.Printf("Trying to deploy WiFi settings %v", ws) empty = &pb.Empty{}