lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame^] | 1 | #include <stdio.h> |
| 2 | #include <string.h> |
| 3 | #include <stdlib.h> |
| 4 | #include <unistd.h> |
| 5 | |
| 6 | #include "softap_api.h" |
| 7 | #include "lpa_api.h" |
| 8 | |
| 9 | int main(int argc, char *argv[]) |
| 10 | { |
| 11 | int poll_num = 1; |
| 12 | int poll_interval = 0; |
| 13 | |
| 14 | printf("##zte_lpa start##\n"); |
| 15 | |
| 16 | if (-1 == lpa_init()) { |
| 17 | printf("lpa init fail!\n"); |
| 18 | return -1; |
| 19 | } |
| 20 | |
| 21 | lpa_exception_process(); |
| 22 | |
| 23 | do { |
| 24 | int next_step = 0; |
| 25 | char *command = NULL; |
| 26 | //dtest |
| 27 | //char activecode[] = "1$esim.wo.cn$$1.3.6.1.4.1.47814.2.4"; |
| 28 | //lpa_download_profile(activecode, NULL); |
| 29 | //lpa_enable_profile("98689091170012145989"); |
| 30 | //lpa_memory_reset(); |
| 31 | //return 0; |
| 32 | command = lpa_trigger_event(&next_step); |
| 33 | |
| 34 | switch (next_step) { |
| 35 | case 1: |
| 36 | lpa_download_profile(command, NULL); |
| 37 | break; |
| 38 | case 2: |
| 39 | lpa_enable_profile(command); |
| 40 | break; |
| 41 | case 3: |
| 42 | lpa_disable_profile(command); |
| 43 | break; |
| 44 | case 4: |
| 45 | lpa_delete_profile(command); |
| 46 | break; |
| 47 | case 5: |
| 48 | lpa_memory_reset(); |
| 49 | break; |
| 50 | |
| 51 | default: |
| 52 | break; |
| 53 | } |
| 54 | if (command != NULL) |
| 55 | free(command); |
| 56 | |
| 57 | sleep(poll_interval); |
| 58 | poll_num--; |
| 59 | } while (poll_num > 0); |
| 60 | |
| 61 | lpa_uninit(); |
| 62 | printf("##zte_lpa end##\n"); |
| 63 | return 0; |
| 64 | } |
| 65 | |