mirror of
https://github.com/lakinduakash/linux-wifi-hotspot.git
synced 2024-11-21 19:40:11 +00:00
Run qrencode command
This commit is contained in:
parent
211610d3e7
commit
00a0b678dc
@ -62,6 +62,8 @@ static char accepted_macs[BUFSIZE];
|
|||||||
static const char* g_ssid=NULL;
|
static const char* g_ssid=NULL;
|
||||||
static const char* g_pass=NULL;
|
static const char* g_pass=NULL;
|
||||||
|
|
||||||
|
static char* qr_image_path;
|
||||||
|
|
||||||
//config_t cfg;
|
//config_t cfg;
|
||||||
|
|
||||||
static int parse_output(const char *cmd) {
|
static int parse_output(const char *cmd) {
|
||||||
@ -424,6 +426,36 @@ char** get_wifi_interface_list(int *length){
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char* generate_qr_image(char* ssid,char* type,char *password){
|
||||||
|
char cmd[BUFSIZE];
|
||||||
|
|
||||||
|
qr_image_path = "/tmp/wihotspot_qr.png";
|
||||||
|
|
||||||
|
snprintf(cmd, BUFSIZE, "%s -V -s 10 -d 256 -o %s 'WIFI:S:%s;T:%s;P:%s;;' ","qrencode",qr_image_path, ssid,type,password);
|
||||||
|
|
||||||
|
FILE *fp;
|
||||||
|
|
||||||
|
char temp_buff[1048];
|
||||||
|
|
||||||
|
if ((fp = popen(cmd, "r")) == NULL) {
|
||||||
|
printf("Error opening pipe!\n");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
while (fgets(temp_buff, sizeof(temp_buff), fp) != NULL) {
|
||||||
|
|
||||||
|
printf("%s", temp_buff);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pclose(fp)) {
|
||||||
|
printf("Error executing qrencode\n");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return qr_image_path;
|
||||||
|
}
|
||||||
|
|
||||||
Node get_connected_devices(char *PID)
|
Node get_connected_devices(char *PID)
|
||||||
{
|
{
|
||||||
char cmd[BUFSIZE];
|
char cmd[BUFSIZE];
|
||||||
|
@ -71,6 +71,8 @@ void write_accepted_macs(char* filename, char* accepted_macs);
|
|||||||
|
|
||||||
char * read_mac_filter_file(char * filename);
|
char * read_mac_filter_file(char * filename);
|
||||||
|
|
||||||
|
char* generate_qr_image(char* ssid,char* type,char *password);
|
||||||
|
|
||||||
Node get_connected_devices(char *PID);
|
Node get_connected_devices(char *PID);
|
||||||
PtrToNode add_device_node(Node l, int number, char *line, int marker[3]);
|
PtrToNode add_device_node(Node l, int number, char *line, int marker[3]);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user