int main(int argc, char *argv[]) { srand((int)time(NULL)); address_initialization(); account_register_toBank(); int balance = eCent_balance(); if (balance == 0) { printf("Balance is equal to 0, get 50 from the bank.\n"); eCent_get(50); }else { printf("eCent Balance: %d\n", balance); } int available_result = list_available(); if (available_result != 0) { return 1; } //generate the data. char rand_data[DATA_LENGTH+1]; rand_data[0] = '\0'; random_data(rand_data); //before the final step start, call the bank to transfer the eCent. int transfer_result = eCent_transfer_toAnalysis(); if (transfer_result != 0) { return transfer_result; } int analysis_result = request_analysis(rand_data); if (analysis_result != 0) { return analysis_result; } return 0; }
at_error_t set_cnti (at_modem_t *modem, const char *req, void *data) { switch (atoi (req)) { case 0: /* currently in use */ return list_active (modem, data); case 1: /* currently available */ return list_available (modem, data); case 2: /* supported by the device */ /* FIXME: do not hard-code this... */ at_intermediate (modem, "\r\n*CNTI: 2,GSM,GPRS,EDGE,UMTS,HSDPA,HSUPA"); return AT_OK; } (void) data; return AT_CME_ENOTSUP; }