I was pretty sure at the time I created it, that there was a validation
of this in one of our sample apps... It had worked at one point :)
It is entirely possible that the CBOR conversion ended up breaking this.
Can you file a JIRA ticket at JIRA.iotivity.org and include this info?
Particularly any DIFFs that you did to cause this.
The bad-get error is usually because the parsed type doesn't match the
fetched type (so trying to assign an int to a string or something).
the correct way to get the value out should be something like:
std::vector<std::vector<int>> myvector = rep["power"];
If this doesn't work, it is almost definitely a bug.
Thanks,
Erich
On Sun, 2015-09-06 at 09:31 +0000, ??? wrote:
> Hello All.
>
>
> I am writing mail to ask quesstions about variant AttributeValue of
> resource/include/AttributeValue.h because it seems nested vector type
> doesn't work well as intended.
>
>
>
> Once I tested Sequences int(ie std::vector<int> of typedef
> boost::variant), I've met the correct result. It means server and
> client are able to exchagne AttributeValue with vector<int> each
> other.
>
>
>
> However, on the other hand, I cannot find out the right method to
> exchange std::vector< std::vector<int>> as AttributeValue. Although
> server created nested attributes such as { "power" : [ [10,20],
> [100,110,120] ] }, client only gets {"power":[ [],[]] }
>
>
>
> I attached files which use std::vector< std::vector<int>> attributes
> for referrence. they are based on resoruce/examples/simpleserver.cpp
> and simpleclient.cpp. If there is something to get fixed, please let
> me know.
>
>
>
> output from modified simple server
>
> Usage : simpleserver <value>
> Default - Non-secure resource and notify all observers
> 1 - Non-secure resource and notify list of observers
>
> 2 - Secure resource and notify all observers
> 3 - Secure resource and notify list of observers
>
> 4 - Non-secure resource, GET slow response, notify all observers
> len1 :2
> len2 :2
> 0,0:10
> 0,1:20
> len2 :3
> 1,0:100
> 1,1:110
> 1,2:120
> 4
> Created resource.
> Added Interface and Type
> Waiting
> 0:
> In entity handler wrapper:
>
> In Server CPP entity handler:
> requestFlag : Request
> requestType : GET
> 0:
> In entity handler wrapper:
>
> In Server CPP entity handler:
> requestFlag : Request
> requestType : PUT
> state: 1
> boost::bad_get: failed value get using boost::get
> 0:
> In entity handler wrapper:
>
> In Server CPP entity handler:
> requestFlag : Request
> requestType : POST
> 0:
> In entity handler wrapper:
>
> In Server CPP entity handler:
> requestFlag : Request
> requestType : POST
> state: 1
> boost::bad_get: failed value get using boost::get
> 0:
> In entity handler wrapper:
>
> In Server CPP entity handler:
> requestFlag : Request
> requestType : GET
> requestFlag : Observer
> Notifying observers with resource handle: 0x21a43d0
> 0:
> In entity handler wrapper:
>
> In Server CPP entity handler:
> requestFlag : Request
> requestType : GET
> ^C
>
>
>
>
>
>
>
>
> output from modified simple client
>
>
> ---------------------------------------------------------------------
> Usage : simpleclient <ObserveType>
> ObserveType : 1 - Observe
> ObserveType : 2 - ObserveAll
> ---------------------------------------------------------------------
>
> <===Setting ObserveType to Observe and ConnectivityType to IP===>
>
> 2
> Finding Resource...
> Finding Resource for second time...
> In foundResource
> Found resource 5272517e-255b-4231-ae21-5372636074bd/a/light for the
> first time on server with ID: 5272517e-255b-4231-ae21-5372636074bd
> DISCOVERED Resource:
> URI of the resource: /a/light
> Host address of the resource: coap://[fe80::a00:27ff:fe85:1c90]:54089
> List of resource types:
> core.light
> core.brightlight
> List of resource interfaces:
> oic.if.baseline
> oic.if.ll
> Getting Light Representation...
> In foundResource
> Found resource 5272517e-255b-4231-ae21-5372636074bd/a/light again!
> Found another resource, ignoring
> 0: listenCallback(): failed to create resource. clientResponse: 33
> 0: listenCallback(): failed to create resource. clientResponse: 33
> GET request was successful
> Resource URI: /a/light
> state: false
> len1 :2
> len2 :0
> len2 :0
> name: John's light
> Putting light representation...
> PUT request was successful
> state: true
> power:
> len1 :2
> len2 :0
> len2 :0
> name: John's light
> Posting light representation...
> POST request was successful
> Uri of the created resource: /a/light1
> Posting light representation...
> POST request was successful
> state: true
> power:
> len1 :2
> len2 :0
> len2 :0
> name: John's light
>
> Observe is used.
>
> Observe registration action is successful
> OBSERVE RESULT:
> SequenceNumber: 0
> state: true
> power:
> len1 :2
> len2 :0
> len2 :0
> name: John's light
> OBSERVE RESULT:
> SequenceNumber: 5
> state: true
> power:
> len1 :2
> len2 :0
> len2 :0
> name: John's light
> OBSERVE RESULT:
> SequenceNumber: 6
> state: true
> power:
> len1 :2
> len2 :0
> len2 :0
> name: John's light
> OBSERVE RESULT:
> SequenceNumber: 7
> state: true
> power:
> len1 :2
> len2 :0
> len2 :0
> name: John's light
> OBSERVE RESULT:
> SequenceNumber: 8
> state: true
> power:
> len1 :2
> len2 :0
> len2 :0
> name: John's light
> OBSERVE RESULT:
> SequenceNumber: 9
> state: true
> power:
> len1 :2
> len2 :0
> len2 :0
> name: John's light
> OBSERVE RESULT:
> SequenceNumber: 10
> state: true
> power:
> len1 :2
> len2 :0
> len2 :0
> name: John's light
> OBSERVE RESULT:
> SequenceNumber: 11
> state: true
> power:
> len1 :2
> len2 :0
> len2 :0
> name: John's light
> OBSERVE RESULT:
> SequenceNumber: 12
> state: true
> power:
> len1 :2
> len2 :0
> len2 :0
> name: John's light
> OBSERVE RESULT:
> SequenceNumber: 13
> state: true
> power:
> len1 :2
> len2 :0
> len2 :0
> name: John's light
> OBSERVE RESULT:
> SequenceNumber: 14
> state: true
> power:
> len1 :2
> len2 :0
> len2 :0
> name: John's light
> Cancelling Observe...
> Cancel result: 0
> DONE
>
>
>
>
>
>
>
>
>
>
> Best Regards,
> Rami Jung
>
>
> _______________________________________________
> iotivity-dev mailing list
> iotivity-dev at lists.iotivity.org
> https://lists.iotivity.org/mailman/listinfo/iotivity-dev