void Wiimote::writePacket(unsigned char packet[],size_t packetSize) { /* Set the packet's rumble bit: */ if(rumble) packet[2]|=0x01; else packet[2]&=~0x01; /* Lock the write socket: */ Threads::Mutex::Lock writeSocketLock(writeSocketMutex); /* Write the packet: */ write(writeSocket,packet,packetSize); }
void Wiimote::writePacket(unsigned char packet[],size_t packetSize) { /* Set the packet's rumble bit: */ if(rumble) packet[2]|=0x01; else packet[2]&=~0x01; /* Lock the write socket: */ Threads::Mutex::Lock writeSocketLock(writeSocketMutex); /* Write the packet: */ if(write(writeSocket,packet,packetSize)!=ssize_t(packetSize)) Misc::throwStdErr("Wiimote::writePacket: Error while writing packet"); }