void ASSOscReceiver::buildCursorEvent(const std::string& theType, int theId, const asl::Vector3f& thePosition, float theIntensity) { if(!_myDidOverflow) { if(_myBounded) { asl::Vector2f myPosition(thePosition[0], thePosition[1]); if(!_myRegion.contains(myPosition)) { return; } } _myEmpty = false; std::string myAddress("/"); myAddress += theType; try { _myStream << osc::BeginMessage(myAddress.c_str()) << theId << thePosition[0] << thePosition[1] << thePosition[2] << theIntensity << osc::EndMessage; } catch (osc::OutOfBufferMemoryException) { _myDidOverflow = true; } } }
/** Create a UDP Socket and bind it to an arbitrary address @param aSocket The socket @param aAddress On return, contains the local socket name @return ETrue on success, EFalse otherwise */ TBool CEsockTest9_6::CreateUdpSocket( RSocket& aSocket, TSockAddr& aAddress ) { // Open the socket TInt nRet = aSocket.Open( iEsockSuite->iSocketServer, KAfInet, KSockDatagram, KProtocolInetUdp ); if( KErrNone != nRet ) { Logger().WriteFormat(_L("Failed to open socket: return value = <%d>"), nRet ); return EFalse; } // Bind to any address. //TInetAddr myAddress( KInetAddrAny, KInetPortAny ); TInetAddr myAddress( KInetAddrLoop, KInetPortAny ); nRet = aSocket.Bind( myAddress ); if( KErrNone != nRet ) { Logger().WriteFormat(_L("Failed to bind socket: return value = <%d>"), nRet ); return EFalse; } // Retrieve the bound address aSocket.LocalName( aAddress ); // Happy shiny return ETrue; }
void ASSOscReceiver::buildTransportLayerEvent(const std::string& theType) { if(!_myDidOverflow) { _myEmpty = false; std::string myAddress("/"); myAddress += theType; try { _myStream << osc::BeginMessage(myAddress.c_str()) << osc::EndMessage; } catch (osc::OutOfBufferMemoryException) { _myDidOverflow = true; } } }