亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? canopen.cpp

?? 美國COPLEY驅動器,程序開發工具之一.
?? CPP
?? 第 1 頁 / 共 2 頁
字號:
      }

      hashMutex.Lock();

      r = *searchHash( frame.id );
      if( r )
	 r->NewFrame(frame);

      hashMutex.Unlock();
   }
}

/***************************************************************************/
/**
Default constructor for CanOpenSettings object.
This constructor simply sets all the settings to their default values.
*/
/***************************************************************************/
CanOpenSettings::CanOpenSettings( void )
{
   readThreadPriority = 9;
}

/***************************************************************************/
/**
Default constructor for a CANopen receiver object.
*/
/***************************************************************************/
Receiver::Receiver( void )
{
   // Whenever the receiver is disabled, we self reference with the 
   // next pointer.  This is a quick way to identify an enabled receiver
   next = this;
   co = 0;
}

/***************************************************************************/
/**
Initialize a new CANopen receiver.  After construction, the receiver will 
be disabled.  Call Enable() to allow messages to be received.
@param canOpen Reference to the CANopen network object that this receiver
       is associated with.
@param id COB ID of the receive message
*/
/***************************************************************************/
Receiver::Receiver( CanOpen &canOpen, uint32 id )
{
   next = this;
   co = 0;
   Init( canOpen, id );
}

/***************************************************************************/
/**
Destructor for CANopen receiver objects.  This destructor ensures that the
receiver is disabled before it is destroyed.
*/
/***************************************************************************/
Receiver::~Receiver()
{
   UnInit();
}

/***************************************************************************/
/**
Initialize the CANopen receiver object.  This function should be called 
before the receiver is used in any way.  It can only be called once.
@param canOpen Reference to the CANopen network object that this receiver
       is associated with.
@param id COB ID of the receive message
@return A pointer to an error object, or NULL on success.
*/
/***************************************************************************/
const Error *Receiver::Init( CanOpen &canOpen, uint32 id )
{
   const Error *err = CanInterface::ChkID( id );
   if( err ) return err;

   DisableReceiver();

   this->id = id;
   co = &canOpen;
   return 0;
}

/***************************************************************************/
/**
Un-initialize a CANopen receiver.  This returns the receiver object to it's
uninitialized state.
@return A pointer to an error object, or NULL on success.
*/
/***************************************************************************/
const Error *Receiver::UnInit( void )
{
   DisableReceiver();
   co = 0;
   return 0;
}

/***************************************************************************/
/**
Process a new received CAN bus frame.  This virtual function is called by
the CANopen read thread every time a CAN frame is received over the network
with an ID matching the receivers ID if the receiver is enabled.  

Note that this function is called from the CANopen receive thread.  No other
receive frames will be processed until this function returns.

Also note that the map object used to associate message IDs with receive objects
is locked when this function is called.  The locking is required to prevent a 
race condition that could occur when a receive object is disabled and it's 
memory is deallocated.  Since the map is locked, it's illegal to Enable() or
Disable() any receive object from within this function.

@param frame The CAN frame to be processed.  Note that the memory holding the
       frame structure may be reused after the call returns.  If the frame 
		 contents are to be used after the return the a copy of the frame should
		 be made. 
		 
@return non-zero if the frame was handled, zero if the frame type was unknown.
*/
/***************************************************************************/
int Receiver::NewFrame( CanFrame &frame )
{
   return 0;
}

/***************************************************************************/
/**
Return the receive COB ID associated with this CANopen message receiver.
@return The receive COB ID.
*/
/***************************************************************************/
uint32 Receiver::getRecvID( void )
{
   return id;
}

/***************************************************************************/
/**
Enable reception of this message type.  Once enabled, any messages received
over the CANopen network of this type will be passed to the Receiver
using the member function NewFrame.
@return A pointer to an error object, or NULL on success.
*/
/***************************************************************************/
const Error *Receiver::EnableReceiver()
{
   if( !co ) return &CanOpenError::NotInitialized;

   return co->EnableReceiver( this );
}

/***************************************************************************/
/**
Search a hash table of receiver objects associated with this network.
The CanOpen object maintains a hash of all enabled receivers on the 
network.  Each time a new CAN frame is received, the hash is searched for
a receiver matching the frame's ID.  This function handles the details of
the search.

This function is also used when adding receivers to the tree.  To aid this
use, it actually returns a pointer to a pointer to the receiver, or to the
place where the new receiver would be added.

Note, it's assumed that the hash mutex will be locked when this function 
is called.

@param id The CAN message ID of the receiver to be found.
@return A pointer to a pointer to the receiver, or the location where the
        receiver should be added if there is none with a matching ID.
*/
/***************************************************************************/
Receiver **CanOpen::searchHash( uint32 id )
{
   int i = id % CML_HASH_SIZE;

   Receiver **pp = &hash[i];

   while( 1 )
   {
      if( !*pp )
	 return pp;

      uint32 x = (*pp)->id;

      if( id == x )
	 return pp;

      pp = &( (*pp)->next);
   }
}

