bool CGroupObject::SetReference(LPCSTR ref_name) { shared_str old_refs = m_ReferenceName_; SetRefName(ref_name); bool bres = UpdateReference(old_refs!=ref_name); if (false==bres) SetRefName(old_refs.c_str()); return bres; }
/// Default constructor for this PDO TPDO_PvtStat() { SetRefName( "TPDO_PvtStat" ); for( int i=0; i<MAX_AXIS; i++ ) ampRef[i] = 0; axisCt = 0; }
LinuxEcatHardware::LinuxEcatHardware( const char *name ) { if( !name ) name = "eth0"; fd = -1; ifname = CloneString( name ); SetRefName( "LinuxEcatHw" ); }
/** Create an EtherCAT hardware interface which uses UDP formatted messages. This is the only type of EtherCAT interface that can be used under Windows without installing special drivers. The low level EtherCAT protocol normally does not use an IP address, however since this driver transmits EtherCAT packets over UDP/IP, the Ethernet interface used with this driver must have a valid IP address assigned. In addition, the network mask associated with the Ethernet interface should be defined in such a way that no other network interface on the same PC is a member of the same network. That is, if multiple interfaces are installed then they should be allocated to seperate networks. i.e. ( IP1 & mask1 ) != (IP2 & mask2) where IP1 and mask1 are the IP address and net mask of the first interface, and IP2 and mask2 are for the second interface. For example, the following two interfaces are on different networks: IP: 192.168.1.1 mask: 255.255.255.0 IP: 192.168.2.1 mask: 255.255.255.0 but the following two interfaces are on the same network: IP: 192.168.1.1 mask: 255.255.255.0 IP: 192.168.1.2 mask: 255.255.255.0 This is important because this drive has no direct control of which interface the packets are being sent out. This is entirely controlled by the upper layer routing algorithms in the windows network stack. The name parameter passed to this function can be used to identify which interface this object should bind to. It can take any of the following forms: - If not specified, then the first valid interface found will be used. This is useful if there's only one interface on the PC. - If of the form; eth0, eth1, eth2, etc, then the nth valid interface will be used. - For more control, the IP address of the desired interface can be passed. This should be sent as a string in dotted decimal notation. For example: "192.168.1.1" @param name Used to identify the Ethernet interface as described above. */ WinUdpEcatHardware::WinUdpEcatHardware( const char *name ) { hndl = 0; recv = 0; if( !name ) ifname = 0; else ifname = CloneString( name ); SetRefName( "UdpEcatHw" ); }
bool CGroupObject::LoadStream(IReader& F) { u16 version=0; R_ASSERT(F.r_chunk(GROUPOBJ_CHUNK_VERSION,&version)); if (version<0x0011) { ELog.DlgMsg( mtError, "CGroupObject: unsupported file version. Object can't load."); return false; } CCustomObject::LoadStream(F); Flags32 tmp_flags; tmp_flags.zero(); if(version<0x0012) F.r_chunk(GROUPOBJ_CHUNK_FLAGS,&tmp_flags); // objects if (tmp_flags.test(1<<0)) { //old format, opened group ELog.DlgMsg( mtError, "old format, opened group"); return false; /* R_ASSERT(F.find_chunk(GROUPOBJ_CHUNK_OPEN_OBJECT_LIST)); u32 cnt = F.r_u32(); for (u32 k=0; k<cnt; ++k) { m_ObjectsInGroup.resize (m_ObjectsInGroup.size()+1); F.r_stringZ (m_ObjectsInGroup.back().ObjectName); } */ }else { Scene->ReadObjectsStream(F,GROUPOBJ_CHUNK_OBJECT_LIST,AppendObjectLoadCB,0); } VERIFY(m_ObjectsInGroup.size()); if (F.find_chunk(GROUPOBJ_CHUNK_REFERENCE)) { shared_str rn; F.r_stringZ (rn); SetRefName(rn.c_str()); } if(version<0x0012) { for (ObjectsInGroup::iterator it=m_ObjectsInGroup.begin(); it!=m_ObjectsInGroup.end(); ++it) if(it->pObject) { it->pObject->m_CO_Flags.set(flObjectInGroup, TRUE); it->pObject->m_CO_Flags.set(flObjectInGroupUnique, TRUE); } } return true; }
//------------------------------------------------------------------------------ bool CGroupObject::LoadLTX(CInifile& ini, LPCSTR sect_name) { u32 version = ini.r_u32(sect_name, "version"); if (version<0x0011) { ELog.DlgMsg( mtError, "CGroupObject: unsupported file version. Object can't load."); return false; } CCustomObject::LoadLTX(ini, sect_name); Flags32 tmp_flags;tmp_flags.zero(); if(version<0x0012) tmp_flags.assign(ini.r_u32(sect_name, "flags") ); // objects if(/*IsOpened()*/ tmp_flags.test((1<<0))) { //old opened group save format ELog.DlgMsg( mtError, "old opened group save format"); return false; /* u32 cnt = ini.r_u32 (sect_name, "objects_in_group_count"); shared_str tmp; string128 buff; for (u32 k=0; k<cnt; ++k) { m_ObjectsInGroup.resize (m_ObjectsInGroup.size()+1); sprintf (buff,"objects_in_group_%d",k); m_ObjectsInGroup.back().ObjectName = ini.r_string(sect_name, buff); } */ }else { Scene->ReadObjectsLTX (ini, sect_name, "ingroup", AppendObjectLoadCB, 0); } VERIFY(m_ObjectsInGroup.size()); SetRefName(ini.r_string (sect_name, "ref_name")) ; if (!m_ReferenceName_.size()) ELog.Msg (mtError,"ERROR: group '%s' - has empty reference. Corrupted file?", Name); if(version<0x0012) { for (ObjectsInGroup::iterator it=m_ObjectsInGroup.begin(); it!=m_ObjectsInGroup.end(); ++it) if(it->pObject) { it->pObject->m_CO_Flags.set(flObjectInGroup, TRUE); it->pObject->m_CO_Flags.set(flObjectInGroupUnique, TRUE); } } return true; }
/// Default constructor for this PDO TPDO_Status( void ) { SetRefName( "TPDO_Status" ); for( int i=0; i<MAX_AXIS; i++ ) ampRef[i]=0; }
/// Default constructor for this PDO RPDO_PvtCtrl() { SetRefName( "RPDO_Pvt" ); netRef = 0; }
/// Default constructor for this PDO RPDO_Ctrl() { SetRefName( "RPDO_Ctrl" ); axisCt = 0; netRef = 0; }
bool CGroupObject::UpdateReference(bool bForceReload) { if (!m_ReferenceName_.size()) { ELog.Msg (mtError,"ERROR: '%s' - has empty reference.",Name); return false; } xr_string fn = m_ReferenceName_.c_str(); fn = EFS.ChangeFileExt(fn,".group"); IReader* R = FS.r_open(_groups_, fn.c_str()); bool bres = false; if (R) { bForceInitListBox = TRUE; ObjectsInGroup ObjectsInGroupBk = m_ObjectsInGroup; if(bForceReload) ClearInternal (ObjectsInGroupBk); m_ObjectsInGroup.clear(); xr_string nm = Name; shared_str old_refs = m_ReferenceName_; UpdateTransform (true); Fvector old_pos = PPosition; Fvector old_rot = PRotation; Fvector old_sc = PScale; if(LoadStream(*R)) { Name = nm.c_str(); bres = true; UpdateTransform (true); } FS.r_close (R); SetRefName(old_refs.c_str()); NumSetPosition (old_pos); NumSetRotation (old_rot); NumSetScale (old_sc); UpdateTransform (true); if(m_ObjectsInGroup.size()==ObjectsInGroupBk.size()) { ObjectsInGroup::iterator it = m_ObjectsInGroup.begin(); ObjectsInGroup::iterator itBk = ObjectsInGroupBk.begin(); for(; it!=m_ObjectsInGroup.end(); ++it, ++itBk) { it->pObject->m_CO_Flags.set(flObjectInGroupUnique, FALSE); if(itBk->pObject->m_CO_Flags.test(flObjectInGroupUnique) ) { std::swap(*itBk, *it); }else it->pObject->Name = itBk->pObject->Name; } }else { if(ObjectsInGroupBk.size()) { ELog.Msg (mtError, "Not all objects synchronised correctly", Name); for (ObjectsInGroup::iterator it=m_ObjectsInGroup.begin(); it!=m_ObjectsInGroup.end(); ++it) it->pObject->m_CO_Flags.set(flObjectInGroupUnique, FALSE); }else { // first setup for (ObjectsInGroup::iterator it=m_ObjectsInGroup.begin(); it!=m_ObjectsInGroup.end(); ++it) it->pObject->m_CO_Flags.set(flObjectInGroupUnique, FALSE); } } ClearInternal (ObjectsInGroupBk); }else { ELog.Msg (mtError,"ERROR: Can't open group file: '%s'.",fn.c_str()); } return bres; }