--- /dev/null
+/*
+* C Implementation: slavetest
+*
+* Description:
+*
+*
+* Author: root <root@ubuntu>, (C) 2008
+*
+* Copyright: See COPYING file that comes with this distribution
+*
+*/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include <string.h>
+#include <errno.h>
+#include <unistd.h>
+#include <sys/poll.h>
+#include <sys/ioctl.h>
+#include "hcidriver.h"
+
+cmd_state_request array_req[MAX_CMD_STATE_REQUEST];
+int cmd_req_id;
+int global_index;
+
+int req_fcn_add(cmd_state_request *p_req){ //fcn add the request at the end of array or replace the oldest request
+ int i,sig=0,index=0;
+ cmd_state_request the_oldest=array_req[0];
+
+ for(i=0;i<MAX_CMD_STATE_REQUEST;i++){
+ if((array_req[i].actual_status)==0 || array_req[i].actual_status==3 ){
+ array_req[i]=*p_req;
+ sig=1;
+ global_index=i;
+ break;
+ }
+ if((array_req[i].id) < the_oldest.id){ //the smallest id (oldest request) will stay here
+ the_oldest = array_req[i];
+ index=i;
+
+ }
+ }
+ if(!sig){
+ //return -1;
+ array_req[index]=*p_req;
+ global_index=index;
+ }
+ return 0;
+}
+
+void rutine_con_req(void *arg){
+
+
+}
+
+
+
+
+int main(void){
+
+ cmd_state_request new_req,*p_new_req=&new_req;
+ memset(array_req,0,(sizeof(cmd_state_request)*MAX_CMD_STATE_REQUEST));
+ cmd_req_id=0;
+ global_index=0;
+
+ p_new_req->id=cmd_req_id++;
+ //p_new_req->req_opcode = ocf_ogf;
+ p_new_req->evt_code = EVT_CONN_REQUEST;
+ p_new_req->p_serv_rutine=&rutine_con_req;
+
+
+
+ while(1){
+
+
+ }
+
+return 0;
+}