public bool updatePowerUsage(int watt, short socketid) { for (int i = 0; i < m_Wallsockets.Count; i++) { wallSocket sock = m_Wallsockets[i]; if (sock.id == socketid) { // this is the socket packet pck = new packet(PACKET_TYPE.C_SOCKET_POWER_UPDATE); pck.writeShort(socketid); pck.writeLong(watt); send(pck); //print("send updatePowerUsage watt = " + watt); return true; } } return false; }
public bool sendPicture(loadTexture data, string name) { if (!data.isTextureLoaded()) return false; byte[] rawPicData = data.getImageData(); packet pck = new packet(PACKET_TYPE.SC_SEND_PICTURE); pck.writeString(name); pck.writeLong(rawPicData.Length); for (int i = 0; i < rawPicData.Length; i++) pck.writeByte(rawPicData[i]); send(pck); return true; }