Skip to content

Commit

Permalink
introduce v2 version
Browse files Browse the repository at this point in the history
  • Loading branch information
jkralik committed Sep 29, 2022
1 parent e03a050 commit f921405
Show file tree
Hide file tree
Showing 85 changed files with 293 additions and 289 deletions.
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,8 @@
"IDENTITY_CRT": "${workspaceFolder}/.tmp/pki_certs/identitycrt.pem",
"IDENTITY_KEY": "${workspaceFolder}/.tmp/pki_certs/identitykey.pem",
},
"files.watcherExclude": {
"**/plgd-dev/device/v2/**": true
},
"go.testTimeout": "600s",
}
6 changes: 3 additions & 3 deletions client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import (
"time"

"github.com/pion/dtls/v2"
"github.com/plgd-dev/device/client/core"
"github.com/plgd-dev/device/client/core/otm"
"github.com/plgd-dev/device/pkg/net/coap"
"github.com/plgd-dev/device/v2/client/core"
"github.com/plgd-dev/device/v2/client/core/otm"
"github.com/plgd-dev/device/v2/pkg/net/coap"
"github.com/plgd-dev/go-coap/v3/net/blockwise"
"github.com/plgd-dev/go-coap/v3/options"
coapSync "github.com/plgd-dev/go-coap/v3/pkg/sync"
Expand Down
4 changes: 2 additions & 2 deletions client/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (
"testing"
"time"

"github.com/plgd-dev/device/client"
"github.com/plgd-dev/device/test"
"github.com/plgd-dev/device/v2/client"
"github.com/plgd-dev/device/v2/test"
"github.com/stretchr/testify/require"
)

Expand Down
4 changes: 2 additions & 2 deletions client/core/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"net"

"github.com/pion/dtls/v2"
pkgError "github.com/plgd-dev/device/pkg/error"
"github.com/plgd-dev/device/pkg/net/coap"
pkgError "github.com/plgd-dev/device/v2/pkg/error"
"github.com/plgd-dev/device/v2/pkg/net/coap"
coapNet "github.com/plgd-dev/go-coap/v3/net"
"github.com/plgd-dev/go-coap/v3/tcp"
"github.com/plgd-dev/go-coap/v3/udp"
Expand Down
16 changes: 8 additions & 8 deletions client/core/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ import (
"time"

"github.com/pion/dtls/v2"
"github.com/plgd-dev/device/client/core"
"github.com/plgd-dev/device/client/core/otm"
justworks "github.com/plgd-dev/device/client/core/otm/just-works"
"github.com/plgd-dev/device/client/core/otm/manufacturer"
pkgError "github.com/plgd-dev/device/pkg/error"
"github.com/plgd-dev/device/pkg/net/coap"
"github.com/plgd-dev/device/schema"
"github.com/plgd-dev/device/test"
"github.com/plgd-dev/device/v2/client/core"
"github.com/plgd-dev/device/v2/client/core/otm"
justworks "github.com/plgd-dev/device/v2/client/core/otm/just-works"
"github.com/plgd-dev/device/v2/client/core/otm/manufacturer"
pkgError "github.com/plgd-dev/device/v2/pkg/error"
"github.com/plgd-dev/device/v2/pkg/net/coap"
"github.com/plgd-dev/device/v2/schema"
"github.com/plgd-dev/device/v2/test"
"github.com/plgd-dev/go-coap/v3/tcp"
"github.com/plgd-dev/go-coap/v3/udp"
"github.com/plgd-dev/kit/v2/security"
Expand Down
6 changes: 3 additions & 3 deletions client/core/deleteResource.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import (
"context"
"fmt"

"github.com/plgd-dev/device/pkg/codec/ocf"
"github.com/plgd-dev/device/pkg/net/coap"
"github.com/plgd-dev/device/schema"
"github.com/plgd-dev/device/v2/pkg/codec/ocf"
"github.com/plgd-dev/device/v2/pkg/net/coap"
"github.com/plgd-dev/device/v2/schema"
)

func (d *Device) DeleteResource(
Expand Down
4 changes: 2 additions & 2 deletions client/core/device.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import (
"sync/atomic"

"github.com/pion/dtls/v2"
"github.com/plgd-dev/device/pkg/net/coap"
"github.com/plgd-dev/device/schema"
"github.com/plgd-dev/device/v2/pkg/net/coap"
"github.com/plgd-dev/device/v2/schema"
"github.com/plgd-dev/kit/v2/net"
"golang.org/x/sync/semaphore"
)
Expand Down
2 changes: 1 addition & 1 deletion client/core/discover.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"sync"
"time"

"github.com/plgd-dev/device/pkg/net/coap"
"github.com/plgd-dev/device/v2/pkg/net/coap"
"github.com/plgd-dev/go-coap/v3/message"
udpMessage "github.com/plgd-dev/go-coap/v3/message"
"github.com/plgd-dev/go-coap/v3/message/pool"
Expand Down
6 changes: 3 additions & 3 deletions client/core/discoverDeviceCodec.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package core
import (
"fmt"

"github.com/plgd-dev/device/pkg/codec/ocf"
pkgError "github.com/plgd-dev/device/pkg/error"
"github.com/plgd-dev/device/schema"
"github.com/plgd-dev/device/v2/pkg/codec/ocf"
pkgError "github.com/plgd-dev/device/v2/pkg/error"
"github.com/plgd-dev/device/v2/schema"
"github.com/plgd-dev/go-coap/v3/message"
"github.com/plgd-dev/go-coap/v3/message/pool"
)
Expand Down
6 changes: 3 additions & 3 deletions client/core/discoverDeviceOwnership.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import (
"context"
"fmt"

"github.com/plgd-dev/device/pkg/codec/ocf"
"github.com/plgd-dev/device/pkg/net/coap"
"github.com/plgd-dev/device/schema/doxm"
"github.com/plgd-dev/device/v2/pkg/codec/ocf"
"github.com/plgd-dev/device/v2/pkg/net/coap"
"github.com/plgd-dev/device/v2/schema/doxm"
"github.com/plgd-dev/go-coap/v3/message"
"github.com/plgd-dev/go-coap/v3/message/codes"
"github.com/plgd-dev/go-coap/v3/message/pool"
Expand Down
8 changes: 4 additions & 4 deletions client/core/discoverDevices.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import (
"context"
"fmt"

"github.com/plgd-dev/device/pkg/codec/ocf"
"github.com/plgd-dev/device/pkg/net/coap"
"github.com/plgd-dev/device/schema"
"github.com/plgd-dev/device/schema/resources"
"github.com/plgd-dev/device/v2/pkg/codec/ocf"
"github.com/plgd-dev/device/v2/pkg/net/coap"
"github.com/plgd-dev/device/v2/schema"
"github.com/plgd-dev/device/v2/schema/resources"
"github.com/plgd-dev/go-coap/v3/message"
"github.com/plgd-dev/go-coap/v3/message/codes"
"github.com/plgd-dev/go-coap/v3/message/pool"
Expand Down
4 changes: 2 additions & 2 deletions client/core/disownDevice.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"fmt"

"github.com/google/uuid"
"github.com/plgd-dev/device/schema"
"github.com/plgd-dev/device/schema/pstat"
"github.com/plgd-dev/device/v2/schema"
"github.com/plgd-dev/device/v2/schema/pstat"
)

func connectionWasClosed(ctx context.Context, err error) bool {
Expand Down
6 changes: 3 additions & 3 deletions client/core/getDevice.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import (
"strings"
"sync"

"github.com/plgd-dev/device/pkg/net/coap"
"github.com/plgd-dev/device/schema"
"github.com/plgd-dev/device/schema/device"
"github.com/plgd-dev/device/v2/pkg/net/coap"
"github.com/plgd-dev/device/v2/schema"
"github.com/plgd-dev/device/v2/schema/device"
"github.com/plgd-dev/go-coap/v3/udp/client"
)

Expand Down
8 changes: 4 additions & 4 deletions client/core/getDevice_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import (
"testing"
"time"

"github.com/plgd-dev/device/client/core"
"github.com/plgd-dev/device/client/core/otm"
"github.com/plgd-dev/device/schema/platform"
"github.com/plgd-dev/device/test"
"github.com/plgd-dev/device/v2/client/core"
"github.com/plgd-dev/device/v2/client/core/otm"
"github.com/plgd-dev/device/v2/schema/platform"
"github.com/plgd-dev/device/v2/test"
"github.com/stretchr/testify/require"
)

Expand Down
6 changes: 3 additions & 3 deletions client/core/getDevices.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import (
"fmt"
"sync"

"github.com/plgd-dev/device/pkg/net/coap"
"github.com/plgd-dev/device/schema"
"github.com/plgd-dev/device/schema/device"
"github.com/plgd-dev/device/v2/pkg/net/coap"
"github.com/plgd-dev/device/v2/schema"
"github.com/plgd-dev/device/v2/schema/device"
"github.com/plgd-dev/go-coap/v3/udp/client"
)

Expand Down
2 changes: 1 addition & 1 deletion client/core/getDevices_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"testing"
"time"

"github.com/plgd-dev/device/client/core"
"github.com/plgd-dev/device/v2/client/core"
"github.com/stretchr/testify/require"
)

Expand Down
2 changes: 1 addition & 1 deletion client/core/getEndpoints.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package core

import (
"github.com/plgd-dev/device/schema"
"github.com/plgd-dev/device/v2/schema"
)

func (d *Device) GetEndpoints() schema.Endpoints {
Expand Down
4 changes: 2 additions & 2 deletions client/core/getEndpoints_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"testing"
"time"

"github.com/plgd-dev/device/client/core"
"github.com/plgd-dev/device/test"
"github.com/plgd-dev/device/v2/client/core"
"github.com/plgd-dev/device/v2/test"
"github.com/stretchr/testify/require"
)

Expand Down
8 changes: 4 additions & 4 deletions client/core/getOwnership.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import (
"context"
"fmt"

"github.com/plgd-dev/device/pkg/net/coap"
"github.com/plgd-dev/device/schema"
"github.com/plgd-dev/device/schema/doxm"
"github.com/plgd-dev/device/schema/interfaces"
"github.com/plgd-dev/device/v2/pkg/net/coap"
"github.com/plgd-dev/device/v2/schema"
"github.com/plgd-dev/device/v2/schema/doxm"
"github.com/plgd-dev/device/v2/schema/interfaces"
)

// GetOwnership gets device's ownership resource.
Expand Down
6 changes: 3 additions & 3 deletions client/core/getOwnership_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import (
"testing"
"time"

"github.com/plgd-dev/device/client/core"
"github.com/plgd-dev/device/client/core/otm"
"github.com/plgd-dev/device/test"
"github.com/plgd-dev/device/v2/client/core"
"github.com/plgd-dev/device/v2/client/core/otm"
"github.com/plgd-dev/device/v2/test"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
Expand Down
2 changes: 1 addition & 1 deletion client/core/getOwnerships.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"context"
"fmt"

"github.com/plgd-dev/device/schema/doxm"
"github.com/plgd-dev/device/v2/schema/doxm"
"github.com/plgd-dev/go-coap/v3/udp/client"
)

Expand Down
8 changes: 4 additions & 4 deletions client/core/getOwnerships_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import (
"testing"
"time"

"github.com/plgd-dev/device/client/core"
"github.com/plgd-dev/device/client/core/otm"
"github.com/plgd-dev/device/schema/doxm"
"github.com/plgd-dev/device/test"
"github.com/plgd-dev/device/v2/client/core"
"github.com/plgd-dev/device/v2/client/core/otm"
"github.com/plgd-dev/device/v2/schema/doxm"
"github.com/plgd-dev/device/v2/test"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"go.uber.org/atomic"
Expand Down
6 changes: 3 additions & 3 deletions client/core/getResource.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import (
"context"
"fmt"

"github.com/plgd-dev/device/pkg/codec/ocf"
"github.com/plgd-dev/device/pkg/net/coap"
"github.com/plgd-dev/device/schema"
"github.com/plgd-dev/device/v2/pkg/codec/ocf"
"github.com/plgd-dev/device/v2/pkg/net/coap"
"github.com/plgd-dev/device/v2/schema"
)

// GetResource queries a device for a resource value in CBOR.
Expand Down
6 changes: 3 additions & 3 deletions client/core/getResourceLinks.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import (
"context"
"fmt"

"github.com/plgd-dev/device/pkg/net/coap"
"github.com/plgd-dev/device/schema"
"github.com/plgd-dev/device/schema/resources"
"github.com/plgd-dev/device/v2/pkg/net/coap"
"github.com/plgd-dev/device/v2/schema"
"github.com/plgd-dev/device/v2/schema/resources"
"github.com/plgd-dev/go-coap/v3/message"
"github.com/plgd-dev/kit/v2/net"
)
Expand Down
6 changes: 3 additions & 3 deletions client/core/getResourceLinks_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import (
"testing"
"time"

"github.com/plgd-dev/device/client/core"
"github.com/plgd-dev/device/schema/device"
"github.com/plgd-dev/device/test"
"github.com/plgd-dev/device/v2/client/core"
"github.com/plgd-dev/device/v2/schema/device"
"github.com/plgd-dev/device/v2/test"
"github.com/stretchr/testify/require"
)

Expand Down
2 changes: 1 addition & 1 deletion client/core/getSdkOwnerID.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"crypto/x509"
"fmt"

"github.com/plgd-dev/device/pkg/net/coap"
"github.com/plgd-dev/device/v2/pkg/net/coap"
)

func getSdkError(err error) error {
Expand Down
4 changes: 2 additions & 2 deletions client/core/maintenance.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"fmt"
"net/http"

"github.com/plgd-dev/device/schema"
"github.com/plgd-dev/device/schema/maintenance"
"github.com/plgd-dev/device/v2/schema"
"github.com/plgd-dev/device/v2/schema/maintenance"
)

func (d *Device) Reboot(
Expand Down
10 changes: 5 additions & 5 deletions client/core/maintenance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import (
"testing"
"time"

"github.com/plgd-dev/device/client/core"
"github.com/plgd-dev/device/client/core/otm"
"github.com/plgd-dev/device/schema"
"github.com/plgd-dev/device/schema/device"
"github.com/plgd-dev/device/test"
"github.com/plgd-dev/device/v2/client/core"
"github.com/plgd-dev/device/v2/client/core/otm"
"github.com/plgd-dev/device/v2/schema"
"github.com/plgd-dev/device/v2/schema/device"
"github.com/plgd-dev/device/v2/test"
"github.com/stretchr/testify/require"
)

Expand Down
6 changes: 3 additions & 3 deletions client/core/observeResource.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import (
"sync"

"github.com/google/uuid"
"github.com/plgd-dev/device/pkg/codec/ocf"
"github.com/plgd-dev/device/pkg/net/coap"
"github.com/plgd-dev/device/schema"
"github.com/plgd-dev/device/v2/pkg/codec/ocf"
"github.com/plgd-dev/device/v2/pkg/net/coap"
"github.com/plgd-dev/device/v2/schema"
"go.uber.org/atomic"
)

Expand Down
8 changes: 4 additions & 4 deletions client/core/otm/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import (
"encoding/pem"
"fmt"

"github.com/plgd-dev/device/pkg/net/coap"
"github.com/plgd-dev/device/schema/credential"
"github.com/plgd-dev/device/schema/csr"
"github.com/plgd-dev/device/schema/doxm"
"github.com/plgd-dev/device/v2/pkg/net/coap"
"github.com/plgd-dev/device/v2/schema/credential"
"github.com/plgd-dev/device/v2/schema/csr"
"github.com/plgd-dev/device/v2/schema/doxm"
kitNet "github.com/plgd-dev/kit/v2/net"
kitSecurity "github.com/plgd-dev/kit/v2/security"
)
Expand Down
8 changes: 4 additions & 4 deletions client/core/otm/just-works/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import (
"fmt"

"github.com/pion/dtls/v2"
"github.com/plgd-dev/device/client/core/otm/just-works/cipher"
"github.com/plgd-dev/device/pkg/net/coap"
"github.com/plgd-dev/device/schema"
"github.com/plgd-dev/device/schema/doxm"
"github.com/plgd-dev/device/v2/client/core/otm/just-works/cipher"
"github.com/plgd-dev/device/v2/pkg/net/coap"
"github.com/plgd-dev/device/v2/schema"
"github.com/plgd-dev/device/v2/schema/doxm"
"github.com/plgd-dev/go-coap/v3/udp"
kitNet "github.com/plgd-dev/kit/v2/net"
)
Expand Down
Loading

0 comments on commit f921405

Please sign in to comment.