/***************************************************************************/
/**
Enable reception handling of the message identified by this Receiver
object.  The receiver is enabled by adding it to a binary tree of 
receiver objects maintained by the CanOpen object.

@param rPtr Pointer to the receiver to add
@return A pointer to an error object, or NULL on success.
*/
/***************************************************************************/
const Error *CanOpen::EnableReceiver( Receiver *rPtr )
{
   const Error *err = 0;

   hashMutex.Lock();

   Receiver **pp = searchHash( rPtr->id );

   if( *pp )
      err = &CanOpenError::RcvrPresent;
   else
   {
      rPtr->next = 0;
      *pp = rPtr;
   }

   hashMutex.Unlock();

   return err;
}

/***************************************************************************/
/**
Disable reception handling of the message identified by this Receiver
object.  Receivers are disabled by removing them from a binary tree of 
receiver objects maintained by the CanOpen object.

@param rPtr A pointer to the receiver to disable.
@return A pointer to an error object, or NULL on success.
*/
/***************************************************************************/
const Error *CanOpen::DisableReceiver( Receiver *rPtr )
{
   const Error *err = 0;

   hashMutex.Lock();

   Receiver **pp = searchHash( rPtr->id );

   if( !*pp )
      err = &CanOpenError::RcvrNotFound;

   else
   {
      rPtr = *pp;
      *pp = rPtr->next;

      // Point the receiver back at itself.
      // This allows the receiver to determine it's disabled.
      rPtr->next = rPtr;
   }

   hashMutex.Unlock();
   return err;
}

