Add device capability and get authenticated device list
[platform/core/system/edge-orchestration.git] / patches / wrapper.patch
1 diff --git a/src/controller/discoverymgr/wrapper/wrapper.go b/src/controller/discoverymgr/wrapper/wrapper.go
2 index 1317b40..6c3ffc3 100644
3 --- a/src/controller/discoverymgr/wrapper/wrapper.go
4 +++ b/src/controller/discoverymgr/wrapper/wrapper.go
5 @@ -41,7 +41,7 @@ type ZeroconfInterface interface {
6         Shutdown()
7  }
8  
9 -// Entity provides wapper entity info
10 +// Entity provides wrapper entity info
11  type Entity struct {
12         DeviceID          string
13         TTL               uint32
14 @@ -54,6 +54,7 @@ type OrchestrationInformation struct {
15         Platform      string
16         ExecutionType string
17         ServiceList   []string
18 +       Capability    string
19  }
20  
21  // ZeroconfImpl struct
22 @@ -92,7 +93,7 @@ func (zc *ZeroconfImpl) RegisterProxy(instance, service, domain string,
23  
24  }
25  
26 -// GetSubscriberChan subsrcibes serviceEntry info of other devices
27 +// GetSubscriberChan subscribers serviceEntry info of other devices
28  func (zc ZeroconfImpl) GetSubscriberChan() (chan *Entity, error) {
29         subchan, err := zeroconf.EdgeGetSubscriberChan()
30         if err != nil {
31 @@ -165,13 +166,15 @@ func convertServiceEntrytoDB(data *zeroconf.ServiceEntry) (newDevice Orchestrati
32         //Todo : Remove
33         //tmp error defense code
34         //from old version
35 -       if len(data.Text) < 2 {
36 +       if len(data.Text) < 3 {
37                 newDevice.ServiceList = data.Text
38         } else {
39                 newDevice.Platform = data.Text[0]
40                 newDevice.ExecutionType = data.Text[1]
41 -               if len(data.Text) > 2 {
42 -                       newDevice.ServiceList = append(newDevice.ServiceList, data.Text[2:]...)
43 +               newDevice.Capability = data.Text[2]
44 +
45 +               if len(data.Text) > 3 {
46 +                       newDevice.ServiceList = append(newDevice.ServiceList, data.Text[3:]...)
47                 }
48         }
49         return