Code refactoring for app module
This commit is contained in:
@@ -5,7 +5,6 @@ import (
|
||||
|
||||
"github.com/AlexxIT/go2rtc/pkg/core"
|
||||
"github.com/pion/rtp"
|
||||
"github.com/rs/zerolog/log"
|
||||
)
|
||||
|
||||
func Log(handler core.HandlerFunc) core.HandlerFunc {
|
||||
@@ -6,7 +6,6 @@ import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"log"
|
||||
"net/rpc"
|
||||
"net/url"
|
||||
"strconv"
|
||||
@@ -138,7 +137,7 @@ func (c *Client) Connect() error {
|
||||
}
|
||||
|
||||
offer := pc.LocalDescription()
|
||||
log.Printf("[roborock] offer\n%s", offer.SDP)
|
||||
//log.Printf("[roborock] offer\n%s", offer.SDP)
|
||||
if err = c.SendSDPtoRobot(offer); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -151,7 +150,7 @@ func (c *Client) Connect() error {
|
||||
time.Sleep(time.Second)
|
||||
|
||||
if desc, _ := c.GetDeviceSDP(); desc != nil {
|
||||
log.Printf("[roborock] answer\n%s", desc.SDP)
|
||||
//log.Printf("[roborock] answer\n%s", desc.SDP)
|
||||
if err = c.conn.SetAnswer(desc.SDP); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -6,12 +6,12 @@ import (
|
||||
"encoding/hex"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"github.com/AlexxIT/go2rtc/pkg/mqtt"
|
||||
"github.com/rs/zerolog/log"
|
||||
"net"
|
||||
"net/rpc"
|
||||
"net/url"
|
||||
"time"
|
||||
|
||||
"github.com/AlexxIT/go2rtc/pkg/mqtt"
|
||||
)
|
||||
|
||||
type Codec struct {
|
||||
@@ -56,7 +56,7 @@ func (c *Codec) WriteRequest(r *rpc.Request, v any) error {
|
||||
return err
|
||||
}
|
||||
|
||||
log.Printf("[roborock] send: %s", payload)
|
||||
//log.Printf("[roborock] send: %s", payload)
|
||||
|
||||
payload = c.Encrypt(payload, ts, ts, ts)
|
||||
|
||||
@@ -86,7 +86,7 @@ func (c *Codec) ReadResponseHeader(r *rpc.Response) error {
|
||||
continue
|
||||
}
|
||||
|
||||
log.Printf("[roborock] recv %s", payload)
|
||||
//log.Printf("[roborock] recv %s", payload)
|
||||
|
||||
// get content from response payload:
|
||||
// {"t":1676871268,"dps":{"102":"{\"id\":315003,\"result\":[\"ok\"]}"}}
|
||||
|
||||
Reference in New Issue
Block a user