summaryrefslogtreecommitdiffstats
path: root/src/shared/AtomReader.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2012-03-20 06:20:13 +0000
committerDavid Robillard <d@drobilla.net>2012-03-20 06:20:13 +0000
commitcfa4de455fc386e93a9628d21d5f4d71bd4af37d (patch)
treebb89c8744e3210a99255122b83159d0484e7a511 /src/shared/AtomReader.cpp
parent6720dc9cab2d0cb82ca7d45fb143ad4dfcafbf81 (diff)
downloadingen-cfa4de455fc386e93a9628d21d5f4d71bd4af37d.tar.gz
ingen-cfa4de455fc386e93a9628d21d5f4d71bd4af37d.tar.bz2
ingen-cfa4de455fc386e93a9628d21d5f4d71bd4af37d.zip
More complete Ingen plugin <=> UI communication.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@4093 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/shared/AtomReader.cpp')
-rw-r--r--src/shared/AtomReader.cpp32
1 files changed, 22 insertions, 10 deletions
diff --git a/src/shared/AtomReader.cpp b/src/shared/AtomReader.cpp
index 009aace6..618c8833 100644
--- a/src/shared/AtomReader.cpp
+++ b/src/shared/AtomReader.cpp
@@ -45,37 +45,49 @@ AtomReader::write(const LV2_Atom* msg)
const LV2_Atom* subject = NULL;
lv2_object_get(obj, (LV2_URID)_uris.patch_subject, &subject, NULL);
- const char* subject_uri = subject ? (const char*)LV2_ATOM_BODY(subject) : NULL;
+ const char* subject_uri = NULL;
+ if (subject && subject->type == _uris.atom_URI) {
+ subject_uri = (const char*)LV2_ATOM_BODY(subject);
+ } else if (subject && subject->type == _uris.atom_URID) {
+ subject_uri = _map.unmap_uri(((LV2_Atom_URID*)subject)->body);
+ }
+
if (obj->body.otype == _uris.patch_Get) {
- Raul::warn << "ATOM GET " << subject_uri << std::endl;
- _iface.set_response_id(1);
+ _iface.set_response_id(obj->body.id);
_iface.get(subject_uri);
} else if (obj->body.otype == _uris.patch_Put) {
- Raul::warn << "PUT" << std::endl;
const LV2_Atom_Object* body = NULL;
lv2_object_get(obj, (LV2_URID)_uris.patch_body, &body, 0);
if (!body) {
- Raul::warn << "NO BODY" << std::endl;
+ Raul::warn << "Put message has no body" << std::endl;
return;
}
Ingen::Resource::Properties props;
LV2_OBJECT_FOREACH(body, i) {
LV2_Atom_Property_Body* p = lv2_object_iter_get(i);
- props.insert(std::make_pair(_map.unmap_uri(p->key),
- _forge.alloc(p->value.size,
- p->value.type,
- LV2_ATOM_BODY(&p->value))));
+ Raul::Atom val;
+ if (p->value.type == _uris.atom_URID) {
+ const LV2_Atom_URID* urid = (const LV2_Atom_URID*)&p->value;
+ val = _forge.alloc_uri(_map.unmap_uri(urid->body));
+ } else {
+ val = _forge.alloc(p->value.size,
+ p->value.type,
+ LV2_ATOM_BODY(&p->value));
+ }
+
+ props.insert(std::make_pair(_map.unmap_uri(p->key), val));
}
if (subject_uri) {
+ _iface.set_response_id(obj->body.id);
_iface.put(subject_uri, props);
} else {
Raul::warn << "Put message has no subject, ignored" << std::endl;
}
} else {
- Raul::warn << "HANDLE MESSAGE TYPE " << obj->body.otype << std::endl;
+ Raul::warn << "Unknown object type " << obj->body.otype << std::endl;
}
}