\r
/*********************************************************************************/\r
\r
-/*navratove hodnoty\r
- 0 = OK - prikaz odstranen z fronty\r
- -1 = fronta prohledana, ale nebyl tam nalezen hledany OBCOD\r
- +num = index overovane polozky v poli "bth_pole_adrr_check_packet" s hledanym obcodem\r
+/*return values\r
+ 0 = OK - command removed from the queue\r
+ -1 = the queue was searched but the OPCODE was not found\r
+ +num = an index of verified item in array "bth_pole_adrr_check_packet" with the searched opcode\r
*/\r
int bth_del_event(uint16_t opcode)\r
{\r
};\r
\r
/****************************************************************************/\r
-/*------------------------ JEDNOTLIVE EVENT FUNKCE -------------------------*/\r
+/*------------------------ INDIVIDUAL EVENT FUNCTIONS ----------------------*/\r
/****************************************************************************/\r
/****************************************************************************/\r
-/*navratovo hodnoty\r
- 0 = vse OK\r
- 1 = polozka nenalezena\r
- 2 = v potvrzovaci fronte nebyly zadne prikazy k potvrzeni\r
- 3 = status vykazuje chybu prikazu\r
+/*returned values\r
+ 0 = everything OK\r
+ 1 = field not found\r
+ 2 = there was no commands in the confirmation queue to confirm\r
+ 3 = status embody an error of the command\r
*/\r
-int bth_evt_none(uint8_t *bth_p, uint8_t size) //fce s neex. indexem evt codu\r
+int bth_evt_none(uint8_t *bth_p, uint8_t size) //func with nonexisting index of event code\r
{\r
return -4;\r
};\r
bths_connect_bluet *bth_q;\r
int j;\r
\r
- for(j=0; j<=8;j++) //8 moznych zarizeni, se kterymi lze komunikovat\r
+ for(j=0; j<=8;j++) //8 possible devices, witch which we can comunicate\r
{\r
if(bth_connected[j]==NULL)\r
{break;};\r
}\r
- if(j==9){return (-1);}; //je mozno komunikovat pouze s 8-mi zarizenimi, toto je devate\r
- /*uvedu zarizeni do seznamu pripojenych zarizeni*/\r
+ if(j==9){return (-1);}; //it is possible to communicate with 8 devices at maximum. This one is the 9th one.\r
+ /* Add the device to the list od connected devices.*/\r
bth_connected[j]=(bths_connect_bluet*)calloc(1,sizeof(bths_connect_bluet));\r
bth_q=(bths_connect_bluet*)bth_connected[j];\r
- /*naplnim strukturu pripojeneho zarizeni informacemi o vzdalenem bth*/\r
+ /*Fill the structure of the connected device with information on remote device*/\r
memcpy(&(bth_q->bdaddr),(uint8_t*)bth_p+EVT_CONN_COMPLETE____bdaddr,sizeof(bdaddr_t));\r
// store_le16(&(bth_q->handle),(uint16_t)*(uint16_t*)((uint8_t*)bth_p+EVT_CONN_COMPLETE____handle));\r
__bthtomc16((uint8_t*)&(bth_q->handle),((uint8_t*)bth_p+EVT_CONN_COMPLETE____handle));\r
store16(bth_q->link_type,*((uint8_t*)bth_p+EVT_CONN_COMPLETE____link_type));\r
store16(bth_q->encr_mode,*((uint8_t*)bth_p+EVT_CONN_COMPLETE____encr_mode));\r
\r
- bth_cmd_write_link_policy_settings(bth_q->handle,htobs(0x000f)); //odpoved\r
+ bth_cmd_write_link_policy_settings(bth_q->handle,htobs(0x000f)); //reply\r
return (*((uint8_t*)bth_p+EVT_CONN_COMPLETE____status));\r
};\r
\r
{\r
bdaddr_t bdaddr;\r
// evt_conn_request bth_q;\r
- /*BD adresa zadajiciho zarizeni*/\r
+ /*BD address of requesting device*/\r
memcpy(&bdaddr,(uint8_t*)bth_p+EVT_CONN_REQUEST____bdaddr,sizeof(bdaddr_t));\r
// if(bth_seach_bdaddr(&bdaddr,&(bth_accept_bd_addr[0]),1));\r
bth_accept_conn_req_cp(&bdaddr);\r
}\r
else\r
{\r
- if(size-EVT_CMD_COMPLETE_SIZE==1) /*jedna se pouze o potvrzeni - status*/\r
+ if(size-EVT_CMD_COMPLETE_SIZE==1) /* this is just a confirmation - status*/\r
{\r
if(*((uint8_t*)bth_p+3)==0)\r
{\r
free(bth_pole_adrr_check_packet[index]);\r
bth_pole_adrr_check_packet[index]=NULL;\r
bth_local_info.busy=0;\r
- return 0; //prikaz probehl bez komplikaci\r
+ return 0; //no complications was encountered during command execution\r
}\r
else\r
{\r
- /*status neni OK - nastala chyba - odeslany comand prikaz je stale ve fronte k potvrzeni*/\r
+ /*status is not OK - an error occured - the sent command is still in the confirmation queue */\r
free(bth_pole_adrr_check_packet[index]);\r
bth_pole_adrr_check_packet[index]=NULL;\r
bth_local_info.busy=0;\r
}\r
else\r
{\r
- /*rozdelim obcode na OGF a OCF a prevedu na jednobytovou promenou*/\r
+ /*I split to obcode to OGF and OCF and convert it to an one-byte variable*/\r
// store_le16(&opcode,*(uint16_t*)((uint8_t*)bth_p+EVT_CMD_COMPLETE____opcode));\r
__bthtomc16((uint8_t*)&(opcode),((uint8_t*)bth_p+EVT_CMD_COMPLETE____opcode));\r
\r
case 0x02 :\r
bth_local_info.busy=0;\r
if(ocf<BTH_OGF_02_FC)\r
- return (bth_info_fce_ogf_02[ocf](((uint8_t*)bth_p+EVT_CMD_COMPLETE____opcode+2),size-EVT_CMD_COMPLETE_SIZE)); //cislo 0x00 je smysleno\r
+ return (bth_info_fce_ogf_02[ocf](((uint8_t*)bth_p+EVT_CMD_COMPLETE____opcode+2),size-EVT_CMD_COMPLETE_SIZE)); //the number 0x00 is a random guess\r
else return (-4);\r
case 0x03 :\r
bth_local_info.busy=0;\r
if(ocf<BTH_OGF_03_FC)\r
- return (bth_info_fce_ogf_03[ocf](((uint8_t*)bth_p+EVT_CMD_COMPLETE____opcode+2),size-EVT_CMD_COMPLETE_SIZE)); //cislo 0x00 je smysleno\r
+ return (bth_info_fce_ogf_03[ocf](((uint8_t*)bth_p+EVT_CMD_COMPLETE____opcode+2),size-EVT_CMD_COMPLETE_SIZE)); //the number 0x00 is a random guess\r
else return (-4);\r
\r
case 0x04 :\r
bth_local_info.busy=0;\r
if(ocf<BTH_OGF_04_FC)\r
- return (bth_info_fce_ogf_04[ocf](((uint8_t*)bth_p+EVT_CMD_COMPLETE____opcode+2),size-EVT_CMD_COMPLETE_SIZE)); //cislo 0x00 je smysleno\r
+ return (bth_info_fce_ogf_04[ocf](((uint8_t*)bth_p+EVT_CMD_COMPLETE____opcode+2),size-EVT_CMD_COMPLETE_SIZE)); //the number 0x00 is a random guess\r
else return (-4);\r
\r
};\r
}\r
else\r
{\r
- if(size-EVT_CMD_STATUS_SIZE==0) /*jedna se pouze o potvrzeni - status*/\r
+ if(size-EVT_CMD_STATUS_SIZE==0) /*this is just a confirmation - status*/\r
{\r
if(bth_q.status==0)\r
{\r
}\r
else\r
{\r
- /*status neni OK - nastala chyba - odeslany comand prikaz je stale ve fronte k potvrzeni*/\r
+ /*status is not OK - an error occured - the sent command is still in the confirmation queue */\r
free(bth_pole_adrr_check_packet[index]);\r
bth_pole_adrr_check_packet[index]=NULL;\r
};\r
}\r
else\r
{\r
- /*rozdelim obcode na OGF a OCF a prevedu na jednobytovou promenou*/\r
+ /*rozdelim obcode na OGF a OCF a prevedu na jednobytovou promenou*/ //same comment as in previous function\r
ogf=(uint8_t)cmd_opcode_ogf((uint16_t)*(uint16_t*)((uint8_t*)bth_p+EVT_CMD_COMPLETE____opcode));\r
ocf=(uint8_t)cmd_opcode_ocf((uint16_t)*(uint16_t*)((uint8_t*)bth_p+EVT_CMD_COMPLETE____opcode));\r
+/*This is a little more complicated cmd_status, which stores data inside and not the end. Other functions are split according to the obcode. Currently, functions are not implemented, only the "guidepost" is done.*/\r
/*jedna se o slozitejsi cmd_status, ktery sebou nese i data, nikoliv zaver, dalsi fce jsou deleny podle\r
obcodu. Fce nejsou napsany, je udelany pouze rozcestnik*/\r
switch(ogf) \r
case 0x04 : break;\r
};\r
};\r
- bth_local_info.busy=0; //NOTE predelat, neni vzdycky pravda\r
+ bth_local_info.busy=0; //NOTE do it differently, not always true\r
\r
};\r
return(bth_q.status);\r
uint16_t handle,num_pkt;\r
int i,j;\r
store16(bth_q.num_hndl,*((uint8_t*)bth_p+EVT_NUM_COMP_PKTS____num_hndl));\r
+/*Search through all devices with which the communications was started???*/\r
/*prohledam vsechna zarizeni, se kterymi mam uzavrenou komunikaci*/\r
for(j=0; j<(bth_q.num_hndl);j++)\r
{\r
// store_le16(&bth_q.max_slots,*((uint16_t*)((uint8_t*)bth_p+EVT_MAX_SLOTS_CHANGE____max_slots)));\r
__bthtomc16((uint8_t*)&(bth_q.max_slots),(uint8_t*)bth_p+EVT_MAX_SLOTS_CHANGE____max_slots);\r
\r
+/*Search through all devices with which the communications was started???*/\r
/*prohledam vsechna zarizeni, se kterymi mam uzavrenou komunikaci*/\r
for(i=0;i<8;i++)\r
{\r
__bthtomc16((uint8_t*)&(bth_q.ptype),(uint8_t*)bth_p+EVT_CONN_PTYPE_CHANGED____ptype);\r
\r
dev_num=bth_find_conected_dev(bth_q.handle);\r
-//bth_local_info.pkt_type; - localni info o paketech\r
-// Change_Connection_Packet_Type - cmd prikaz, kterym se pripadne daji nastavit svoje packety\r
+//bth_local_info.pkt_type; - local info on packets\r
+// Change_Connection_Packet_Type - command, which can in case of need setup its packets\r
+//skterym se pripadne daji nastavit svoje packety\r
if(dev_num>-1);\r
{\r
bth_connected[dev_num]->ptype=bth_q.ptype;\r
memcpy(&(bth_q.bdaddr),(uint8_t*)bth_p+EVT_PSCAN_REP_MODE_CHANGE____bdaddr,sizeof(bdaddr_t));\r
store16(bth_q.pscan_rep_mode,*((uint8_t*)bth_p+EVT_PSCAN_REP_MODE_CHANGE____pscan_rep_mode));\r
\r
+ /*Search through all devices with which the communications was started, needs to be written up */\r
/*prohledam vsechna zarizeni dle BDADDR, se kterymi mam uzavrenou komunikaci -NUTNO DOPSAT NOTE*/\r
//memcpy\r
\r