Ejemplo n.º 1
0
bool ICard::readFile(
	unsigned char sfid,
	size_t chunk_size,
	std::vector<unsigned char>& result)
{
	ReadBinary read = ReadBinary(0, sfid);
	read.setNe(chunk_size);
	RAPDU response = transceive(read);

	while (response.isOK() && response.getData().size() == chunk_size) {
		result.insert(result.end(), response.getData().begin(), response.getData().end());

		read = ReadBinary(result.size());
		read.setNe(chunk_size);
		response = transceive(read);
	}

	result.insert(result.end(), response.getData().begin(), response.getData().end());

	if (result.empty()) {
		return response.isOK();
	}

	return true;
}
Ejemplo n.º 2
0
bool ICard::selectEF(
	unsigned short FID)
{
	SelectFile select(SelectFile::P1_SELECT_EF, SelectFile::P2_NO_RESPONSE, FID);
	RAPDU response = transceive(select);
	return response.isOK();
}
Ejemplo n.º 3
0
bool ICard::selectMF(
	void)
{
	SelectFile select(SelectFile::P1_SELECT_FID, SelectFile::P2_NO_RESPONSE);
	RAPDU response = transceive(select);
	return response.isOK();
}
Ejemplo n.º 4
0
static int spi_nrfx_transceive(struct device *dev,
			       const struct spi_config *spi_cfg,
			       const struct spi_buf_set *tx_bufs,
			       const struct spi_buf_set *rx_bufs)
{
	spi_context_lock(&get_dev_data(dev)->ctx, false, NULL);
	return transceive(dev, spi_cfg, tx_bufs, rx_bufs);
}
Ejemplo n.º 5
0
static int spi_nrfx_transceive_async(struct device *dev,
				     const struct spi_config *spi_cfg,
				     const struct spi_buf_set *tx_bufs,
				     const struct spi_buf_set *rx_bufs,
				     struct k_poll_signal *async)
{
	spi_context_lock(&get_dev_data(dev)->ctx, true, async);
	return transceive(dev, spi_cfg, tx_bufs, rx_bufs);
}
Ejemplo n.º 6
0
static int spi_dw_transceive(struct device *dev,
		      const struct spi_config *config,
			     const struct spi_buf_set *tx_bufs,
			     const struct spi_buf_set *rx_bufs)
{
	LOG_DBG("%p, %p, %p", dev, tx_bufs, rx_bufs);

	return transceive(dev, config, tx_bufs, rx_bufs, false, NULL);
}
Ejemplo n.º 7
0
bool ICard::readFile(
	std::vector<unsigned char>& result)
{
	ReadBinary read = ReadBinary();
	read.setNe(CAPDU::DATA_EXTENDED_MAX);
	RAPDU response = transceive(read);
	result = response.getData();
	return response.isOK();
}
Ejemplo n.º 8
0
static int spi_dw_transceive_async(struct device *dev,
				   const struct spi_config *config,
				   const struct spi_buf_set *tx_bufs,
				   const struct spi_buf_set *rx_bufs,
				   struct k_poll_signal *async)
{
	LOG_DBG("%p, %p, %p, %p", dev, tx_bufs, rx_bufs, async);

	return transceive(dev, config, tx_bufs, rx_bufs, true, async);
}
Ejemplo n.º 9
0
NTSTATUS pipe_client_t::fs_control( event_t* event, IO_STATUS_BLOCK iosb, ULONG FsControlCode,
		 PVOID InputBuffer, ULONG InputBufferLength, PVOID OutputBuffer, ULONG OutputBufferLength )
{
	dprintf("pipe_client_t %08lx\n", FsControlCode);

	if (FsControlCode == FSCTL_PIPE_TRANSCEIVE)
		return transceive( InputBuffer, InputBufferLength, OutputBuffer, OutputBufferLength );

	return STATUS_INVALID_PARAMETER;
}
Ejemplo n.º 10
0
bool ICard::selectEF(
	unsigned short FID,
	std::vector<unsigned char>& fcp)
{
	SelectFile select(SelectFile::P1_SELECT_EF, SelectFile::P2_FCP_TEMPLATE, FID);
	select.setNe(CAPDU::DATA_SHORT_MAX);
	RAPDU response = transceive(select);
	fcp = response.getData();
	return response.isOK();
}