added res,setres - fix ScreenWait return (raw, not json)

nats
Paulo Simão 2021-11-05 13:59:52 -03:00
parent 9fcc1cccd7
commit c80d8b1095
1 changed files with 41 additions and 12 deletions

View File

@ -168,20 +168,49 @@ func (c *Cli) KBType(t string) (map[string]interface{}, error) {
return ret, err
}
func (c *Cli) ScreenWait(f string, m int) (ret map[string]interface{}, err error) {
ret = make(map[string]interface{})
err = c.HttpCli().JsonGet(fmt.Sprintf("/ipc/wingui/screen/wait?f=%s&m=%d", f, m), &ret)
return
func (c *Cli) ScreenWait(f string, m int) ([]byte, error) {
url := fmt.Sprintf("/ipc/wingui/screen/wait?f=%s&m=%d", f, m)
ret, err := c.HttpCli().RawGet(url)
if err != nil {
fmt.Printf(err.Error())
}
fmt.Println(ret)
return ret, err
}
func (c *Cli) ScreenWaitClick(f string, m int) (ret map[string]interface{}, err error) {
ret = make(map[string]interface{})
err = c.HttpCli().JsonGet(fmt.Sprintf("/ipc/wingui/screen/waitclick?f=%s&m=%d", f, m), &ret)
return
func (c *Cli) ScreenWaitClick(f string, m int) ([]byte, error) {
url := fmt.Sprintf("/ipc/wingui/screen/waitclick?f=%s&m=%d", f, m)
ret, err := c.HttpCli().RawGet(url)
if err != nil {
fmt.Printf(err.Error())
}
fmt.Println(ret)
return ret, err
}
func (c *Cli) ScreenWaitClickCenter(f string, m int) (ret map[string]interface{}, err error) {
ret = make(map[string]interface{})
err = c.HttpCli().JsonGet(fmt.Sprintf("/ipc/wingui/screen/waitclickcenter?f=%s&m=%d", f, m), &ret)
return
func (c *Cli) ScreenWaitClickCenter(f string, m int) ([]byte, error) {
url := fmt.Sprintf("/ipc/wingui/screen/waitclickcenter?f=%s&m=%d", f, m)
ret, err := c.HttpCli().RawGet(url)
if err != nil {
fmt.Printf(err.Error())
}
fmt.Println(ret)
return ret, err
}
func (c *Cli) ScreenRes() ([]byte, error) {
url := fmt.Sprintf("/ipc/wingui/screen/res")
ret, err := c.HttpCli().RawGet(url)
if err != nil {
fmt.Printf(err.Error())
}
return ret, err
}
func (c *Cli) ScreenSetRes(x, y, cor int) error {
err := c.HttpCli().JsonGet(fmt.Sprintf("/ipc/wingui/screen/setres?x=%d&y=%d&c=%d", x, y, cor), nil)
return err
}
func NewCli() *Cli {