Hi,
I have a question.when i publish device's data to cloud , which param can i
use to save data?
ex:
i have a light device ,it have three property,
Light.status
Light.color
Light.brightness

when i pulish light device's data to the Iotivity Cloud,

public CoapRequest makePayload(CoapRequest request) throws Exception {
    ArrayList<Object> payload = new ArrayList<>();

    HashMap<Object, Object> tags = new HashMap<>();
    tags.put("di", "38f7483c-5a31-4161-ba7e-9c13e0d");
    tags.put("bm", (int) 1);
    tags.put("ttl", (int) 86400);

    ArrayList<LinkedHashMap<Object, Object>> publishLinks = new ArrayList<>();
    LinkedHashMap<Object, Object> link = new LinkedHashMap<>();
    link.put("href", "/a/light/1");
    ArrayList<String> rt = new ArrayList<>();
    ArrayList<String> itf = new ArrayList<>();
    ArrayList<String> mt = new ArrayList<>();
    rt.add("core.light");
    link.put("rt", rt);

    itf.add("oic.if.baseline");
    link.put("if", itf);

    mt.add("application/json");

    link.put("mt", mt);

    link.put("ins", 1);

    publishLinks.add(link);

    payload.add(tags);
    payload.add(publishLinks);

    Cbor<ArrayList<Object>> cbor = new Cbor<>();

    request.setPayload(cbor.encodingPayloadToCbor(payload));

    return request;
}

*how can i save the light device'data to cloud? Saving to mt, rt or others?*

HashMap<Object,Object> map = new HashMap<>();
    map.put("status",0);
    map.put("color","155,255,241");
    map.put("strength",40);

String deviceData = JSONUtil.writeJSON(map);


how can i get the data from cloud?

when i save light device'data to mt ,the mongodb show
// colleciton: RD_TABLE
{
"_id" : ObjectId("57298fe32cfe3325e86962b7"),
"n" : null,
"di" : "38f7483c-5a31-4161-ba7e-9c13e0d",
"baseURI" : null,
"bm" : 1,
"port" : 0,
"ins" : 5,
"rts" : null,
"drel" : null,
"ttl" : 0,
"href" : "/38f7483c-5a31-4161-ba7e-9c13e0d/a/light/4",
"rt" : [
"core.light"
],
"if" : [
"oic.if.baseline"
],
"rel" : null,
"obs" : false,
"title" : null,
"uri" : null,
"mt" : [
"application/json",
"{\"status\":0,\"strength\":40,\"color\":\"155,255,241\"}"
]
}

but when i get the data from cloud ,the result is

discoverPayload :[{di=[B at 180c1165,
links=[{href=/38f7483c-5a31-4161-ba7e-9c13e0d/a/light/1, rt=core.light,
if=oic.if.baseline, p={bm=1}}], not contain light devices'data.

thanks for help.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://lists.iotivity.org/pipermail/iotivity-dev/attachments/20160504/3d22a473/attachment.html>

Reply via email to