本文整理汇总了C++中network::sendMessage方法的典型用法代码示例。如果您正苦于以下问题:C++ network::sendMessage方法的具体用法?C++ network::sendMessage怎么用?C++ network::sendMessage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类network
的用法示例。
在下文中一共展示了network::sendMessage方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setupServer
void setupServer()
{
g_Connected = 1;
if (pthread_create(&g_ServerThread, NULL, &serverData, NULL))
{
fprintf(stderr, "AS3OpenNI :: Error on pthread_create() for the server\n");
}
g_AS3Network.sendMessage(0,0,0);
}
示例2: UserCalibration_CalibrationEnd
void XN_CALLBACK_TYPE UserCalibration_CalibrationEnd(SkeletonCapability& capability, XnUserID nId, XnBool bSuccess, void* pCookie)
{
if (bSuccess)
{
if(_printUserTracking) printf("AS3OpenNI :: Calibration complete, start tracking user: %d\n", nId);
_userGenerator.GetSkeletonCap().StartTracking(nId);
char cValue[50];
sprintf(cValue, "user_tracking_user_calibration_complete:%d", nId);
if(_useSockets)
{
#if (XN_PLATFORM == XN_PLATFORM_WIN32)
g_AS3Network.sendMessage(1,8,nId);
#else
sendToSocket(USER_TRACKING_SOCKET, cValue);
#endif
}
}
else
{
if(_printUserTracking) printf("AS3OpenNI :: Calibration failed for user: %d\n", nId);
if (_needPose)
{
_userGenerator.GetPoseDetectionCap().StartPoseDetection(_strPose, nId);
}
else
{
_userGenerator.GetSkeletonCap().RequestCalibration(nId, true);
}
char cValue[50];
sprintf(cValue, "user_tracking_user_calibration_failed:%d", nId);
if(_useSockets)
{
#if (XN_PLATFORM == XN_PLATFORM_WIN32)
g_AS3Network.sendMessage(1,9,nId);
#else
sendToSocket(USER_TRACKING_SOCKET, cValue);
#endif
}
}
}
示例3: User_LostUser
void XN_CALLBACK_TYPE User_LostUser(UserGenerator& generator, XnUserID nId, void* pCookie)
{
if(_printUserTracking) printf("AS3OpenNI :: Lost user: %d\n", nId);
char cValue[50];
sprintf(cValue, "user_tracking_lost_user:%d", nId);
if(_useSockets)
{
#if (XN_PLATFORM == XN_PLATFORM_WIN32)
g_AS3Network.sendMessage(1,3,nId);
#else
sendToSocket(USER_TRACKING_SOCKET, cValue);
#endif
}
}
示例4: UserCalibration_CalibrationStart
void XN_CALLBACK_TYPE UserCalibration_CalibrationStart(SkeletonCapability& capability, XnUserID nId, void* pCookie)
{
if(_printUserTracking) printf("AS3OpenNI :: Calibration started for user: %d\n", nId);
char cValue[50];
sprintf(cValue, "user_tracking_user_calibration_start:%d", nId);
if(_useSockets)
{
#if (XN_PLATFORM == XN_PLATFORM_WIN32)
g_AS3Network.sendMessage(1,7,nId);
#else
sendToSocket(USER_TRACKING_SOCKET, cValue);
#endif
}
}
示例5: UserPose_PoseDetected
void XN_CALLBACK_TYPE UserPose_PoseDetected(PoseDetectionCapability& capability, const XnChar* strPose, XnUserID nId, void* pCookie)
{
if(_printUserTracking) printf("AS3OpenNI :: Pose %s detected for user: %d\n", strPose, nId);
_userGenerator.GetPoseDetectionCap().StopPoseDetection(nId);
_userGenerator.GetSkeletonCap().RequestCalibration(nId, true);
char cValue[50];
sprintf(cValue, "user_tracking_pose_detected:%d", nId);
if(_useSockets)
{
#if (XN_PLATFORM == XN_PLATFORM_WIN32)
g_AS3Network.sendMessage(1,6,nId);
#else
sendToSocket(USER_TRACKING_SOCKET, cValue);
#endif
}
}
示例6: User_NewUser
void XN_CALLBACK_TYPE User_NewUser(UserGenerator& generator, XnUserID nId, void* pCookie)
{
if(_printUserTracking) printf("AS3OpenNI :: New User: %d\n", nId);
if(_needPose)
{
_userGenerator.GetPoseDetectionCap().StartPoseDetection(_strPose, nId);
}
else
{
_userGenerator.GetSkeletonCap().RequestCalibration(nId, true);
}
char cValue[50];
sprintf(cValue, "user_tracking_new_user:%d", nId);
if(_useSockets)
{
#if (XN_PLATFORM == XN_PLATFORM_WIN32)
g_AS3Network.sendMessage(1,2,nId);
#else
sendToSocket(USER_TRACKING_SOCKET, cValue);
#endif
}
}
示例7:
void *serverData(void *arg)
{
int len = 8*10;
unsigned char *buff = (unsigned char*)malloc(len); // Command buffer
while(g_Connected)
{
len = g_AS3Network.getData(buff, 1024);
if(len > 0 && len % 6 == 0)
{
// Get the number of commands received.
int max = len / 6;
int i;
// For each command received.
for(i = 0; i < max; i++)
{
int code = buff[0 + (i*6)];
switch(code)
{
case 1: // OPENNI
switch(buff[1 + (i*6)])
{
case 0: // GET DEPTH
if(_featureDepthMapCapture) g_AS3Network.sendMessage(1,0,g_ucDepthBuffer,sizeof(g_ucDepthBuffer));
break;
case 1: // GET RGB
if(_featureRGBCapture) g_AS3Network.sendMessage(1,1,g_ucImageBuffer,sizeof(g_ucImageBuffer));
break;
#if (XN_PLATFORM == XN_PLATFORM_WIN32)
case 4: // GET USERS
if(_featureUserTracking)
{
for (int i = 0; i < MAX_USERS; ++i)
{
g_AS3Network.sendMessage(1,4,g_ucPlayersBuffer[i].data,g_ucPlayersBuffer[i].size);
}
}
break;
case 5: // GET SKELETONS
if(_featureUserTracking)
{
for (int i = 0; i < MAX_USERS; ++i)
{
g_AS3Network.sendMessage(1,5,g_ucSkeletonsBuffer[i].data,g_ucSkeletonsBuffer[i].size);
}
}
break;
#endif
}
break;
}
}
}
}
return 0;
}