00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #include "l1394_avcregister.h"
00019 #include "l1394_fcpnode.h"
00020
00021 namespace L1394{
00022 AvcRegister::AvcRegister(const FcpNode* parent_node, const int subunit_value)
00023 {
00024 this->subunit_value = subunit_value;
00025 this->parent_node = parent_node;
00026 opcode = 0x0;
00027 ctype = 0x0;
00028 subfunction = 0x0;
00029 data_array = NULL;
00030 }
00031
00032 AvcRegister::~AvcRegister()
00033 {
00034
00035 }
00036
00037
00038 int AvcRegister::send() const
00039 {
00040 internal::SMessage::getInstance()->debugStream() << "AvcRegister > Sending " << endl << data_array <<endl;
00041 return parent_node->send( *data_array ).getByte(0);
00042 }
00043
00044 bool AvcRegister::hasFeature() const
00045 {
00046
00047 data_array->setByte(0,SPECIFIC_INQUIRY);
00048 switch(parent_node->send(*data_array).getByte(0))
00049 {
00050 case IMPLEMENTED : return true; break;
00051 default : return false; break;
00052 }
00053 }
00054
00055 bool AvcRegister::hasFeature(const int new_subfunction) const
00056 {
00057
00058 data_array->setByte(0,SPECIFIC_INQUIRY);
00059 data_array->setByte(2,opcode);
00060 data_array->setByte(3,new_subfunction);
00061 cout << data_array << endl;
00062 if(parent_node->send(* data_array ).getByte(0) == IMPLEMENTED)
00063 return true;
00064
00065 return false;
00066 }
00067
00068
00069 QArray AvcRegister::status() const
00070 {
00071 data_array->setByte(0, STATUS);
00072
00073 for (int i = 4; i < data_array->getSize()*4;i++)
00074 data_array->setByte(i, 0xff);
00075
00076 return parent_node->send(*data_array);
00077 }
00078 AvcRegister* AvcRegister::defaultSet(const int length,const int opcode,const int value)
00079 {
00080 reset(length);
00081 data_array->setByte(2, opcode);
00082 data_array->setByte(3, value);
00083 return this;
00084 }
00085
00086
00087 AvcRegister* AvcRegister::reset(const int size)
00088 {
00089 if (data_array!= NULL)
00090 delete data_array;
00091
00092 data_array = new QArray(size);
00093 data_array->setByte(0, CONTROL);
00094 data_array->setByte(1, subunit_value);
00095 if (size>1)
00096 for (int i = 1; i<size; i++)
00097 data_array->insert(0xffffffff,i);
00098 return this;
00099 }
00100
00101
00102 }