/***************************************************************************/
/**
Disable reception of this message type.  Any CAN frames received by the
CANopen object of a disabled message type will be ignored by the CANopen
object.
@return A pointer to an error object, or NULL on success.
*/
/***************************************************************************/
const Error *Receiver::DisableReceiver()
{
   if( !co ) return &CanOpenError::NotInitialized;

   if( next == this ) return &CanOpenError::RcvrNotFound;

   return co->DisableReceiver( this );
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久久精品综合| 国产在线不卡一区| 久草中文综合在线| 五月综合激情网| 欧美一区二区三区电影| 激情小说欧美图片| 一区二区三区色| 国产精品欧美极品| 91久久香蕉国产日韩欧美9色| 麻豆精品一区二区av白丝在线| 亚洲bt欧美bt精品| 经典三级视频一区| 不卡一区二区三区四区| 欧美丝袜丝交足nylons| 国产日韩欧美高清在线| 一区二区三区精品在线观看| 精品综合久久久久久8888| 国产一二三精品| 欧美日韩国产一级片| 日本一区二区成人| 久久99久久99| 欧美日韩一区国产| 亚洲视频在线观看一区| 精品一区二区三区在线观看国产| 色狠狠一区二区| 国产亚洲美州欧州综合国| 日韩成人免费电影| 欧美亚洲一区二区三区四区| 久久蜜桃av一区精品变态类天堂| 一卡二卡欧美日韩| av亚洲精华国产精华| 久久精品一区蜜桃臀影院| 午夜不卡av免费| 色婷婷av一区二区三区软件| 国产视频不卡一区| 成人中文字幕电影| 欧美国产日韩在线观看| 狠狠色丁香久久婷婷综| 久久婷婷久久一区二区三区| 精品一区二区免费看| 欧美变态tickle挠乳网站| 午夜不卡在线视频| 欧美精品 日韩| 久久精品国产精品亚洲红杏| 欧美一区二区精美| 老司机免费视频一区二区| 日韩亚洲欧美中文三级| 国产精品自拍一区| 日韩美女精品在线| 欧美美女直播网站| 蜜桃视频在线一区| 国产精品狼人久久影院观看方式| 99久久夜色精品国产网站| 日韩码欧中文字| 91精品国产丝袜白色高跟鞋| 久久成人羞羞网站| 中文字幕一区二区不卡| 91国偷自产一区二区三区成为亚洲经典| 一级中文字幕一区二区| 日韩欧美一级精品久久| 不卡一二三区首页| 午夜在线成人av| 国产精品另类一区| 欧美一级生活片| 91亚洲精华国产精华精华液| 丝袜国产日韩另类美女| 国产精品麻豆久久久| 宅男在线国产精品| 成人黄页在线观看| 久久精品国产77777蜜臀| 国产精品免费aⅴ片在线观看| 国产一区二区不卡| 亚洲专区一二三| 国产亚洲欧美中文| 精品国产一区二区亚洲人成毛片 | 青椒成人免费视频| 国产精品国模大尺度视频| 日韩精品中文字幕在线一区| 欧美在线色视频| 91久久精品一区二区二区| 久久国产剧场电影| 91精彩视频在线| 日韩电影在线观看一区| 久久久久国产精品厨房| 久久婷婷久久一区二区三区| 日韩精品中午字幕| 久久综合资源网| 国产色爱av资源综合区| 欧美精彩视频一区二区三区| www欧美成人18+| 国产精品久久久久永久免费观看| 久久久国产综合精品女国产盗摄| 精品国精品国产| 亚洲免费观看高清完整版在线 | 国产精品一卡二| 成人av午夜影院| 色综合色狠狠天天综合色| 欧美性感一类影片在线播放| 欧美日韩国产不卡| 日本一区二区三区四区在线视频| 欧美激情一区三区| 舔着乳尖日韩一区| 国产成人精品aa毛片| 欧美综合亚洲图片综合区| 日韩视频一区二区| 综合久久久久久| 激情文学综合插| 91成人在线精品| 久久亚洲一级片| 免费视频一区二区| 91在线观看成人| 久久网这里都是精品| 亚洲成在人线免费| 色哟哟国产精品| 久久久久久99久久久精品网站| 亚洲最新视频在线播放| 高清在线成人网| 精品毛片乱码1区2区3区| 亚洲成人福利片| 在线观看欧美黄色| 国产精品天美传媒沈樵| 黄网站免费久久| 日韩精品中文字幕一区| 日韩高清在线一区| 在线精品视频一区二区三四| 亚洲另类春色国产| 94色蜜桃网一区二区三区| 国产精品的网站| 91麻豆精品秘密| 一区二区三区在线视频观看| 99免费精品视频| 亚洲已满18点击进入久久| 91日韩在线专区| 亚洲国产精品天堂| 3d成人h动漫网站入口| 免费人成网站在线观看欧美高清| 91精品综合久久久久久| 男女男精品视频| 欧美sm美女调教| av男人天堂一区| 亚洲国产欧美另类丝袜| 91精品国产黑色紧身裤美女| 人人狠狠综合久久亚洲| 久久尤物电影视频在线观看| 国产成人超碰人人澡人人澡| 国产亚洲欧美色| 欧美日韩国产综合视频在线观看 | 欧美午夜精品久久久久久孕妇| 午夜精彩视频在线观看不卡| 精品福利在线导航| 色综合久久久久综合99| 美国三级日本三级久久99| 亚洲色图.com| 国产亚洲人成网站| 欧美疯狂做受xxxx富婆| 国产激情91久久精品导航| 亚洲综合丝袜美腿| 欧美极品aⅴ影院| 日韩一区国产二区欧美三区| 大桥未久av一区二区三区中文| 亚洲va欧美va人人爽| 欧美—级在线免费片| 精品久久一区二区| 欧美美女网站色| 欧美男人的天堂一二区| 色偷偷久久人人79超碰人人澡| 丁香婷婷综合色啪| 国产精品2024| 国产一区二区三区四| 国产一区二区日韩精品| 久久国产精品露脸对白| 奇米一区二区三区| 激情综合网av| 国产一区二区三区不卡在线观看| 免费高清不卡av| 激情综合网最新| 国产成人精品免费视频网站| 国产麻豆成人精品| 国产v日产∨综合v精品视频| 国产suv精品一区二区883| 国产精品69毛片高清亚洲| 国产夫妻精品视频| 成人精品gif动图一区| 91蜜桃在线免费视频| 91福利在线免费观看| 51午夜精品国产| 国产欧美日韩在线看| 日韩一区欧美一区| 亚洲3atv精品一区二区三区| 日韩1区2区日韩1区2区| 国产成人综合亚洲91猫咪| 91麻豆国产福利在线观看| 制服视频三区第一页精品| 国产三级一区二区| 亚洲午夜久久久久久久久电影院| 日本欧美加勒比视频| 成人av网站免费观看| 欧美精品丝袜中出| 欧美激情一区二区三区蜜桃视频| 亚洲激情自拍视频|