예제 #1
0
int read_le_buffer_size(int s)
{
	ng_hci_le_read_buffer_size_rp rp;
	int e;
	int n = sizeof(rp);
	e = hci_simple_request(s,
			       NG_HCI_OPCODE(NG_HCI_OGF_LE,
					     NG_HCI_OCF_LE_READ_BUFFER_SIZE), 
			       (void *)&rp, &n);
	printf("READ_LE_BUFFER_SIZE %d %d %d %d\n", e, rp.status, rp.hc_le_data_packet_length, 
	       rp.hc_total_num_le_data_packets);
	if(rp.status == 0 && rp.hc_le_data_packet_length==0){
		ng_hci_read_buffer_size_rp brp;
		n = sizeof(brp);
		e = hci_simple_request(s,
				       NG_HCI_OPCODE(NG_HCI_OGF_INFO,
						     NG_HCI_OCF_READ_BUFFER_SIZE), 
				       (void *)&brp, &n);
		printf("READ BUFFER SIZE %d %d %d %d %d %d \n", e, brp.status,
		       brp.max_acl_size,
		       brp.max_sco_size,
		       brp.num_acl_pkt,
		       brp.num_sco_pkt);
		
	}
	return 0;
}
예제 #2
0
파일: info.c 프로젝트: coyizumi/cs111
/* Send Read_Local_Supported_Features command to the unit */
static int
hci_read_local_supported_features(int s, int argc, char **argv)
{
	ng_hci_read_local_features_rp	rp;
	int				n;
	char				buffer[1024];

	n = sizeof(rp);
	if (hci_simple_request(s, NG_HCI_OPCODE(NG_HCI_OGF_INFO,
			NG_HCI_OCF_READ_LOCAL_FEATURES),
			(char *) &rp, &n) == ERROR)
		return (ERROR);

	if (rp.status != 0x00) {
		fprintf(stdout, "Status: %s [%#02x]\n", 
			hci_status2str(rp.status), rp.status);
		return (FAILED);
	}

	fprintf(stdout, "Features: ");
	for (n = 0; n < sizeof(rp.features); n++)
		fprintf(stdout, "%#02x ", rp.features[n]);
	fprintf(stdout, "\n%s\n", hci_features2str(rp.features, 
		buffer, sizeof(buffer)));

	return (OK);
} /* hci_read_local_supported_features */
예제 #3
0
파일: info.c 프로젝트: coyizumi/cs111
/* Send Read_Local_Version_Information command to the unit */
static int
hci_read_local_version_information(int s, int argc, char **argv)
{
	ng_hci_read_local_ver_rp	rp;
	int				n;

	n = sizeof(rp);
	if (hci_simple_request(s, NG_HCI_OPCODE(NG_HCI_OGF_INFO,
			NG_HCI_OCF_READ_LOCAL_VER), (char *) &rp, &n) == ERROR)
		return (ERROR);

	if (rp.status != 0x00) {
		fprintf(stdout, "Status: %s [%#02x]\n", 
			hci_status2str(rp.status), rp.status);
		return (FAILED);
	}

	rp.manufacturer = le16toh(rp.manufacturer);

	fprintf(stdout, "HCI version: %s [%#02x]\n",
		hci_ver2str(rp.hci_version), rp.hci_version);
	fprintf(stdout, "HCI revision: %#04x\n",
		le16toh(rp.hci_revision));
	fprintf(stdout, "LMP version: %s [%#02x]\n",
		hci_lmpver2str(rp.lmp_version), rp.lmp_version);
	fprintf(stdout, "LMP sub-version: %#04x\n", 
		le16toh(rp.lmp_subversion));
	fprintf(stdout, "Manufacturer: %s [%#04x]\n", 
		hci_manufacturer2str(rp.manufacturer), rp.manufacturer);

	return (OK);
} /* hci_read_local_version_information */
예제 #4
0
파일: info.c 프로젝트: coyizumi/cs111
/* Sent Read_Buffer_Size command to the unit */
static int
hci_read_buffer_size(int s, int argc, char **argv)
{
	ng_hci_read_buffer_size_rp	rp;
	int				n;

	n = sizeof(rp);
	if (hci_simple_request(s, NG_HCI_OPCODE(NG_HCI_OGF_INFO,
			NG_HCI_OCF_READ_BUFFER_SIZE),
			(char *) &rp, &n) == ERROR)
		return (ERROR);

	if (rp.status != 0x00) {
		fprintf(stdout, "Status: %s [%#02x]\n", 
			hci_status2str(rp.status), rp.status);
		return (FAILED);
	}

	fprintf(stdout, "Max. ACL packet size: %d bytes\n",
		le16toh(rp.max_acl_size));
	fprintf(stdout, "Number of ACL packets: %d\n",
		le16toh(rp.num_acl_pkt));
	fprintf(stdout, "Max. SCO packet size: %d bytes\n",
		rp.max_sco_size);
	fprintf(stdout, "Number of SCO packets: %d\n",
		le16toh(rp.num_sco_pkt));
	
	return (OK);
} /* hci_read_buffer_size */
예제 #5
0
int le_read_supported_status(int s)
{
	ng_hci_le_read_supported_status_rp rp;
	int e;
	int n = sizeof(rp);
	e = hci_simple_request(s,
			       NG_HCI_OPCODE(NG_HCI_OGF_LE,
					     NG_HCI_OCF_LE_READ_SUPPORTED_STATUS), 
			       (void *)&rp, &n);
	printf("LE_STATUS:%d %d %lx\n", e, rp.status, rp.le_status);

	return 0;

}
예제 #6
0
int le_read_local_supported_features(int s)
{
	ng_hci_le_read_local_supported_features_rp rp;
	int e;
	int n = sizeof(rp);
	e = hci_simple_request(s,
			       NG_HCI_OPCODE(NG_HCI_OGF_LE,
					     NG_HCI_OCF_LE_READ_LOCAL_SUPPORTED_FEATURES), 
			       (void *)&rp, &n);
	printf("LOCAL SUPPOREDED:%d %d %lu\n", e, rp.status, rp.le_features);

	return 0;

}
예제 #7
0
파일: le_test.c 프로젝트: i10a/le_test
/**
   Read BD_ADDR

   Vol2/Part E/7.4.6
 */
