root/branches/streaming-rework/src/libieee1394/configrom.cpp

Revision 435, 19.6 kB (checked in by pieterpalmers, 14 years ago)

src/devicemanager:
- start OSC server for the device manager

src/devicemanager,
src/iavdevice,
src/libieee1394/configrom:
- inherit from OscNode? to become Osc'able

src/bounce,
src/libstreaming/AmdtpStreamProcessor,
src/libstreaming/AmdtpSlaveStreamProcessor:
- fixed bounce device implementation, now working

src/bebob:
- fixed midi bug

General:
- removed 'intermediate XML'
- removed obsolete tests
- removed obsolete files
- removed obsolete API calls

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1 /* configrom.cpp
2  * Copyright (C) 2005 by Daniel Wagner
3  *
4  * This file is part of FreeBoB.
5  *
6  * FreeBoB is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  * FreeBoB is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with FreeBoB; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
18  * MA 02111-1307 USA.
19  */
20
21 #include "configrom.h"
22 #include "ieee1394service.h"
23
24 #include <stdio.h>
25 #include <string.h>
26
27 #include <iostream>
28 #include <iomanip>
29
30 using namespace std;
31
32 IMPL_DEBUG_MODULE( ConfigRom, ConfigRom, DEBUG_LEVEL_NORMAL );
33
34 static int busRead( struct csr1212_csr* csr,
35                     u_int64_t addr,
36                     u_int16_t length,
37                     void* buffer,
38                     void* private_data );
39
40 static int getMaxRom( u_int32_t* bus_info_data,
41                       void* private_data );
42
43 static struct csr1212_bus_ops configrom_csr1212_ops = {
44     busRead,
45     0,
46     0,
47     getMaxRom
48 };
49
50 struct config_csr_info {
51     Ieee1394Service* service;
52     fb_nodeid_t      nodeId;
53 };
54
55 //-------------------------------------------------------------
56
57 ConfigRom::ConfigRom( Ieee1394Service& ieee1394service, fb_nodeid_t nodeId )
58     : OscNode("ConfigRom")
59     , m_1394Service( &ieee1394service )
60     , m_nodeId( nodeId )
61     , m_avcDevice( false )
62     , m_guid( 0 )
63     , m_vendorName( "" )
64     , m_modelName( "" )
65     , m_vendorId( 0 )
66     , m_modelId( 0 )
67     , m_unit_specifier_id( 0 )
68     , m_unit_version( 0 )
69     , m_isIsoResourceManager( false )
70     , m_isCycleMasterCapable( false )
71     , m_isSupportIsoOperations( false )
72     , m_isBusManagerCapable( false )
73     , m_cycleClkAcc( 0 )
74     , m_maxRec( 0 )
75     , m_nodeVendorId( 0 )
76     , m_chipIdHi( 0 )
77     , m_chipIdLow( 0 )
78     , m_vendorNameKv( 0 )
79     , m_modelNameKv( 0 )
80     , m_csr( 0 )
81 {
82 }
83
84 ConfigRom::ConfigRom()
85     : OscNode("ConfigRom")
86     , m_1394Service( 0 )
87     , m_nodeId( -1 )
88     , m_avcDevice( false )
89     , m_guid( 0 )
90     , m_vendorName( "" )
91     , m_modelName( "" )
92     , m_vendorId( 0 )
93     , m_modelId( 0 )
94     , m_unit_specifier_id( 0 )
95     , m_unit_version( 0 )
96     , m_isIsoResourceManager( false )
97     , m_isCycleMasterCapable( false )
98     , m_isSupportIsoOperations( false )
99     , m_isBusManagerCapable( false )
100     , m_cycleClkAcc( 0 )
101     , m_maxRec( 0 )
102     , m_nodeVendorId( 0 )
103     , m_chipIdHi( 0 )
104     , m_chipIdLow( 0 )
105     , m_vendorNameKv( 0 )
106     , m_modelNameKv( 0 )
107     , m_csr( 0 )
108 {
109 }
110
111 ConfigRom::~ConfigRom()
112 {
113 }
114
115 bool
116 ConfigRom::operator == ( const ConfigRom& rhs )
117 {
118     return m_guid == rhs.m_guid;
119 }
120
121 bool
122 ConfigRom::initialize()
123 {
124      struct config_csr_info csr_info;
125      csr_info.service = m_1394Service;
126      csr_info.nodeId = 0xffc0 | m_nodeId;
127
128      m_csr = csr1212_create_csr( &configrom_csr1212_ops,
129                                  5 * sizeof(fb_quadlet_t),   // XXX Why 5 ?!?
130                                  &csr_info );
131     if (!m_csr || csr1212_parse_csr( m_csr ) != CSR1212_SUCCESS) {
132         debugError( "Could not parse config rom of node %d on port %d\n", m_nodeId, m_1394Service->getPort() );
133         if (m_csr) {
134             csr1212_destroy_csr(m_csr);
135             m_csr = 0;
136         }
137         return false;
138     }
139
140     // Process Bus_Info_Block
141     m_isIsoResourceManager = CSR1212_BE32_TO_CPU(m_csr->bus_info_data[2] ) >> 31;
142     m_isCycleMasterCapable = ( CSR1212_BE32_TO_CPU(m_csr->bus_info_data[2] ) >> 30 ) & 0x1;
143     m_isSupportIsoOperations = ( CSR1212_BE32_TO_CPU(m_csr->bus_info_data[2] ) >> 29 ) & 0x1;
144     m_isBusManagerCapable = ( CSR1212_BE32_TO_CPU(m_csr->bus_info_data[2] ) >> 28 ) & 0x1;
145     m_cycleClkAcc = ( CSR1212_BE32_TO_CPU(m_csr->bus_info_data[2] ) >> 16 ) & 0xff;
146     m_maxRec = ( CSR1212_BE32_TO_CPU( m_csr->bus_info_data[2] ) >> 12 ) & 0xf;
147     m_nodeVendorId = ( CSR1212_BE32_TO_CPU( m_csr->bus_info_data[3] ) >> 8 );
148     m_chipIdHi = ( CSR1212_BE32_TO_CPU( m_csr->bus_info_data[3] ) ) & 0xff;
149     m_chipIdLow = CSR1212_BE32_TO_CPU( m_csr->bus_info_data[4] );
150
151     // Process Root Directory
152     processRootDirectory(m_csr);
153
154     if ( m_vendorNameKv ) {
155         int len = ( m_vendorNameKv->value.leaf.len - 2) * sizeof( quadlet_t );
156         char* buf = new char[len+2];
157         memcpy( buf,
158                 ( void* )CSR1212_TEXTUAL_DESCRIPTOR_LEAF_DATA( m_vendorNameKv ),
159                 len );
160
161         while ((buf + len - 1) == '\0') {
162             len--;
163         }
164         // \todo XXX seems a bit strage to do this but the nodemgr.c code does
165         // it. try to figure out why this is needed (or not)
166         buf[len++] = ' ';
167         buf[len] = '\0';
168
169
170         debugOutput( DEBUG_LEVEL_VERBOSE, "Vendor name: '%s'\n", buf );
171         m_vendorName = buf;
172         delete[] buf;
173     }
174     if ( m_modelNameKv ) {
175         int len = ( m_modelNameKv->value.leaf.len - 2) * sizeof( quadlet_t );
176         char* buf = new char[len+2];
177         memcpy( buf,
178                 ( void* )CSR1212_TEXTUAL_DESCRIPTOR_LEAF_DATA( m_modelNameKv ),
179                 len );
180         while ((buf + len - 1) == '\0') {
181             len--;
182         }
183         // \todo XXX for edirol fa-66 it seems somehow broken. see above
184         // todo as well.
185         buf[len++] = ' ';
186         buf[len] = '\0';
187
188         debugOutput( DEBUG_LEVEL_VERBOSE, "Model name: '%s'\n", buf);
189         m_modelName = buf;
190         delete[] buf;
191     }
192
193     m_guid = ((u_int64_t)CSR1212_BE32_TO_CPU(m_csr->bus_info_data[3]) << 32)
194              | CSR1212_BE32_TO_CPU(m_csr->bus_info_data[4]);
195
196     if ( m_vendorNameKv ) {
197         csr1212_release_keyval( m_vendorNameKv );
198         m_vendorNameKv = 0;
199     }
200     if ( m_modelNameKv ) {
201         csr1212_release_keyval( m_modelNameKv );
202         m_modelNameKv = 0;
203     }
204     if ( m_csr ) {
205         csr1212_destroy_csr(m_csr);
206         m_csr = 0;
207     }
208     return true;
209 }
210
211 static int
212 busRead( struct csr1212_csr* csr,
213          u_int64_t addr,
214          u_int16_t length,
215          void* buffer,
216          void* private_data )
217 {
218     struct config_csr_info* csr_info = (struct config_csr_info*) private_data;
219    
220     if ( !csr_info->service->read( csr_info->nodeId,
221                                    addr,
222                                    (size_t)length/4,
223                                    ( quadlet_t* )buffer) )
224     {
225         //debugOutput( DEBUG_LEVEL_VERBOSE, "ConfigRom: Read failed\n");
226         return -1;
227     }
228
229     return 0;
230 }
231
232 static int
233 getMaxRom( u_int32_t* bus_info_data,
234            void* /*private_data*/)
235 {
236     return (CSR1212_BE32_TO_CPU( bus_info_data[2] ) >> 8) & 0x3;
237 }
238
239
240 void
241 ConfigRom::processUnitDirectory( struct csr1212_csr* csr,
242                                  struct csr1212_keyval* ud_kv,
243                                  unsigned int *id )
244 {
245     struct csr1212_dentry *dentry;
246     struct csr1212_keyval *kv;
247     unsigned int last_key_id = 0;
248
249     debugOutput( DEBUG_LEVEL_VERBOSE, "process unit directory:\n" );
250     csr1212_for_each_dir_entry(csr, kv, ud_kv, dentry) {
251         switch (kv->key.id) {
252             case CSR1212_KV_ID_VENDOR:
253                 if (kv->key.type == CSR1212_KV_TYPE_IMMEDIATE) {
254                     debugOutput( DEBUG_LEVEL_VERBOSE,
255                                  "\tvendor_id = 0x%08x\n",
256                                  kv->value.immediate);
257                     m_vendorId = kv->value.immediate;
258                 }
259                 break;
260
261             case CSR1212_KV_ID_MODEL:
262                 debugOutput( DEBUG_LEVEL_VERBOSE,
263                              "\tmodel_id = 0x%08x\n",
264                              kv->value.immediate);
265                 m_modelId = kv->value.immediate;
266                 break;
267
268             case CSR1212_KV_ID_SPECIFIER_ID:
269                 debugOutput( DEBUG_LEVEL_VERBOSE,
270                              "\tspecifier_id = 0x%08x\n",
271                              kv->value.immediate);
272                 m_unit_specifier_id = kv->value.immediate;
273                 break;
274
275             case CSR1212_KV_ID_VERSION:
276                 debugOutput( DEBUG_LEVEL_VERBOSE,
277                              "\tversion = 0x%08x\n",
278                              kv->value.immediate);
279                 m_unit_version = kv->value.immediate;
280                 if ( m_unit_specifier_id == 0x0000a02d ) // XXX
281                 {
282                     if ( kv->value.immediate == 0x10001 ) {
283                         m_avcDevice = true;
284                     }
285                 }
286                 break;
287
288             case CSR1212_KV_ID_DESCRIPTOR:
289                 if (kv->key.type == CSR1212_KV_TYPE_LEAF &&
290                     CSR1212_DESCRIPTOR_LEAF_TYPE(kv) == 0 &&
291                     CSR1212_DESCRIPTOR_LEAF_SPECIFIER_ID(kv) == 0 &&
292                     CSR1212_TEXTUAL_DESCRIPTOR_LEAF_WIDTH(kv) == 0 &&
293                     CSR1212_TEXTUAL_DESCRIPTOR_LEAF_CHAR_SET(kv) == 0 &&
294                     CSR1212_TEXTUAL_DESCRIPTOR_LEAF_LANGUAGE(kv) == 0)
295                 {
296                     switch (last_key_id) {
297                         case CSR1212_KV_ID_VENDOR:
298                             csr1212_keep_keyval(kv);
299                             m_vendorNameKv = kv;
300                             break;
301
302                         case CSR1212_KV_ID_MODEL:
303                             m_modelNameKv = kv;
304                             csr1212_keep_keyval(kv);
305                             break;
306
307                     }
308                 } /* else if (kv->key.type == CSR1212_KV_TYPE_DIRECTORY) ... */
309                 break;
310
311             case CSR1212_KV_ID_DEPENDENT_INFO:
312                 if (kv->key.type == CSR1212_KV_TYPE_DIRECTORY) {
313                     /* This should really be done in SBP2 as this is
314                      * doing SBP2 specific parsing. */
315                     processUnitDirectory(csr, kv, id);
316                 }
317
318                 break;
319
320             default:
321                 break;
322         }
323         last_key_id = kv->key.id;
324     }
325 }
326
327 void
328 ConfigRom::processRootDirectory(struct csr1212_csr* csr)
329 {
330     unsigned int ud_id = 0;
331     struct csr1212_dentry *dentry;
332     struct csr1212_keyval *kv;
333     unsigned int last_key_id = 0;
334
335     csr1212_for_each_dir_entry(csr, kv, csr->root_kv, dentry) {
336         switch (kv->key.id) {
337             case CSR1212_KV_ID_VENDOR:
338                 debugOutput( DEBUG_LEVEL_VERBOSE,
339                              "vendor id = 0x%08x\n", kv->value.immediate);
340                 break;
341
342             case CSR1212_KV_ID_NODE_CAPABILITIES:
343                 debugOutput( DEBUG_LEVEL_VERBOSE,
344                              "capabilities = 0x%08x\n", kv->value.immediate);
345                 break;
346
347             case CSR1212_KV_ID_UNIT:
348                 processUnitDirectory(csr, kv, &ud_id);
349                 break;
350
351             case CSR1212_KV_ID_DESCRIPTOR:
352                 if (last_key_id == CSR1212_KV_ID_VENDOR) {
353                     if (kv->key.type == CSR1212_KV_TYPE_LEAF &&
354                         CSR1212_DESCRIPTOR_LEAF_TYPE(kv) == 0 &&
355                         CSR1212_DESCRIPTOR_LEAF_SPECIFIER_ID(kv) == 0 &&
356                         CSR1212_TEXTUAL_DESCRIPTOR_LEAF_WIDTH(kv) == 0 &&
357                         CSR1212_TEXTUAL_DESCRIPTOR_LEAF_CHAR_SET(kv) == 0 &&
358                         CSR1212_TEXTUAL_DESCRIPTOR_LEAF_LANGUAGE(kv) == 0)
359                     {
360                         m_vendorNameKv = kv;
361                         csr1212_keep_keyval(kv);
362                     }
363                 }
364                 break;
365         }
366         last_key_id = kv->key.id;
367     }
368
369 }
370
371 const fb_nodeid_t
372 ConfigRom::getNodeId() const
373 {
374     return m_nodeId;
375 }
376
377 const fb_octlet_t
378 ConfigRom::getGuid() const
379 {
380     return m_guid;
381 }
382
383 const Glib::ustring
384 ConfigRom::getModelName() const
385 {
386     return m_modelName;
387 }
388
389 const Glib::ustring
390 ConfigRom::getVendorName() const
391 {
392     return m_vendorName;
393 }
394
395 const unsigned int
396 ConfigRom::getModelId() const
397 {
398     return m_modelId;
399 }
400
401 const unsigned int
402 ConfigRom::getVendorId() const
403 {
404     return m_vendorId;
405 }
406
407 const unsigned int
408 ConfigRom::getUnitSpecifierId() const
409 {
410     return m_unit_specifier_id;
411 }
412
413 const unsigned int
414 ConfigRom::getUnitVersion() const
415 {
416     return m_unit_version;
417 }
418
419 bool
420 ConfigRom::updatedNodeId()
421 {
422     struct csr1212_csr* csr = 0;
423     for ( fb_nodeid_t nodeId = 0;
424           nodeId < m_1394Service->getNodeCount();
425           ++nodeId )
426     {
427         struct config_csr_info csr_info;
428         csr_info.service = m_1394Service;
429         csr_info.nodeId = 0xffc0 | nodeId;
430
431         csr = csr1212_create_csr( &configrom_csr1212_ops,
432                                   5 * sizeof(fb_quadlet_t),   // XXX Why 5 ?!?
433                                   &csr_info );
434
435         if (!csr || csr1212_parse_csr( csr ) != CSR1212_SUCCESS) {
436             if (csr) {
437                 csr1212_destroy_csr(csr);
438             }
439             continue;
440         }
441
442
443         octlet_t guid =
444             ((u_int64_t)CSR1212_BE32_TO_CPU(csr->bus_info_data[3]) << 32)
445             | CSR1212_BE32_TO_CPU(csr->bus_info_data[4]);
446
447         if ( guid == getGuid() ) {
448             if ( nodeId != getNodeId() ) {
449                 debugOutput( DEBUG_LEVEL_VERBOSE,
450                              "Device with GUID 0x%08x%08x changed node id "
451                              "from %d to %d\n",
452                              ( unsigned int ) ( getGuid() >> 32 ),
453                              ( unsigned int ) ( getGuid() & 0xffffffff ),
454                              getNodeId(),
455                              nodeId );
456                 m_nodeId = nodeId;
457             }
458             if (csr) {
459                 csr1212_destroy_csr(csr);
460             }
461             return true;
462         }
463     }
464
465     if (csr) {
466         csr1212_destroy_csr(csr);
467     }
468
469     debugOutput( DEBUG_LEVEL_NORMAL,
470                  "Device with GUID 0x%08x%08x could not be found on "
471                  "the bus anymore (removed?)\n",
472                  m_guid >> 32,
473                  m_guid & 0xffffffff );
474     return false;
475 }
476
477 void
478 ConfigRom::printConfigRom() const
479 {
480     using namespace std;
481     printf( "Config ROM\n" );
482     printf( "\tCurrent Node Id:\t%d\n",       getNodeId() );
483     printf( "\tGUID:\t\t\t0x%08x%08x\n",
484             ( unsigned int )( getGuid() >> 32 ),
485             ( unsigned int ) ( getGuid() & 0xffffffff ) );
486     printf( "\tVendor Name:\t\t%s\n",         getVendorName().c_str() );
487     printf( "\tModel Name:\t\t%s\n",          getModelName().c_str() );
488     printf( "\tNode Vendor ID:\t\t0x%06x\n",  getNodeVendorId() );
489     printf( "\tModel Id:\t\t0x%08x\n",        getModelId() );
490     printf( "\tUnit Specifier ID:\t0x%06x\n",  getUnitSpecifierId() );
491     printf( "\tUnit version:\t\t0x%08x\n",        getUnitVersion() );
492     printf( "\tISO resource manager:\t%d\n",  isIsoResourseManager() );
493     printf( "\tCycle master capable:\t%d\n",  isSupportsIsoOperations() );
494     printf( "\tBus manager capable:\t%d\n",   isBusManagerCapable() );
495     printf( "\tCycle clock accuracy:\t%d\n", getCycleClockAccurancy() );
496     printf( "\tMax rec:\t\t%d (max asy payload: %d bytes)\n",
497             getMaxRec(), getAsyMaxPayload() );
498 }
499
500 unsigned short
501 ConfigRom::getAsyMaxPayload() const
502 {
503     // XXX use pow instead?
504     return 1 << ( m_maxRec + 1 );
505 }
506
507 bool
508 ConfigRom::serialize( Glib::ustring path, Util::IOSerialize& ser )
509 {
510     bool result;
511     result  = ser.write( path + "m_nodeId", m_nodeId );
512     result &= ser.write( path + "m_avcDevice",  m_avcDevice );
513     result &= ser.write( path + "m_guid", m_guid );
514     result &= ser.write( path + "m_vendorName", Glib::ustring( m_vendorName ) );
515     result &= ser.write( path + "m_modelName", Glib::ustring( m_modelName ) );
516     result &= ser.write( path + "m_vendorId", m_vendorId );
517     result &= ser.write( path + "m_modelId", m_modelId );
518     result &= ser.write( path + "m_unit_specifier_id", m_unit_specifier_id );
519     result &= ser.write( path + "m_unit_version",  m_unit_version );
520     result &= ser.write( path + "m_isIsoResourceManager", m_isIsoResourceManager );
521     result &= ser.write( path + "m_isCycleMasterCapable", m_isCycleMasterCapable );
522     result &= ser.write( path + "m_isSupportIsoOperations", m_isSupportIsoOperations );
523     result &= ser.write( path + "m_isBusManagerCapable", m_isBusManagerCapable );
524     result &= ser.write( path + "m_cycleClkAcc", m_cycleClkAcc );
525     result &= ser.write( path + "m_maxRec", m_maxRec );
526     result &= ser.write( path + "m_nodeVendorId", m_nodeVendorId );
527     result &= ser.write( path + "m_chipIdHi", m_chipIdHi );
528     result &= ser.write( path + "m_chipIdLow", m_chipIdLow );
529     return result;
530 }
531
532 ConfigRom*
533 ConfigRom::deserialize( Glib::ustring path, Util::IODeserialize& deser, Ieee1394Service& ieee1394Service )
534 {
535     ConfigRom* pConfigRom = new ConfigRom;
536     if ( !pConfigRom ) {
537         return 0;
538     }
539
540     pConfigRom->m_1394Service = &ieee1394Service;
541
542     bool result;
543     result  = deser.read( path + "m_nodeId", pConfigRom->m_nodeId );
544     result &= deser.read( path + "m_avcDevice", pConfigRom->m_avcDevice );
545     result &= deser.read( path + "m_guid", pConfigRom->m_guid );
546     result &= deser.read( path + "m_vendorName", pConfigRom->m_vendorName );
547     result &= deser.read( path + "m_modelName", pConfigRom->m_modelName );
548     result &= deser.read( path + "m_vendorId", pConfigRom->m_vendorId );
549     result &= deser.read( path + "m_modelId", pConfigRom->m_modelId );
550     result &= deser.read( path + "m_unit_specifier_id", pConfigRom->m_unit_specifier_id );
551     result &= deser.read( path + "m_unit_version", pConfigRom->m_unit_version );
552     result &= deser.read( path + "m_isIsoResourceManager", pConfigRom->m_isIsoResourceManager );
553     result &= deser.read( path + "m_isCycleMasterCapable", pConfigRom->m_isCycleMasterCapable );
554     result &= deser.read( path + "m_isSupportIsoOperations", pConfigRom->m_isSupportIsoOperations );
555     result &= deser.read( path + "m_isBusManagerCapable", pConfigRom->m_isBusManagerCapable );
556     result &= deser.read( path + "m_cycleClkAcc", pConfigRom->m_cycleClkAcc );
557     result &= deser.read( path + "m_maxRec", pConfigRom->m_maxRec );
558     result &= deser.read( path + "m_nodeVendorId", pConfigRom->m_nodeVendorId );
559     result &= deser.read( path + "m_chipIdHi", pConfigRom->m_chipIdHi );
560     result &= deser.read( path + "m_chipIdLow", pConfigRom->m_chipIdLow );
561
562     if ( !result ) {
563         delete pConfigRom;
564         return 0;
565     }
566
567     return pConfigRom;
568 }
569
570 bool
571 ConfigRom::setNodeId( fb_nodeid_t nodeId )
572 {
573     m_nodeId = nodeId;
574     return true;
575 }
576
577 OSC::OscResponse
578 ConfigRom::processOscMessage(OSC::OscMessage *m) {
579     OSC::OscResponse r=OSC::OscResponse(OSC::OscResponse::eUnhandled);
580    
581     unsigned int nbArgs=m->nbArguments();
582     if (nbArgs>=1) {
583         OSC::OscArgument arg0=m->getArgument(0);
584         if(arg0.isString()) { // commands
585             string cmd=arg0.getString();
586            
587             debugOutput( DEBUG_LEVEL_VERBOSE, "(%p) CMD? %s\n", this, cmd.c_str());
588             if(cmd == "params") {
589                 debugOutput( DEBUG_LEVEL_VERBOSE, "Listing node children...\n");
590                 OSC::OscMessage& rm=r.getMessage();
591                 rm.addArgument("GUID");
592                 rm.addArgument("VendorName");
593                 rm.addArgument("ModelName");
594                 r.setType(OSC::OscResponse::eMessage);
595             }
596             if(cmd == "get") {
597                 if(nbArgs != 2) {
598                     debugError("Erronous get command received, wrong nb of arguments\n");
599                     m->print();
600                 } else {
601                     OSC::OscArgument arg1=m->getArgument(1);
602                     if(arg1.isString()) { // commands
603                         string target=arg1.getString();
604                         OSC::OscMessage& rm=r.getMessage();
605                         if(target == "GUID") {
606                             // FIXME: this will only return the lower 32 bits
607                             rm.addArgument((int64_t)getGuid());
608                         } else if(target == "VendorName") {
609                             rm.addArgument(getVendorName());
610                         } else if(target == "ModelName") {
611                             rm.addArgument(getModelName());
612                         } else {
613                             debugError("Erronous get command received, non-existant target\n");
614                             m->print();
615                         }
616                         r.setType(OSC::OscResponse::eMessage);
617                     } else {
618                         debugError("Erronous get command received, wrong argument type\n");
619                         m->print();
620                     }
621                 }
622             }
623         }
624     }
625    
626     return r;
627
628 }
Note: See TracBrowser for help on using the browser.