| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246 |
- #include "Slave_Ports_Status.h"
- /*Slave_Ports_Status::Slave_Ports_Status(Client& client) : m_client(client) {
- m_accountName = NULL;
- m_appKeyName = NULL;
- m_appKeyValue = NULL;
- m_path = NULL;
- m_nextChar = NULL;
- m_nextState = END;
- }
- */
- /*
- Slave_Ports_Status::Slave_Ports_Status(Client& client) : m_client(client) {
- m_accountName = NULL;
- m_appKeyName = NULL;
- m_appKeyValue = NULL;
- m_path = NULL;
- m_nextChar = NULL;
- m_nextState = END;
- }
- */
- /*
- void Slave_Ports_Status::push() { //
- }
- */
- Slave_Ports_Status::Slave_Ports_Status(){
- Serial.print("#35 Slave_Ports_Status::Slave_Ports_Status():");
- _count = 0 ;
- Slave_Ports_Status_T Slave_Ports_Status_A[10];
- // Slave_Ports_Status_QUEUE_T Slave_Ports_Status_QUEUE_A[10] ;
- //_queue_id_current = 0 ;
- //_queue_count = 0;
- }
- /*
- inline int Slave_Ports_Status::add(Slave_Ports_Status_T item)
- {
-
- Serial.print("Add item... _count["); Serial.print(item.Port_ID);
-
- Serial.print("] 0 ["); Serial.print(item.Port_ID);
- Serial.print("1 ["); Serial.print(item._Slave_ID);
- Serial.print("2 ["); Serial.print(item.PortTypes);
- Serial.print("3 ["); Serial.print(item.Address);
- Serial.print("4 ["); Serial.print(item.LocalPort);
- Serial.print("5 ["); Serial.print(item.Exp_state);
- Serial.print("6 ["); Serial.print(item.Exp_state_ttl);
- Serial.print("7 ["); Serial.print(item.Broadcast_state);
- Serial.println("]");
-
- return 1 ;
- }
- */
-
- /*
- void Slave_Ports_Status::I2C_driver_FS(int I2C_driver) { //char*
-
-
- // Serial.print("I2C_driver_FS[");
- //Serial.print(I2C_driver_F(_NOT_USED_));
- if(I2C_driver_NOT_USED_ == I2C_driver) {
- Serial.println("_NOT_USED_");
-
- // I2C_driver_FT = "_NOT_USED______________";
- //return "_NOT_USED______________";
- }
- else if( I2C_driver_Adafruit_PWMServoDriver == I2C_driver) {
- Serial.println("Adafruit_PWMServoDriver");
- //12345678901234567890134
- // I2C_driver_FT = "Adafruit_PWMServoDriver";
- // return "Adafruit_PWMServoDriver";
- } else {
- Serial.print("_UNKNOWN_");
- // I2C_driver_FT = "_UNKNOWN_______________";
- // return "_UNKNOWN_______________";
- }
-
-
- // sprintf(I2C_driver_FT, "%02d", 1);
- // return I2C_driver_FT;
- }
-
- */
- void Slave_Ports_Status::add_port(
- int Port_ID,
- int _Slave_ID,
- int PortTypes,
- int Address,
- int LocalPort,
- int Exp_state,
- int Exp_state_ttl,
- int Broadcast_state,
- int I2C_port,
- //int I2C_driver
- int I2C_driver
- )
- {
-
- Serial.print("#112 add_port _count[");
- Serial.print(this->_count);
- Serial.print("] _count + 1["); Serial.print(this->_count + 1);
- Serial.print("] Port_ID["); Serial.print(Port_ID);
- Serial.print("] _Slave_ID[0x"); Serial.print( _Slave_ID);
- Serial.print("] PortTypes["); Serial.print(PortTypes);
- Serial.print("] Address["); Serial.print(Address);
- Serial.print("] LocalPort["); Serial.print(LocalPort);
- Serial.print("] Exp_state["); Serial.print(Exp_state);
- // Serial.print("] Exp_state_ttl["); Serial.print(Exp_state_ttl);
- // Serial.print("] Broadcast_state["); Serial.print(Broadcast_state);
- // Serial.print("] I2C_port["); Serial.print(I2C_port);
- // Serial.print("] I2C_driver["); I2C_driver_FS(I2C_driver);
- //Serial.print("] I2C_driver_Rev[");
- //unsigned char LCDarray1buf[24];
- //LCDarray1.toCharArray(LCDarray1buf, 24);
- // I2C_driver_FT[24] = I2C_driver_FS(I2C_driver_F(I2C_driver)) ;
- Serial.println("]");
- //Slave_Ports_Status_A[_count + 1].Port_ID = Port_ID ;
-
- if(this->_count == 0) {
-
- this->Slave_Ports_Status_A[_count ].Port_ID=0x00;
- this->Slave_Ports_Status_A[_count ]._Slave_ID=0x00;
- this->Slave_Ports_Status_A[_count ].PortTypes=0x00;
- this->Slave_Ports_Status_A[_count ].Address=0x00;
- this->Slave_Ports_Status_A[_count ].LocalPort=0x00;
- this->Slave_Ports_Status_A[_count ].Exp_state=0x00;
- this->Slave_Ports_Status_A[_count ].Exp_state_ttl=0x00;
- this->Slave_Ports_Status_A[_count ].Broadcast_state=0x00;
- this->Slave_Ports_Status_A[_count ].I2C_port=0x00;
- this->Slave_Ports_Status_A[_count ].I2C_driver=0x00;
- //_count ++;
-
- this->_count ++;
- /* Slave_Ports_Status::add_port(
- Port_ID,
- _Slave_ID,
- PortTypes,
- Address,
- LocalPort,
- Exp_state,
- Exp_state_ttl,
- Broadcast_state,
- I2C_port,
- I2C_driver
- );
- */
- }
-
- this->Slave_Ports_Status_A[_count + 1].Port_ID = Port_ID ;
- this->Slave_Ports_Status_A[_count + 1]._Slave_ID = _Slave_ID ;
- this->Slave_Ports_Status_A[_count + 1].PortTypes = PortTypes ;
- this->Slave_Ports_Status_A[_count + 1].Address = Address ;
- this->Slave_Ports_Status_A[_count + 1].LocalPort = LocalPort ;
- this->Slave_Ports_Status_A[_count + 1].Exp_state = Exp_state ;
- this->Slave_Ports_Status_A[_count + 1].Exp_state_ttl = Exp_state_ttl ;
- this->Slave_Ports_Status_A[_count + 1].Broadcast_state = Broadcast_state ;
- this->Slave_Ports_Status_A[_count + 1].I2C_port = I2C_port ;
- this->Slave_Ports_Status_A[_count + 1].I2C_driver = I2C_driver ;
- // Slave_Ports_Status_A[_count + 1].I2C_driver = I2C_driver_F(I2C_driver) ;
- this->_count ++;
-
- }
- bool Slave_Ports_Status::add_empty()
- {
- Serial.println("add_empty");
- }
- void Slave_Ports_Status::list_ports()
- {
- Serial.print("print_ports#154 _count["); Serial.print(_count); Serial.println("] ");
- int i;
- for(i=2;i<=_count;i++) {
-
- Serial.print(" #IND["); Serial.print(i);
- Serial.print("] Port_ID["); Serial.print(Slave_Ports_Status_A[i].Port_ID, HEX);
- Serial.print("] _Slave_ID[0x"); Serial.print( Slave_Ports_Status_A[i]._Slave_ID, HEX );
- Serial.print("] PortTypes["); Serial.print(Slave_Ports_Status_A[i].PortTypes, HEX);
- // Serial.println("] Address [");
- Serial.print("] Address["); //Serial.print(Slave_Ports_Status_A[i].Address, HEX);
- Serial.print("] LocalPort["); Serial.print(Slave_Ports_Status_A[i].LocalPort);
- Serial.print("] Exp_state["); Serial.print(Slave_Ports_Status_A[i].Exp_state, HEX);
- Serial.print("] Exp_state_ttl["); Serial.print(Slave_Ports_Status_A[i].Exp_state_ttl, HEX);
- Serial.print("] Broadcast_state["); Serial.print(Slave_Ports_Status_A[i].Broadcast_state, HEX);
- Serial.print("] I2C_port["); Serial.print(Slave_Ports_Status_A[i].I2C_port, HEX);
- // Serial.print("] I2C_driver["); Serial.print(Slave_Ports_Status_A[i].I2C_driver.CNF1);
-
- // I2C_driver_FT[24] = I2C_driver_FS(Slave_Ports_Status_A[i].I2C_driver);
- // Serial.print(I2C_driver_FT[24]);
- Serial.println("]");
-
-
- }
-
-
- }
- /*
- Slave_Ports_Status_S Slave_Ports_Status::get_port(int Port_ID)
- {
- // Serial.print("list_ports#154 _count["); Serial.print(_count); Serial.println("] ");
- //int i;
- //for(i=2;i<=_count;i++) {
- return Slave_Ports_Status_A[Port_ID];
-
- // }
- //return Slave_Ports_Status_A;
- }
- */
- Slave_Ports_Status::~Slave_Ports_Status(){
- delete[] Slave_Ports_Status_A;
- //Serial.print("#40 free ~Slave_Ports_Status");
- }
- /*
- int Slave_Ports_Status::get_count()
- {
- return _count;
- }
- */
- /*
- byte Slave_Ports_Status::_Slave_Ports_Protocol_CAN_broadcast_F() {
- }
- */
|