static int
read_bd_addr(int s, bdaddr_t *bdaddr)
{
  ng_hci_read_bdaddr_rp rp;
  int n = sizeof(rp);
  int e = hci_simple_request(s,
                             NG_HCI_OPCODE(NG_HCI_OGF_INFO,
                                           NG_HCI_OCF_READ_BDADDR),
                             (void *)&rp, &n);
  if(e == 0){
    if(bdaddr)
      memcpy(bdaddr, &(rp.bdaddr), sizeof(*bdaddr));
    char buf[18];

    bt_ntoa(&(rp.bdaddr), buf);
    printf("* Read_BD_ADDR: %s\n", buf);
  }
  return e;
}
예제 #8
0
파일: le_test.c 프로젝트: i10a/le_test
/**
   Read Buffer Size

   Vol2/Part E/7.4.5
 */
static int
read_buffer_size(int s)
{
  ng_hci_read_buffer_size_rp brp;
  int n, e;

  n = sizeof(brp);
  e = hci_simple_request(s,
                         NG_HCI_OPCODE(NG_HCI_OGF_INFO,
                                       NG_HCI_OCF_READ_BUFFER_SIZE),
                         (void *)&brp, &n);
  printf("* Read_Buffer_Size: %d %d %d %d %d %d \n", e, brp.status,
         brp.max_acl_size,
         brp.max_sco_size,
         brp.num_acl_pkt,
         brp.num_sco_pkt);

  return e;
}
예제 #9
0
파일: le_test.c 프로젝트: i10a/le_test
/**
   LE Read Buffer Size

   Vol2/Part E/7.8.2
 */
static int
le_read_buffer_size(int s)
{
  ng_hci_le_read_buffer_size_rp rp;
  int n, e;

  n = sizeof(rp);
  e = hci_simple_request(s,
                         NG_HCI_OPCODE(NG_HCI_OGF_LE,
                                       NG_HCI_OCF_LE_READ_BUFFER_SIZE),
                         (void *)&rp, &n);

  printf("* LE_Read_Buffer_Size: %d %d %d %d\n", e, rp.status, rp.hc_le_data_packet_length,
         rp.hc_total_num_le_data_packets);

  if(rp.status == 0 && rp.hc_le_data_packet_length == 0)
    read_buffer_size(s);

  return e;
}
예제 #10
0
파일: info.c 프로젝트: coyizumi/cs111
/* Send Read_BD_ADDR command to the unit */
static int
hci_read_bd_addr(int s, int argc, char **argv)
{
	ng_hci_read_bdaddr_rp	rp;
	int			n;

	n = sizeof(rp);
	if (hci_simple_request(s, NG_HCI_OPCODE(NG_HCI_OGF_INFO,
			NG_HCI_OCF_READ_BDADDR), (char *) &rp, &n) == ERROR)
		return (ERROR);

	if (rp.status != 0x00) {
		fprintf(stdout, "Status: %s [%#02x]\n", 
			hci_status2str(rp.status), rp.status);
		return (FAILED);
	}

	fprintf(stdout, "BD_ADDR: %s\n", bt_ntoa(&rp.bdaddr, NULL));

	return (OK);
} /* hci_read_bd_addr */
예제 #11
0
파일: info.c 프로젝트: coyizumi/cs111
/* Send Read_Country_Code command to the unit */
static int
hci_read_country_code(int s, int argc, char **argv)
{
	ng_hci_read_country_code_rp	rp;
	int				n;

	n = sizeof(rp);
	if (hci_simple_request(s, NG_HCI_OPCODE(NG_HCI_OGF_INFO,
			NG_HCI_OCF_READ_COUNTRY_CODE),
			(char *) &rp, &n) == ERROR)
		return (ERROR);

	if (rp.status != 0x00) {
		fprintf(stdout, "Status: %s [%#02x]\n", 
			hci_status2str(rp.status), rp.status);
		return (FAILED);
	}

	fprintf(stdout, "Country code: %s [%#02x]\n",
			hci_cc2str(rp.country_code), rp.country_code);

	return (OK);
} /* hci_read_country_code */