1#include<stdio.h> 2#include<stdlib.h> 3#include<string.h> 4#include "DeviceInfo.H" 5#include "GeneratePassword.H" 6 7using namespace std; 8 9int main(int argc, char *argv[]) 10{ 11 GeneratePassword gp; 12 13 if (argv[1] != NULL) { 14 15 if (strcmp(argv[1], "--help") == 0) { 16 printf("Usage: GeneratePassword [IMEI] [SERVER_ID]\n\n"); 17 printf("Example: GeneratePassword 000000011234564 motorola\n\n"); 18 printf("Default: IMEI = 123456789012345\n"); 19 printf(" SERVER_ID = openwave.com\n"); 20 exit(0); 21 } 22 23 char * imei = argv[1]; 24 gp.setIMEI((const char *)imei); 25 26 if (argv[2] != NULL) { 27 char * serverId = argv[2]; 28 gp.setServerId((const char *)serverId); 29 } 30 } 31 32 DeviceInfo deviceInfo; 33 deviceInfo.setIMEI(gp.getIMEI()); 34 deviceInfo.setServerId(gp.getServerId()); 35 deviceInfo.setClientPassword(gp.generateClientPassword()); 36 deviceInfo.setServerPassword(gp.generateServerPassword()); 37 38 printf("[Device Info]\n"); 39 printf("IMEI: %s\n", deviceInfo.getIMEI()); 40 printf("Device ID: %s\n", deviceInfo.getDeviceId()); 41 printf("Server ID: %s\n", deviceInfo.getServerId()); 42 printf("User Name: %s\n", deviceInfo.getUserName()); 43 printf("Client Password: %s\n", deviceInfo.getClientPassword()); 44 printf("Server Password: %s\n", deviceInfo.getServerPassword()); 45 46 return 0; 47} 48