1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678
|
// NOLINTBEGIN(*)
#include <tango/tango.h>
#include "DevTest.h"
#include "DevTestClass.h"
#include "TypeCmds.h"
#include "SigThrow.h"
#include "IOMisc.h"
#include "IOStr1.h"
#include "IOStr2.h"
#include "IOArray1.h"
#include "IOArray2.h"
#include "IOStrArray.h"
#include "IOStruct.h"
#include "IOSeqVec.h"
#include "IOSetAttr.h"
#include "IOAddAttribute.h"
DevTestClass *DevTestClass::_instance = NULL;
//+----------------------------------------------------------------------------
//
// method : DevTestClass::DevTestClass()
//
// description : constructor for the DevTestClass
//
// in : - s : The class name
//
//-----------------------------------------------------------------------------
DevTestClass::DevTestClass(std::string &s) :
Tango::DeviceClass(s)
{
TANGO_LOG_INFO << "Entering DevTestClass constructor" << std::endl;
set_type("TestDevice");
TANGO_LOG_INFO << "Leaving DevTestClass constructor" << std::endl;
}
//+----------------------------------------------------------------------------
//
// method : DevTestClass::instance
//
// description : Create the object if not already done. Otherwise, just
// return a pointer to the object
//
// in : - name : The class name
//
//-----------------------------------------------------------------------------
DevTestClass *DevTestClass::init(const char *name)
{
if(_instance == NULL)
{
try
{
std::string s(name);
_instance = new DevTestClass(s);
}
catch(std::bad_alloc &)
{
throw;
}
}
return _instance;
}
DevTestClass *DevTestClass::instance()
{
if(_instance == NULL)
{
std::cerr << "Class is not initialised !!" << std::endl;
exit(-1);
}
return _instance;
}
//+----------------------------------------------------------------------------
//
// method : DevTestClass::command_factory
//
// description : Create the command object(s) and store them in the
// command list
//
//-----------------------------------------------------------------------------
void DevTestClass::command_factory()
{
command_list.push_back(
new IOString("IOString", Tango::DEV_STRING, Tango::DEV_STRING, "Word", "the pallindrome is"));
command_list.push_back(new IOBool("IOBool", Tango::DEV_BOOLEAN, Tango::DEV_BOOLEAN, "Number", "Not number"));
command_list.push_back(new IOShort("IOShort", Tango::DEV_SHORT, Tango::DEV_SHORT, "Number", "Number * 2"));
command_list.push_back(new IOLong("IOLong", Tango::DEV_LONG, Tango::DEV_LONG, "Number", "Number * 2"));
command_list.push_back(new IOFloat("IOFloat", Tango::DEV_FLOAT, Tango::DEV_FLOAT, "Number", "Number * 2"));
command_list.push_back(new IODouble("IODouble", Tango::DEV_DOUBLE, Tango::DEV_DOUBLE, "Number", "Number * 2"));
command_list.push_back(new IOUShort("IOUShort", Tango::DEV_USHORT, Tango::DEV_USHORT, "Number", "Number * 2"));
command_list.push_back(new IOULong("IOULong", Tango::DEV_ULONG, Tango::DEV_ULONG, "Number", "Number * 2"));
command_list.push_back(new IOBooleanArray(
"IOBoolArray", Tango::DEVVAR_BOOLEANARRAY, Tango::DEVVAR_BOOLEANARRAY, "Array of boolean", "Echo"));
command_list.push_back(new IOCharArray(
"IOCharArray", Tango::DEVVAR_CHARARRAY, Tango::DEVVAR_CHARARRAY, "Array of char", "This reversed array"));
command_list.push_back(new IOShortArray(
"IOShortArray", Tango::DEVVAR_SHORTARRAY, Tango::DEVVAR_SHORTARRAY, "Array of short", "This array * 2"));
command_list.push_back(new IOLongArray(
"IOLongArray", Tango::DEVVAR_LONGARRAY, Tango::DEVVAR_LONGARRAY, "Array of long", "This array * 2"));
command_list.push_back(new IOFloatArray(
"IOFloatArray", Tango::DEVVAR_FLOATARRAY, Tango::DEVVAR_FLOATARRAY, "Array of float", "This array * 2"));
command_list.push_back(new IODoubleArray(
"IODoubleArray", Tango::DEVVAR_DOUBLEARRAY, Tango::DEVVAR_DOUBLEARRAY, "Array of double", "This array * 2"));
command_list.push_back(new IOUShortArray("IOUShortArray",
Tango::DEVVAR_USHORTARRAY,
Tango::DEVVAR_USHORTARRAY,
"Array of unsigned short",
"This array * 2"));
command_list.push_back(new IOULongArray("IOULongArray",
Tango::DEVVAR_ULONGARRAY,
Tango::DEVVAR_ULONGARRAY,
"Array of unsigned long",
"This array * 2"));
command_list.push_back(new IOStringArray("IOStringArray",
Tango::DEVVAR_STRINGARRAY,
Tango::DEVVAR_STRINGARRAY,
"Array of string",
"This reversed array "));
command_list.push_back(new IOLongString("IOLongString",
Tango::DEVVAR_LONGSTRINGARRAY,
Tango::DEVVAR_LONGSTRINGARRAY,
"Array of long and string",
"This array of long * 2"));
command_list.push_back(new IODoubleString("IODoubleString",
Tango::DEVVAR_DOUBLESTRINGARRAY,
Tango::DEVVAR_DOUBLESTRINGARRAY,
"Array of double and string",
"This array of long * 2"));
command_list.push_back(
new IOThrow("IOThrow", Tango::DEVVAR_LONGSTRINGARRAY, Tango::DEV_VOID, "Error facility", "An exception"));
command_list.push_back(
new IOReThrow("IOReThrow", Tango::DEVVAR_LONGSTRINGARRAY, Tango::DEV_VOID, "Error facility", "An exception"));
command_list.push_back(new IOExcept("IOExcept", Tango::DEV_VOID, Tango::DEV_VOID, "Void", "An exception"));
command_list.push_back(new IOVoid("IOVoid", Tango::DEV_VOID, Tango::DEV_VOID, "void", "void"));
command_list.push_back(new IOSleep("IOSleep", Tango::DEV_USHORT, Tango::DEV_VOID, "sleeping time", "void"));
command_list.push_back(new IOState("IOState", Tango::DEV_STATE, Tango::DEV_VOID, "New device state", "void"));
command_list.push_back(new IORegSig("IORegSig", Tango::DEV_LONG, Tango::DEV_VOID, "Signal number", "void"));
command_list.push_back(new IORegSigOwn("IORegSigOwn", Tango::DEV_LONG, Tango::DEV_VOID, "Signal number", "void"));
command_list.push_back(new IOUnregSig("IOUnregSig", Tango::DEV_LONG, Tango::DEV_VOID, "Signal number", "void"));
command_list.push_back(
new IORegClassSig("IORegClassSig", Tango::DEV_LONG, Tango::DEV_VOID, "Signal number", "void"));
command_list.push_back(
new IOUnregClassSig("IOUnregClassSig", Tango::DEV_LONG, Tango::DEV_VOID, "Signal number", "void"));
command_list.push_back(
new IOStr1("IOStr1", Tango::DEV_VOID, Tango::DEV_STRING, "void", "Just a string dynamically allocated"));
command_list.push_back(new IOPollStr1("IOPollStr1",
Tango::DEV_VOID,
Tango::DEV_STRING,
"void",
"Just a string dynamically allocated changing at each call"));
command_list.push_back(new IOStr2("IOStr2", Tango::DEV_VOID, Tango::DEV_STRING, "void", "A constant string"));
command_list.push_back(
new IOArray1("IOArray1", Tango::DEV_VOID, Tango::DEVVAR_LONGARRAY, "void", "An array allocated"));
command_list.push_back(
new IOArray2("IOArray2", Tango::DEV_VOID, Tango::DEVVAR_SHORTARRAY, "void", "An array without copying"));
command_list.push_back(new IOPollArray2("IOPollArray2",
Tango::DEV_VOID,
Tango::DEVVAR_SHORTARRAY,
"void",
"An array without copying changing at each call"));
command_list.push_back(
new IOStrArray("IOStrArray", Tango::DEV_VOID, Tango::DEVVAR_STRINGARRAY, "void", "A string array"));
command_list.push_back(
new IOStruct("IOStruct", Tango::DEV_VOID, Tango::DEVVAR_LONGSTRINGARRAY, "void", "A structure type"));
command_list.push_back(new IODevListByClass(
"IODevListByClass", Tango::DEV_STRING, Tango::DEV_STRING, "class name", "class first device name"));
command_list.push_back(new IODevByName(
"IODevByName", Tango::DEV_STRING, Tango::DEV_STRING, "device name", "device name (returned by name()"));
command_list.push_back(
new IODServDevice("IODServDevice", Tango::DEV_VOID, Tango::DEV_STRING, "void", "dserver device name"));
command_list.push_back(new IOSetAttr("IOSetAttr", Tango::DEV_LONG, Tango::DEV_VOID, "New attr value", "void"));
command_list.push_back(
new IOAddAttribute("IOAddAttribute", Tango::DEV_STRING, Tango::DEV_VOID, "New attribute name", "void"));
command_list.push_back(
new IORemoveAttribute("IORemoveAttribute", Tango::DEV_STRING, Tango::DEV_VOID, "Attribute name", "void"));
command_list.push_back(new IOSeqVecChar(
"IOSeqVecChar", Tango::DEVVAR_CHARARRAY, Tango::DEVVAR_CHARARRAY, "Input char array", "Output char array"));
command_list.push_back(new IOSeqVecShort("IOSeqVecShort",
Tango::DEVVAR_SHORTARRAY,
Tango::DEVVAR_SHORTARRAY,
"Input short array",
"Output short array"));
command_list.push_back(new IOSeqVecLong(
"IOSeqVecLong", Tango::DEVVAR_LONGARRAY, Tango::DEVVAR_LONGARRAY, "Input long array", "Output long array"));
command_list.push_back(new IOSeqVecFloat("IOSeqVecFloat",
Tango::DEVVAR_FLOATARRAY,
Tango::DEVVAR_FLOATARRAY,
"Input float array",
"Output float array"));
command_list.push_back(new IOSeqVecDouble("IOSeqVecDouble",
Tango::DEVVAR_DOUBLEARRAY,
Tango::DEVVAR_DOUBLEARRAY,
"Input double array",
"Output double array"));
command_list.push_back(new IOSeqVecUShort("IOSeqVecUShort",
Tango::DEVVAR_USHORTARRAY,
Tango::DEVVAR_USHORTARRAY,
"Input unsigned short array",
"Output unsigned short array"));
command_list.push_back(new IOSeqVecULong("IOSeqVecULong",
Tango::DEVVAR_ULONGARRAY,
Tango::DEVVAR_ULONGARRAY,
"Input unsigned long array",
"Output unsigned long array"));
command_list.push_back(new IOSeqVecString("IOSeqVecString",
Tango::DEVVAR_STRINGARRAY,
Tango::DEVVAR_STRINGARRAY,
"Input string array",
"Output string array"));
command_list.push_back(
new IOStartPoll("IOStartPoll", Tango::DEV_VOID, Tango::DEV_LONG, "Void", "Constant number set to 11"));
// command_list.back()->set_polling_period(400);
command_list.push_back(new IOShortSleep("IOShortSleep",
Tango::DEVVAR_SHORTARRAY,
Tango::DEV_SHORT,
"Input short and sleeping time in sec",
"Output short (in * 2)"));
command_list.push_back(
new IOSleepExcept("IOSleepExcept", Tango::DEV_SHORT, Tango::DEV_VOID, "Sleep time (sec)", "An exception"));
command_list.push_back(new IOExit("IOExit", Tango::DEV_VOID, Tango::DEV_VOID, "void", "void"));
command_list.push_back(
new IOTrigPoll("IOTrigPoll", Tango::DEV_STRING, Tango::DEV_VOID, "Command's name to trig polling", "void"));
command_list.push_back(new IOAttrTrigPoll(
"IOAttrTrigPoll", Tango::DEV_STRING, Tango::DEV_VOID, "Attribute's name to trig polling", "void"));
command_list.push_back(new IOInitWAttr("IOInitWAttr", Tango::DEV_VOID, Tango::DEV_VOID, "void", "void"));
command_list.push_back(new IOInitRWAttr("IOInitRWAttr", Tango::DEV_VOID, Tango::DEV_VOID, "void", "void"));
command_list.push_back(new IOAttrThrowEx("IOAttrThrowEx",
Tango::DEVVAR_SHORTARRAY,
Tango::DEV_VOID,
"2 elts : Attr code and throw except flag",
"void"));
command_list.push_back(new IOAddOneElt("IOAddOneElt", Tango::DEV_VOID, Tango::DEV_VOID, "void", "void"));
command_list.push_back(new IORemoveOneElt("IORemoveOneElt", Tango::DEV_VOID, Tango::DEV_VOID, "void", "void"));
command_list.push_back(new IOIncValue("IOIncValue", Tango::DEV_VOID, Tango::DEV_VOID, "void", "void"));
command_list.push_back(new IODecValue("IODecValue", Tango::DEV_VOID, Tango::DEV_VOID, "void", "void"));
command_list.push_back(new IOChangeQuality(
"IOChangeQuality", Tango::DEV_SHORT, Tango::DEV_VOID, "0->VALID, 1->INVALID, 2->ALARM, 3->CHANGING", "void"));
command_list.push_back(new IOPushEvent("IOPushEvent", Tango::DEV_VOID, Tango::DEV_VOID, "void", "void"));
command_list.push_back(
new IOPushDevEncodedEvent("IOPushDevEncodedEvent", Tango::DEV_VOID, Tango::DEV_VOID, "void", "void"));
command_list.push_back(new IOSubscribeEvent("IOSubscribeEvent",
Tango::DEVVAR_STRINGARRAY,
Tango::DEV_LONG,
"str[0] = device name, str[1] = attribute name, str[2] = event type",
"Event identifier"));
command_list.push_back(
new IOUnSubscribeEvent("IOUnSubscribeEvent", Tango::DEV_LONG, Tango::DEV_VOID, "Event identifier", "void"));
command_list.push_back(new IOGetCbExecuted(
"IOGetCbExecuted", Tango::DEV_VOID, Tango::DEV_LONG, "void", "Number of times the CB has been executed"));
command_list.push_back(
new IOFillPollBuffAttr("IOFillPollBuffAttr", Tango::DEV_VOID, Tango::DEV_VOID, "void", "void"));
command_list.push_back(
new IOFillPollBuffEncodedAttr("IOFillPollBuffEncodedAttr", Tango::DEV_VOID, Tango::DEV_VOID, "void", "void"));
command_list.push_back(
new IOFillPollBuffCmd("IOFillPollBuffCmd", Tango::DEV_VOID, Tango::DEV_VOID, "void", "void"));
command_list.push_back(new OLong("OLong", Tango::DEV_VOID, Tango::DEV_LONG, "void", "A long"));
command_list.push_back(new OULong("OULong", Tango::DEV_VOID, Tango::DEV_ULONG, "void", "An unsigned long"));
command_list.push_back(
new OLongArray("OLongArray", Tango::DEV_VOID, Tango::DEVVAR_LONGARRAY, "void", "A long array"));
command_list.push_back(
new OULongArray("OULongArray", Tango::DEV_VOID, Tango::DEVVAR_ULONGARRAY, "void", "A unsigned long array"));
command_list.push_back(new OLongString(
"OLongString", Tango::DEV_VOID, Tango::DEVVAR_LONGSTRINGARRAY, "void", "A unsigned long and string array"));
command_list.push_back(new IOSetWAttrLimit("IOSetWAttrLimit",
Tango::DEVVAR_DOUBLEARRAY,
Tango::DEV_VOID,
"arr[0]==0 -> min_value, arr[0]==1 -> max_value, arr[1]=limit",
"void"));
command_list.push_back(new IOLong64("IOLong64", Tango::DEV_LONG64, Tango::DEV_LONG64, "Number", "Number * 2"));
command_list.push_back(new IOULong64("IOULong64", Tango::DEV_ULONG64, Tango::DEV_ULONG64, "Number", "Number * 2"));
command_list.push_back(
new ChangeEncodedFormat("ChangeEncodedFormat", Tango::DEV_VOID, Tango::DEV_VOID, "void", "void"));
command_list.push_back(
new ChangeEncodedData("ChangeEncodedData", Tango::DEV_VOID, Tango::DEV_VOID, "void", "void"));
command_list.push_back(new PushDataReady("PushDataReady",
Tango::DEVVAR_LONGSTRINGARRAY,
Tango::DEV_VOID,
"s[0] = attribute name, l[0] = user counter",
"void"));
command_list.push_back(
new SubDeviceTst("SubDeviceTst", Tango::DEV_VOID, Tango::DEV_BOOLEAN, "void", "true = sub device connected"));
command_list.push_back(new IOEncoded(
"IOEncoded", Tango::DEV_ENCODED, Tango::DEV_ENCODED, "DevEncoded structure", "DevEncoded structure"));
command_list.push_back(new OEncoded(
"OEncoded", Tango::DEV_VOID, Tango::DEV_ENCODED, "void", "DevEncoded structure to test polling/history"));
command_list.push_back(new PollingPoolTst(
"PollingPoolTst", Tango::DEV_VOID, Tango::DEVVAR_STRINGARRAY, "void", "Polling threads pool configuration"));
command_list.push_back(new SetGetAlarms("SetGetAlarms",
Tango::DEV_VOID,
Tango::DEVVAR_STRINGARRAY,
"void",
"DevVarStringArray containing alarm values"));
command_list.push_back(new SetGetRanges("SetGetRanges",
Tango::DEV_VOID,
Tango::DEVVAR_STRINGARRAY,
"void",
"DevVarStringArray containing ranges values"));
command_list.push_back(new SetGetProperties("SetGetProperties",
Tango::DEV_VOID,
Tango::DEVVAR_STRINGARRAY,
"void",
"DevVarStringArray containing properties values"));
command_list.push_back(new PollingInDeviceTst(
"IOPollingInDevice", Tango::DEV_VOID, Tango::DEVVAR_STRINGARRAY, "void", "Polling in device test outputs"));
command_list.push_back(
new SophisPollInDeviceTst("IOSophisticatedPollInDevice", Tango::DEV_VOID, Tango::DEV_VOID, "void", "void"));
command_list.push_back(new GetPollMess("IOGetPollMess",
Tango::DEV_VOID,
Tango::DEVVAR_STRINGARRAY,
"void",
"SophisticatedPollInDevice polling messages"));
command_list.push_back(new WriteAttrHardwareThrow("WriteAttrHardwareThrow",
Tango::DEV_SHORT,
Tango::DEV_VOID,
"Type of exception to be thrown by write_attr_hardware() method",
"void"));
command_list.push_back(new IOAddCommand(
"IOAddCommand", Tango::DEV_LONG, Tango::DEV_VOID, "True if command must be added at device level", "void"));
command_list.push_back(new IORemoveCommand("IORemoveCommand", Tango::DEV_VOID, Tango::DEV_VOID, "void", "void"));
command_list.push_back(new SetEnumLabels("SetEnumLabels", Tango::DEV_VOID, Tango::DEV_VOID, "void", "void"));
command_list.push_back(
new AddEnumLabel("AddEnumLabel", Tango::DEV_STRING, Tango::DEV_VOID, "New enum label", "void"));
command_list.push_back(new ForbiddenEnumValue(
"ForbiddenEnumValue", Tango::DEV_SHORT, Tango::DEV_VOID, "New value for setting enum (Must be > 100)", "void"));
command_list.push_back(
new SetPipeOutput("SetPipeOutput", Tango::DEV_SHORT, Tango::DEV_VOID, "Select RPipe output type", "void"));
command_list.push_back(
new PushPipeEvent("PushPipeEvent", Tango::DEV_SHORT, Tango::DEV_VOID, "Pipe data type", "void"));
command_list.push_back(
new PushStateStatusChangeEvent("PushStateStatusChangeEvent", Tango::DEV_VOID, Tango::DEV_VOID, "void", "void"));
command_list.push_back(
new Tango::TemplCommand((const char *) "IOTempl", static_cast<Tango::CmdMethPtr>(&DevTest::IOTempl)));
command_list.push_back(new Tango::TemplCommand((const char *) "IOTemplState",
static_cast<Tango::CmdMethPtr>(&DevTest::IOTempl),
static_cast<Tango::StateMethPtr>(&DevTest::templ_state)));
command_list.push_back(new Tango::TemplCommandIn<Tango::DevLong>(
(const char *) "IOTemplIn", static_cast<Tango::CmdMethPtr_Lg>(&DevTest::IOTemplIn)));
command_list.push_back(
new Tango::TemplCommandIn<Tango::DevLong>((const char *) "IOTemplInState",
static_cast<Tango::CmdMethPtr_Lg>(&DevTest::IOTemplIn),
static_cast<Tango::StateMethPtr>(&DevTest::templ_state)));
command_list.push_back(new Tango::TemplCommandOut<Tango::DevVarLongArray *>(
(const char *) "IOTemplOut", static_cast<Tango::LgA_CmdMethPtr>(&DevTest::IOTemplOut)));
command_list.push_back(
new Tango::TemplCommandOut<Tango::DevVarLongArray *>((const char *) "IOTemplOutState",
static_cast<Tango::LgA_CmdMethPtr>(&DevTest::IOTemplOut),
static_cast<Tango::StateMethPtr>(&DevTest::templ_state)));
command_list.push_back(new Tango::TemplCommandInOut<Tango::DevDouble, Tango::DevVarDoubleArray *>(
(const char *) "IOTemplInOut", static_cast<Tango::DbA_CmdMethPtr_Db>(&DevTest::IOTemplInOut)));
command_list.push_back(new Tango::TemplCommandInOut<Tango::DevDouble, Tango::DevVarDoubleArray *>(
(const char *) "IOTemplInOutState",
static_cast<Tango::DbA_CmdMethPtr_Db>(&DevTest::IOTemplInOut),
static_cast<Tango::StateMethPtr>(&DevTest::templ_state)));
command_list.push_back(
new GetEnumWriteValue("GetEnumWriteValue", Tango::DEV_VOID, Tango::DEV_SHORT, "void", "short"));
}
//+----------------------------------------------------------------------------
//
// method : DevTestClass::device_factory
//
// description : Create the device object(s) and store them in the
// device list
//
// in : Tango_DevVarStringArray *devlist_ptr :
// The device name list
//
//-----------------------------------------------------------------------------
void DevTestClass::device_factory(const Tango::DevVarStringArray *devlist_ptr)
{
for(unsigned long i = 0; i < devlist_ptr->length(); i++)
{
TANGO_LOG_DEBUG << "Device name : " << (*devlist_ptr)[i] << std::endl;
//
// Create device and add it into the device list
//
device_list.push_back(new DevTest(this, (*devlist_ptr)[i]));
//
// Export device to the outside world
//
if(Tango::Util::instance()->use_db() && !Tango::Util::instance()->use_file_db())
{
export_device(device_list.back());
}
else
{
export_device(device_list.back(), (*devlist_ptr)[i]);
}
}
}
void DevTestClass::device_name_factory(std::vector<std::string> &list_name)
{
list_name.push_back("The_first_device");
list_name.push_back("The_second_device");
}
void DevTestClass::signal_handler(long signo)
{
//
// With logging, we must attach a log message to a device
//
TANGO_LOG_INFO << "[Class signal handler] received signal number " << signo << " for class " << name << std::endl;
}
void DevTestClass::attribute_factory(std::vector<Tango::Attr *> &att_list)
{
att_list.push_back(new Short_attrAttr());
att_list.push_back(new Long_attrAttr());
att_list.back()->set_data_ready_event(true);
att_list.push_back(new Long64_attrAttr());
att_list.back()->set_data_ready_event(true);
att_list.push_back(new Double_attrAttr());
att_list.push_back(new String_attrAttr());
// att_list.back()->set_polling_period(250);
att_list.push_back(new Short_spec_attrAttr());
att_list.push_back(new Long_spec_attrAttr());
att_list.push_back(new Double_spec_attrAttr());
att_list.push_back(new String_spec_attrAttr());
att_list.push_back(new Short_ima_attrAttr());
att_list.push_back(new Long_ima_attrAttr());
att_list.push_back(new Double_ima_attrAttr());
att_list.push_back(new String_ima_attrAttr());
att_list.push_back(new attr_no_dataAttr());
att_list.push_back(new attr_wrong_typeAttr());
att_list.push_back(new attr_wrong_sizeAttr());
att_list.push_back(new attr_no_alarmAttr());
att_list.push_back(new Short_attr_with_wAttr());
att_list.push_back(new Short_attr_rwAttr());
att_list.push_back(new Short_attr_wAttr());
Tango::UserDefaultAttrProp def_prop;
def_prop.set_label("Test label");
def_prop.set_description("Test description");
def_prop.set_unit("Kilogramme");
def_prop.set_standard_unit("100");
def_prop.set_display_unit("Et ta soeur");
def_prop.set_format("Tres long");
def_prop.set_min_value("0");
def_prop.set_max_value("100000");
def_prop.set_min_alarm("1");
def_prop.set_max_alarm("99999");
def_prop.set_min_warning("2");
def_prop.set_max_warning("99998");
def_prop.set_delta_val("10000");
def_prop.set_delta_t("1");
def_prop.set_event_abs_change("30000");
def_prop.set_event_rel_change("20000");
def_prop.set_event_period("2000");
def_prop.set_archive_event_abs_change("33333");
def_prop.set_archive_event_rel_change("22222");
def_prop.set_archive_event_period("3000");
// Tango::Attr *at = new Tango::Attr("Long_attr_w", Tango::DEV_LONG, Tango::WRITE);
Tango::Attr *at = new Long_attr_wAttr();
at->set_default_properties(def_prop);
att_list.push_back(at);
att_list.push_back(new Double_attr_wAttr());
att_list.push_back(new String_attr_wAttr());
att_list.push_back(new attr_asynAttr());
att_list.push_back(new attr_asyn_toAttr());
att_list.push_back(new attr_asyn_exceptAttr());
att_list.push_back(new attr_asyn_writeAttr());
att_list.push_back(new attr_asyn_write_toAttr());
att_list.push_back(new attr_asyn_write_exceptAttr());
att_list.push_back(new PollLong_attrAttr());
att_list.push_back(new PollString_spec_attrAttr());
att_list.push_back(new attr_dq_shAttr());
att_list.push_back(new attr_dq_loAttr());
att_list.push_back(new attr_dq_dbAttr());
att_list.push_back(new attr_dq_strAttr());
Tango::UserDefaultAttrProp def_prop_1;
def_prop_1.set_max_value("100");
// Tango::SpectrumAttr *sat = new Tango::SpectrumAttr("Short_spec_attr_w", Tango::DEV_SHORT,Tango::WRITE, 4);
Tango::SpectrumAttr *sat = new Short_spec_attr_wAttr();
sat->set_default_properties(def_prop_1);
att_list.push_back(sat);
att_list.push_back(new Long_spec_attr_wAttr());
att_list.push_back(new Double_spec_attr_wAttr());
att_list.push_back(new String_spec_attr_wAttr());
att_list.push_back(new Short_ima_attr_wAttr());
att_list.push_back(new String_ima_attr_wAttr());
att_list.push_back(new Short_spec_attr_rwAttr());
att_list.push_back(new String_spec_attr_rwAttr());
att_list.push_back(new String_empty_spec_attr_rwAttr());
att_list.push_back(new Long_spec_attr_rwAttr());
att_list.push_back(new Short_ima_attr_rwAttr());
att_list.push_back(new String_ima_attr_rwAttr());
att_list.push_back(new Event_change_tstAttr());
att_list.push_back(new Event64_change_tstAttr());
att_list.push_back(new Event_quality_tstAttr());
att_list.push_back(new Long_attr_with_wAttr());
att_list.push_back(new Short_attr_w2Attr());
att_list.push_back(new String_attr_w2Attr());
att_list.push_back(new Poll_buffAttr());
att_list.push_back(new Poll_buffRWAttr());
att_list.push_back(new Float_attrAttr());
att_list.push_back(new Boolean_attrAttr());
att_list.push_back(new UShort_attrAttr());
att_list.push_back(new UChar_attrAttr());
att_list.push_back(new ULong_attrAttr());
att_list.push_back(new ULong64_attrAttr());
att_list.push_back(new Float_spec_attrAttr());
att_list.push_back(new Boolean_spec_attrAttr());
att_list.push_back(new UShort_spec_attrAttr());
att_list.push_back(new UChar_spec_attrAttr());
att_list.push_back(new Float_attr_wAttr());
att_list.push_back(new Boolean_attr_wAttr());
att_list.push_back(new UShort_attr_wAttr());
att_list.push_back(new UChar_attr_wAttr());
att_list.push_back(new Float_spec_attr_wAttr());
att_list.push_back(new Boolean_spec_attr_wAttr());
att_list.push_back(new UShort_spec_attr_wAttr());
att_list.push_back(new UChar_spec_attr_wAttr());
att_list.push_back(new Float_ima_attr_wAttr());
att_list.push_back(new UShort_ima_attr_wAttr());
att_list.push_back(new Float_spec_attr_rwAttr());
att_list.push_back(new UChar_spec_attr_rwAttr());
att_list.push_back(new Boolean_ima_attr_rwAttr());
att_list.push_back(new UShort_ima_attr_rwAttr());
att_list.push_back(new slow_actuatorAttr());
att_list.push_back(new fast_actuatorAttr());
att_list.push_back(new Long64_attr_rwAttr());
att_list.push_back(new ULong_attr_rwAttr());
att_list.push_back(new ULong64_attr_rwAttr());
att_list.push_back(new State_attr_rwAttr());
att_list.push_back(new String_attr_rwAttr());
att_list.push_back(new Long64_spec_attr_rwAttr());
att_list.push_back(new ULong_spec_attr_rwAttr());
att_list.push_back(new ULong64_spec_attr_rwAttr());
att_list.push_back(new State_spec_attr_rwAttr());
att_list.push_back(new Sub_device_tstAttr());
att_list.push_back(new SlowAttr());
#ifndef COMPAT
att_list.push_back(new Encoded_attr_rwAttr());
att_list.push_back(new Encoded_attr_image());
#endif
Tango::UserDefaultAttrProp att_no_data_prop;
att_no_data_prop.set_description("User desc");
att_no_data_prop.set_min_value("30");
att_no_data_prop.set_delta_val("77");
att_no_data_prop.set_delta_t("88");
att_no_data_prop.set_event_rel_change("55");
att_no_data_prop.set_event_period("1500");
Tango::Attr *db_att = new DefUserAttr();
db_att->set_default_properties(att_no_data_prop);
att_list.push_back(db_att);
Tango::Attr *uclass_att = new DefClassUserAttr();
uclass_att->set_default_properties(att_no_data_prop);
att_list.push_back(uclass_att);
att_list.push_back(new DefAttr());
att_list.push_back(new DefClassAttr());
Tango::UserDefaultAttrProp att_enum_prop;
std::vector<std::string> v_s;
v_s.push_back("North");
v_s.push_back("South");
v_s.push_back("East");
v_s.push_back("West");
att_enum_prop.set_enum_labels(v_s);
Tango::Attr *en_att = new EnumAttr();
en_att->set_default_properties(att_enum_prop);
en_att->set_memorized();
en_att->set_memorized_init(true);
att_list.push_back(en_att);
Tango::Attr *en_s_att = new EnumSpecAttr();
en_s_att->set_default_properties(att_enum_prop);
att_list.push_back(en_s_att);
att_list.push_back(new DynEnumAttr());
att_list.push_back(new ReynaldPollAttr());
}
void DevTestClass::pipe_factory()
{
RPipeClass *pRPipe = new RPipeClass("RPipe", Tango::OPERATOR);
Tango::UserDefaultPipeProp udpp;
udpp.set_description("The read pipe");
udpp.set_label("ReadPipeLabel");
pRPipe->set_default_properties(udpp);
pipe_list.push_back(pRPipe);
RWPipeClass *pRWPipe = new RWPipeClass("RWPipe", Tango::OPERATOR);
udpp.set_description("The read_write pipe");
udpp.set_label("ReadWritePipeLabel");
pRWPipe->set_default_properties(udpp);
pipe_list.push_back(pRWPipe);
ConfPipeClass *pPipe1 = new ConfPipeClass("PipeConf1", Tango::OPERATOR);
pipe_list.push_back(pPipe1);
ConfPipeClass *pPipe2 = new ConfPipeClass("PipeConf2", Tango::OPERATOR);
udpp.set_description("A Tango pipe with user defined desc");
udpp.set_label("PipeLabel");
pPipe2->set_default_properties(udpp);
pipe_list.push_back(pPipe2);
ConfPipeClass *pPipe3 = new ConfPipeClass("PipeConf3", Tango::OPERATOR);
udpp.description.clear();
udpp.set_label("BasePipeLabel");
pPipe3->set_default_properties(udpp);
pipe_list.push_back(pPipe3);
ConfPipeClass *pPipe4 = new ConfPipeClass("PipeConf4", Tango::OPERATOR);
pipe_list.push_back(pPipe4);
ConfPipeClass *pPipe5 = new ConfPipeClass("PipeConf5", Tango::OPERATOR);
pipe_list.push_back(pPipe5);
ConfPipeClass *pPipe6 = new ConfPipeClass("PipeConf6", Tango::OPERATOR);
udpp.label.clear();
udpp.set_description("UserDefinedDesc");
pPipe6->set_default_properties(udpp);
pipe_list.push_back(pPipe6);
ConfPipeClass *pPipe7 = new ConfPipeClass("PipeConf7", Tango::OPERATOR);
pipe_list.push_back(pPipe7);
RPipeDEClass *pRPipeDE = new RPipeDEClass("RPipeDE", Tango::OPERATOR);
pipe_list.push_back(pRPipeDE);
}
// NOLINTEND(*)
|