Writes data to the device.

        :param data: data to write
        :type data: string

        :raises: :py:class:`~alarmdecoder.util.CommError`
162689
def write(self, data):
        
        try:
            self._device.write_data(data)

            self.on_write(data=data)

        except FtdiError as err:
            raise CommError('Error writing to device: {0}'.format(str(err)), err)
371201
def write(self, data):
        

        # report_size = 64
        # if self.ep_out:
        #     report_size = self.ep_out.wMaxPacketSize
        #
        # for _ in range(report_size - len(data)):
        #    data.append(0)

        self.read_sem.release()

        if not self.ep_out:
            bmRequestType = 0x21       #Host to device request of type Class of Recipient Interface
            bmRequest = 0x09           #Set_REPORT (HID class-specific request for transferring data over EP0)
            wValue = 0x200             #Issuing an OUT report
            wIndex = self.intf_number  #mBed Board interface number for HID
            self.dev.ctrl_transfer(bmRequestType, bmRequest, wValue, wIndex, data)
            return
            #raise ValueError('EP_OUT endpoint is NULL')

        self.ep_out.write(data)
        #logging.debug('sent: %s', data)
        return
1014867
def write(self, data):
        
        _complain_ifclosed(self.closed)
        if self.__encoding:
            self.f.write(data.encode(self.__encoding, self.__errors))
            return len(data)
        else:
            return self.f.write(data)
348122
def write(self, data):
        
        data_off = 0
        while data_off < len(data):
            left = len(self._buf) - self._pos
            if left <= 0:
                self._write_packet(final=False)
            else:
                to_write = min(left, len(data) - data_off)
                self._buf[self._pos:self._pos + to_write] = data[data_off:data_off + to_write]
                self._pos += to_write
                data_off += to_write
409146
def write(self, addr, data):
        '''

        '''
        self.set_addr(addr & 0xfe)
        self.set_data(data)
        self.set_size(len(data))
        self.start()
        while not self.is_ready:
            pass
1302078
def write(self, data):
        

        if self.is_closing():
            return

        self._write_buffer += data

        if len(self._write_buffer) >= self._output_buffer_limit_high:
            self._protocol.pause_writing()

        if self._write_buffer:
            self._can_write.set()
564701
def write_data(self, data):
        """"""
        # send data
        for ptr, value in data:
            self._write_byte(ptr, value)
        # set 'data changed'
        self._write_byte(self.fixed_format['data_changed'][0], 0xAA)
        # wait for station to clear 'data changed'
        while True:
            ack = _decode(
                self._read_fixed_block(0x0020), self.fixed_format['data_changed'])
            if ack == 0:
                break
            logger.debug('write_data waiting for ack')
            time.sleep(6)
1281043
def write(self, data):
        
        while data:
            went = self._write_chunk(data)
            if went is None:
                continue
            data = data[went:]
81109
def write(self, data, end="\n", flush=True):
        
        if not self.nostdout:
            self.stdout.write(data+end)
        if self.file is not None:
            self.file.write(data+end)
        if flush:
            self.flush()
1259542
def write(self, data):
        '''
        
        '''
        # MUST use a lock here else gevent could raise an exception if 2
        # greenlets try to write at the same time. I was hoping that
        # sendall() would do that blocking for me, but I guess not. May
        # require an eventsocket-like buffer to speed up under high load.
        self._write_lock.acquire()
        try:
            return super(GeventTransport, self).write(data)
        finally:
            self._write_lock.release()
349559
def __write(self, thePath, theData):
            
        fd = open(thePath, "wb")
        fd.write(theData)
        fd.close()
907091
def write(self, data):
        
        for _ in range(64 - len(data)):
            data.append(0)
        #logging.debug("send: %s", data)
        self.device.write(bytearray([0]) + data)
        return
447001
def write(self, data):
        

        begin, end, size = 0, 0, len(data)
        bytes_sent = 0

        raw_write = super(USBRawDevice, self).write

        while not end > size:
            begin = end
            end = begin + self.RECV_CHUNK
            bytes_sent += raw_write(data[begin:end])

        return bytes_sent
830130
def send(self, data):
        
        self.stdin.write(data)
        self.stdin.flush()
798816
def write(self, data):
        
        try:
            # Hack to support unicode under Python 2.x
            if isinstance(data, str) or (sys.version_info < (3,) and isinstance(data, unicode)):
                data = data.encode('utf-8')

            self._device.write(data)

        except serial.SerialTimeoutException:
            pass

        except serial.SerialException as err:
            raise CommError('Error writing to device.', err)

        else:
            self.on_write(data=data)
1098865
def write(self, data):
        '''
        
        '''
        if not hasattr(self, '_sock'):
            return None

        try:
            self._sock.sendall(data)

            if self.connection.debug > 1:
                self.connection.logger.debug(
                    'sent %d bytes to %s' % (len(data), self._host))

            return
        except EnvironmentError:
            # sockets raise this type of error, and since if sendall() fails
            # we're left in an indeterminate state, assume that any error we
            # catch means that the connection is dead. Note that this
            # assumption requires this to be a blocking socket; if we ever
            # support non-blocking in this class then this whole method has
            # to change a lot.
            self.connection.logger.exception(
                'error writing to %s' % (self._host))

        self.connection.transport_closed(
            msg='error writing to %s' % (self._host))
897457
async function write(data){
    await _serialport.write(data);
    await _serialport.drain();
}