| #include <stdio.h> |
| #include <stdlib.h> |
| #include <unistd.h> |
| #include <sys/time.h> |
| |
| #include <time.h> |
| #include "mbtk_info_api.h" |
| |
| int lynq_get_time_sec(char *time_t) |
| { |
| struct timeval tv; |
| int ret=gettimeofday(&tv,NULL); |
| sprintf(time_t, "%ld", tv.tv_sec); |
| return 0; |
| } |
| |
| int lynq_imet_get(char *imei_t) |
| { |
| static mbtk_info_handle_t* info_handle = NULL; |
| info_handle = mbtk_info_handle_get(); |
| if(!info_handle) |
| { |
| return -1; |
| } |
| |
| int err; |
| err = mbtk_imei_get(info_handle, imei_t); |
| if(err) { |
| // printf("Error : %d\n", err); |
| return -1; |
| } else { |
| // printf("IMEI : %s\n", imei_t); |
| } |
| return 0; |
| } |
| |
| |
| int lynq_get_chip_id(char *chip_id) |
| { |
| char time[50]={0}; |
| char imei[50]={0}; |
| int ret = 0; |
| lynq_get_time_sec(time); |
| ret = lynq_imet_get(imei); |
| if(!ret) |
| { |
| sprintf(chip_id,"%s%s",imei, time); |
| // printf("%s\n",chip_id ); |
| } |
| else{ |
| return -1; |
| } |
| |
| return 0; |
| } |
| |
| |
| |