lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 1 | #ifndef DOXYGEN_SHOULD_SKIP_THIS |
| 2 | /*! \mainpage |
| 3 | * |
| 4 | * <pre> |
| 5 | * ZX7520V3ƽ̨AP½Ó¿Ú£¬°üº¬ÒÔÏÂÍ·Îļþ£º |
| 6 | * softap_api.h£º ÉϲãÓ¦Óù«¹²Í·Îļþ£¬ÉϲãÓ¦Óÿª·¢°üº¬´ËÎļþ¼´¿É |
| 7 | * message.h£º ¶¨ÒåÓ¦Óù«¹²ÏûÏ¢¶ÓÁÐkey, ÏûÏ¢Ìå, ÏûÏ¢ÃüÁîID, ·¢ËÍÏûÏ¢µÄAPI½Ó¿Ú |
| 8 | * softap_log.h£º ÉϲãÓ¦ÓÃlogÏà¹Ø½Ó¿Ú |
| 9 | * netapi.h£º ÍøÂçÄ£¿é¶ÔÍ⹫¹²½Ó¿Ú |
| 10 | * cfg_api.h£º AP²àÓ¦ÓÃNV¶Áд½Ó¿Ú |
| 11 | * soft_timer.h£º Èí¼þ¶¨Ê±Æ÷½Ó¿Ú |
| 12 | * rtc_timer.h: rtc¶¨Ê±Æ÷½Ó¿Ú£¬ÊµÊ±¶¨Ê±Æ÷£¬»á»½ÐÑϵͳ |
| 13 | * at_msg.h£º at_ctlÄ£¿éµÄÏûÏ¢idºÍÏûÏ¢½á¹¹¶¨Òå |
| 14 | * at_reg.h£º at_ctlÄ£¿é¿Í»§¶ËºÍ·þÎñ¶Ë×¢²á½Ó¿Ú |
| 15 | * at_utils.h£º at_ctlÄ£¿éÉú³ÉAT¶¯×÷Àà¡¢²éѯÀàÇëÇó¼°ÏìÓ¦½Ó¿Ú |
| 16 | * user_msg.h£º AT¿Í»§¶Ë¡¢·þÎñ¶Ë¿ª·¢Ê¾Àý´úÂ룬½ö¹©²Î¿¼ |
| 17 | * </pre> |
| 18 | */ |
| 19 | #endif |
| 20 | |
| 21 | /** |
| 22 | * @file softap_api.h |
| 23 | * @brief ÉϲãÓ¦Óù«¹²Í·Îļþ£¬ÉϲãÓ¦Óÿª·¢°üº¬´ËÎļþ¼´¿É |
| 24 | * |
| 25 | * Copyright (C) 2017 Sanechips Technology Co., Ltd. |
| 26 | * @author |
| 27 | * |
| 28 | * This program is free software; you can redistribute it and/or modify |
| 29 | * it under the terms of the GNU General Public License version 2 as |
| 30 | * published by the Free Software Foundation. |
| 31 | * |
| 32 | */ |
| 33 | #ifndef __SOFTAP_API_H__ |
| 34 | #define __SOFTAP_API_H__ |
| 35 | |
| 36 | #include "os_type_def.h" |
| 37 | #include "zxic_list.h" |
| 38 | #include "cfg_api.h" |
| 39 | #include "rtc_timer.h" |
| 40 | #include "soft_timer.h" |
| 41 | #include "wlan_interface.h" |
| 42 | #include "zxic_errno.h" |
| 43 | #include "netapi.h" |
| 44 | #include "netioctl.h" |
| 45 | #include "netotherapi.h" |
| 46 | #include "at_reg.h" |
| 47 | #include "at_utils.h" |
| 48 | #include "at_msg.h" |
| 49 | #include "at_pdp_api.h" |
| 50 | #include "at_other_api.h" |
| 51 | #include "sms_msg.h" |
| 52 | #include "pb_msg.h" |
| 53 | #include "mainctl_msg.h" |
| 54 | #include "mmi_msg.h" |
| 55 | #include "wifi_msg.h" |
| 56 | #include "other_msg.h" |
| 57 | #include "max_macro.h" |
| 58 | #include <syslog.h> |
| 59 | #include "softap_log.h" |
| 60 | #include "audio_res_ctrl.h" |
| 61 | #include "lq_msg.h" |
| 62 | #include <sys/prctl.h> |
| 63 | #include <sys/sysinfo.h> |
| 64 | |
| 65 | #define _GNU_SOURCE |
| 66 | |
| 67 | /** |
| 68 | * @brief ¶¨ÒåÆ½Ì¨´íÎóÂë |
| 69 | * 3GPP±ê×¼ATÃüÁîµÄ´íÎóÂ뷶Χ0-277, 6000-8000,¾ßÌå´íÎóÔÒò¿É²é¿´¡¶ZX297520V3ƽ̨ATÃüÁîÊÖ²á.doc¡·¸½Â¼A |
| 70 | * @param AT_PARSE_OK parse_param²ÎÊý½âÎöÕýÈ· |
| 71 | * @param ATERR_ZXIC_ERR ÖÐÐË΢оƬ·¢ÉúÒì³££¬ÇÒÎÞ·¨»Ö¸´£¬ÐèÒª½øÐÐÕû»úÖØÆô |
| 72 | * @param ATERR_PARAM_INVALID ÃüÁî²ÎÊýϸ½Ú²»¶Ô£¬Óë¾ßÌåATÃüÁî½ô¹ØÁª |
| 73 | * @param ATERR_NOT_ALLOWED Óë¾ßÌåÒµÎñÁ÷³Ì³åÍ»£¬²Ù×÷²»ÔÊÐí |
| 74 | * @param ATERR_PROC_FAILED ÃüÁî´¦Àíʧ°Ü£¬ÊôÓÚsoftapϵͳÒì³££¬ÈçÏûÏ¢·¢ËÍʧ°ÜµÈ |
| 75 | * @param ATERR_DROP_MARK Ë«ÒýºÅ¶ªÊ§Ò»¸ö£¬¿ÉÄÜÊǶª¶ººÅÔì³ÉµÄÆ«ÒÆ |
| 76 | * @param ATERR_NO_PRINT ×Ö·û´®ÄÚÈÝ·ÇASCIIÃ÷ÎÄ£¬¿ÉÄÜÊǶª¶ººÅÔì³ÉµÄÆ«ÒÆ |
| 77 | * @param ATERR_STR_TOO_LONG ASCII×Ö·û´®¶ÁÈ¡µÄ³¤¶È³¬¹ý½âÎöÔ¼¶¨µÄ³¤¶È£¬¿ÉÄÜÊÇÍⲿÊäÈëµÄATÃüÁî²»ºÏ·¨ |
| 78 | * @param ATWARN_DROP_RN ʵ¼Ê×Ö·û´®²ÎÊý¸öÊý´óÓÚfmt¸ñʽ»¯¸öÊý£¬¿ÉÄÜÊǵ÷ÓÃÕßÖ»¹ØÐIJ¿·Ö²ÎÊý£¬Ðè½÷É÷´¦Àí¸ÃºêÖµ |
| 79 | * @param ATWARN_LACK_PARAM °´ÕÕÈë²Î¸ñʽfmt½âÎö£¬ÄÚÈÝȱÉÙ²ÎÊý£¬ÓÉÓÚ²ÎÊý¿ÉÑ¡£¬¿ÉÄÜÊÇÕý³£µÄ£¬Ðè½÷É÷ʹÓøúêÖµ |
| 80 | * @param ATERR_MEM_LESS ÖÐÐË΢оƬÄÚ²¿ÄÚ´æ²»×ãÔì³ÉÎÞ·¨½ÓÊÕµ±Ç°ATÃüÁî |
| 81 | * @param ATERR_WAIT_REQ_END_TIMEOUT µÈ´ýÍⲿÊäÈëµÄREQÇëÇóÃüÁî½áÊø·û\r³¬Ê± |
| 82 | * @param ATERR_WAIT_RSP_TIMEOUT ·¢ËÍÍêATÇëÇóºó£¬µÈ´ýÔ¶¶ËRSPÓ¦´ð½á¹û³¬Ê± |
| 83 | * @param ATERR_CHANNEL_BUSY µ±Ç°ATͨµÀÕýÔÚ´¦ÀíATÇëÇó£¬ÓÖÊÕµ½Ò»ÌõATÇëÇ󱨴í |
| 84 | * @param ATERR_UNKNOWN_CMD ÍⲿÊäÈëµÄÃüÁî²»¿Éʶ±ð£¬Îª·Ç·¨µÄATÃüÁî |
| 85 | * @param ATERR_PARAM_CHECKSUM ¶ÔÓÚ½ÓÊÕµ½µÄATÃüÁî²ÎÊý½øÐÐchecksumУÑéʧ°Ü |
| 86 | * @param ATERR_PPP_FILE_FAILED PPPÎļþ²Ù×÷ʧ°Ü |
| 87 | * @param ATERR_PPP_NOT_EXISTED PPPD²»´æÔÚ |
| 88 | * @param ATERR_PPP_WRONG_CHAN PPPͨµÀ´íÎó |
| 89 | * @param ATERR_PDP_IPADDR_FAILED »ñÈ¡PDPµØÖ·Ê§°Ü |
| 90 | * @param USER_EXTAND_ERR_BASE ³¬¹ý9000µÄΪÓëÍⲿMCUÏà¹ØµÄ¶¨ÖÆ´íÎóÂ룬ÐèÒªÍⲿMCUÓû§°´ÕÕ´íÎóÂë½øÐÐÏà¹ØÈÝ´í¶¯×÷ |
| 91 | */ |
| 92 | enum SAP_ERR { |
| 93 | AT_PARSE_OK = 0, /*parse_param²ÎÊý½âÎöÕýÈ·*/ |
| 94 | ATERR_ZXIC_ERR = 8000, /*ÖÐÐË΢оƬ·¢ÉúÒì³££¬ÇÒÎÞ·¨»Ö¸´£¬ÐèÒª½øÐÐÕû»úÖØÆô*/ |
| 95 | ATERR_PARAM_INVALID = 8001, /*ÃüÁî²ÎÊýϸ½Ú²»¶Ô£¬Óë¾ßÌåATÃüÁî½ô¹ØÁª*/ |
| 96 | ATERR_NOT_ALLOWED = 8002, /*Óë¾ßÌåÒµÎñÁ÷³Ì³åÍ»£¬²Ù×÷²»ÔÊÐí*/ |
| 97 | ATERR_PROC_FAILED = 8003, /*ÃüÁî´¦Àíʧ°Ü£¬ÊôÓÚsoftapϵͳÒì³££¬ÈçÏûÏ¢·¢ËÍʧ°ÜµÈ*/ |
| 98 | ATERR_DROP_MARK = 8004, /*Ë«ÒýºÅ¶ªÊ§Ò»¸ö£¬¿ÉÄÜÊǶª¶ººÅÔì³ÉµÄÆ«ÒÆ*/ |
| 99 | ATERR_NO_PRINT = 8005, /*×Ö·û´®ÄÚÈÝ·ÇASCIIÃ÷ÎÄ£¬¿ÉÄÜÊǶª¶ººÅÔì³ÉµÄÆ«ÒÆ*/ |
| 100 | ATERR_STR_TOO_LONG = 8006, /*ASCII×Ö·û´®¶ÁÈ¡µÄ³¤¶È³¬¹ý½âÎöÔ¼¶¨µÄ³¤¶È£¬¿ÉÄÜÊÇÍⲿÊäÈëµÄATÃüÁî²»ºÏ·¨*/ |
| 101 | ATWARN_DROP_RN = 8007, /*ʵ¼Ê×Ö·û´®²ÎÊý¸öÊý´óÓÚfmt¸ñʽ»¯¸öÊý£¬¿ÉÄÜÊǵ÷ÓÃÕßÖ»¹ØÐIJ¿·Ö²ÎÊý£¬Ðè½÷É÷´¦Àí¸ÃºêÖµ*/ |
| 102 | ATWARN_LACK_PARAM = 8008, /*°´ÕÕÈë²Î¸ñʽfmt½âÎö£¬ÄÚÈÝȱÉÙ²ÎÊý£¬ÓÉÓÚ²ÎÊý¿ÉÑ¡£¬¿ÉÄÜÊÇÕý³£µÄ£¬Ðè½÷É÷ʹÓøúêÖµ*/ |
| 103 | ATERR_MEM_LESS = 8009, /*ÖÐÐË΢оƬÄÚ²¿ÄÚ´æ²»×ãÔì³ÉÎÞ·¨½ÓÊÕµ±Ç°ATÃüÁî*/ |
| 104 | ATERR_WAIT_REQ_END_TIMEOUT = 8010, /*µÈ´ýÍⲿÊäÈëµÄREQÇëÇóÃüÁî½áÊø·û\r³¬Ê±*/ |
| 105 | ATERR_WAIT_RSP_TIMEOUT = 8011, /*·¢ËÍÍêATÇëÇóºó£¬µÈ´ýÔ¶¶ËRSPÓ¦´ð½á¹û³¬Ê±*/ |
| 106 | ATERR_CHANNEL_BUSY = 8012, /*µ±Ç°ATͨµÀÕýÔÚ´¦ÀíATÇëÇó£¬ÓÖÊÕµ½Ò»ÌõATÇëÇ󱨴í*/ |
| 107 | ATERR_UNKNOWN_CMD = 8013, /*ÍⲿÊäÈëµÄÃüÁî²»¿Éʶ±ð£¬Îª·Ç·¨µÄATÃüÁî*/ |
| 108 | ATERR_PARAM_CHECKSUM = 8014, /*¶ÔÓÚ½ÓÊÕµ½µÄATÃüÁî²ÎÊý½øÐÐchecksumУÑéʧ°Ü*/ |
| 109 | ATERR_PPP_FILE_FAILED = 8100, /*PPPÎļþ²Ù×÷ʧ°Ü*/ |
| 110 | ATERR_PPP_NOT_EXISTED = 8101, /*PPPD²»´æÔÚ*/ |
| 111 | ATERR_PPP_WRONG_CHAN = 8102, /*PPPͨµÀ´íÎó*/ |
| 112 | ATERR_PDP_IPADDR_FAILED = 8200, /*»ñÈ¡PDPµØÖ·Ê§°Ü*/ |
| 113 | USER_EXTAND_ERR_BASE = 9000, /*³¬¹ý9000µÄΪÓëÍⲿMCUÏà¹ØµÄ¶¨ÖÆ´íÎóÂ룬ÐèÒªÍⲿMCUÓû§°´ÕÕ´íÎóÂë½øÐÐÏà¹ØÈÝ´í¶¯×÷*/ |
| 114 | }; |
| 115 | |
| 116 | |
| 117 | /** |
| 118 | * @brief ´¦Àí×÷Ϊ·þÎñ¶ËµÄÊÕµ½µÄÇëÇóÃüÁî¡£at_parasΪATÃüÁî²ÎÊýÊ×µØÖ·£¬rsp_cmdΪӦ´ð½á¹û×Ö·û´®£¬×÷Ϊ³ö²Î´æÔÚ£»Ò»°ãµÄ£¬Óû§ÔڸýӿڵľßÌåʵÏÖʱ£¬ |
| 119 | * ÄÚ²¿µ÷ÓÃparse_param½Ó¿Ú½øÐвÎÊý½âÎö£¬²¢¸ù¾Ý·µ»ØÖµ½øÐвÎÊýÓÐЧÐÔ¼ì²é£¬ÒÔ·ÀÖ¹ÍⲿMCUÓëZXICоƬ¼äµÄÎïÀí´®¿ÚͨÐÅÒì³£Ôì³ÉATÃüÁîÊý¾Ý´íÎó¡£ |
| 120 | * ¶ÔÓÚͬ²½Ó¦´ðÀ©Õ¹ATÇëÇ󣬱ØÐëÔÚ½Ó¿ÚÄÚ²¿Îªrsp_cmdÉêÇëÄÚ´æ¿Õ¼ä£¬²¢¸³ÖµÖмäÉϱ¨ºÍ½á¹ûÂ룬²¢·µ»ØAT_END£» |
| 121 | * ¶ÔÓÚÐèÒª·¢Ë͸ø¿Í»§Ó¦Óýø³Ì½øÐд¦ÀíµÄ£¬Óɿͻ§ÔÚ×¢²áº¯ÊýÄÚ²¿½øÐÐÒì²½½»»¥£¬²¢·µ»ØAT_CONTINUE,atctlÖ÷¿Ø×èÈûµ±Ç°ATͨµÀ£»Ö±µ½Óû§½ø³Ìµ÷Óà |
| 122 | * send_rsp_str_to_farps½Ó¿Ú½«Ó¦´ð½á¹û·¢Ë͸øatctl£¬ÔÙÓÉatctl·¢Ë͸øÍⲿMCU£¬²¢ÊÍ·ÅATͨµÀ |
| 123 | * @param res_msg µ±ÊÇͬ²½Ó¦´ð·½Ê½Ê±£¬Èô*res_msg²»ÎªNULL£¬ÔòÄÚÈÝΪӦ´ð½á¹ûÂ룬ÓÉat_ctl·¢Ë͸øÍⲿMCUºóÊÍ·ÅATͨµÀ£» |
| 124 | Èô*res_msgΪNULL£¬ÓÉat_ctlÖ±½Ó»Ø¸´\r\nOK\r\n·¢Ë͸øÍⲿMCUºóÊÍ·ÅATͨµÀ |
| 125 | * µ±ÊÇÓ¦Óýø³ÌÒì²½·½Ê½´¦Àíʱ£¬*res_msg±ØÐëΪNULL£¬´Ëʱ»á³¤Ê±¼ä¶ÂÈûסATͨµÀ£¬Ö±ÖÁÓû§½ø³Ìµ÷ÓÃsend_rsp_str_to_farps½Ó¿Ú½â×èÈûATͨµÀ |
| 126 | * @return intÐͽá¹ûÂ룬AT_END±íʾͬ²½Ó¦´ð·½Ê½£»AT_CONTINUE±íʾÒì²½Ó¦´ð·½Ê½£¬ÐèÒªÓ¦Óýø³ÌÒì²½½»»¥ |
| 127 | * @note |
| 128 | */ |
| 129 | typedef int (*ser_req_func)(char *at_paras, void ** res_msg); |
| 130 | |
| 131 | /** |
| 132 | * @brief ¶ÔÓÚÉϱ¨atÃüÁî´¦Àíº¯Êý£¬°üº¬²éѯÖмä½á¹ûºÍÖ÷¶¯Éϱ¨µÄatÃüÁî´¦Àí |
| 133 | * ¶ÔÓÚpsÏà¹ØµÄÖ÷¶¯Éϱ¨ºÍ²éѯÖмä½á¹ûÉϱ¨£¬Ò»°ãÎÞÐ轫Éϱ¨ÄÚÈÝ·¢Ë͸øÆäËûÄ£¿éÓ¦Óã¬Òò´Ë¾¡Á¿Ê¹ÓÃnvºÍÈ«¾Ö±äÁ¿µÄ·½Ê½´æ·Å |
| 134 | * ¶ÔÓÚÀ©Õ¹atµÄÖмä½á¹ûÉϱ¨£¬Ò»°ãÐèÒª½«²éѯ½á¹û·¢Ë͸øÆäËûÄ£¿éÓ¦Ó㬶¯Ì¬ÉêÇëÄڴ棬·ÅÔÚcontextÉÏÏÂÎÄÖеÄapp_para±äÁ¿ÖÐ |
| 135 | * @param at_paras ATÃüÁî×Ö·û´® |
| 136 | * @param is_query_report |
| 137 | * @return intÐÍ×Ö·û´® |
| 138 | */ |
| 139 | |
| 140 | typedef int (*inform_act_func)(char *at_paras, int is_query_report); |
| 141 | |
| 142 | |
| 143 | /** |
| 144 | * @brief ½ø³Ì¼äͨÐÅÏûÏ¢·¢Ëͽӿڣ¬Èç¹ûÏûÏ¢¶ÓÁÐδ´´½¨£¬·µ»ØÊ§°ÜֵΪ-1 |
| 145 | * @param source_id(IN) :ÏûÏ¢·¢ËÍÄ£¿éID |
| 146 | * @param target_id(IN) :ÏûÏ¢½ÓÊÕÄ£¿éID |
| 147 | * @param Msg_cmd(IN) :ÏûÏ¢ÃüÁÓÃÓÚ½ÓÊÕÄ£¿é´¦ÀíÏûϢʱ£¬È·¶¨ÏûÏ¢´¦ÀíµÄ·½Ê½ |
| 148 | * @param us_DataLen(IN) :ÏûÏ¢ÖÐЯ´øÊý¾ÝµÄ³¤¶È |
| 149 | * @param pData(IN) :ÏûÏ¢ÖÐЯ´øµÄÊý¾ÝÄÚÈÝ |
| 150 | * @param msgflag(IN) :ÏûÏ¢µÄ·¢ËÍ·½Ê½£¬0±íʾ×èÈû·¢ËÍ£¬IPC_NOWAIT±íʾ·Ç×èÈû·¢ËÍ |
| 151 | * @return ·¢Ëͳɹ¦·µ»Ø0£¬·¢ËÍʧ°Ü·µ»Ø·Ç0£¬¾ßÌå´íÎóÀàÐÍÇë²Î¿¼linux±ê×¼µÄerrnoÀàÐÍ |
| 152 | * @note ·¢ËÍʧ°Ü£¬Ó¦ÓÃÅжÏerrno == ENOENT, ±íʾ¶ÓÁÐÂú£»Èô½ÓÊÕ·½Ò»¶¨»á±»Æô¶¯£¬·¢ËÍ·½¿É¼ÌÐøµ÷ÓÃipc_send_msg2½Ó¿Ú |
| 153 | */ |
| 154 | int ipc_send_message(int src_id, int dst_id, unsigned short Msg_cmd, unsigned short us_DataLen, unsigned char *pData, int msgflag); |
| 155 | |
| 156 | /** |
| 157 | * @brief ½ø³Ì¼äͨÐÅÏûÏ¢·¢Ëͽӿڣ¬Èç½ÓÊÕÓ¦ÓÃÒ»¶¨»áÆô¶¯Ê±£¬·¢ËÍ·½µ÷Óøýӿڣ¬Èç¹ûÏûÏ¢¶ÓÁÐδ´´½¨£¬»á×Ô¶¯´´½¨ÏûÏ¢¶ÓÁÐ |
| 158 | * @param source_id(IN) :ÏûÏ¢·¢ËÍÄ£¿éID |
| 159 | * @param target_id(IN) :ÏûÏ¢½ÓÊÕÄ£¿éID |
| 160 | * @param Msg_cmd(IN) :ÏûÏ¢ÃüÁÓÃÓÚ½ÓÊÕÄ£¿é´¦ÀíÏûϢʱ£¬È·¶¨ÏûÏ¢´¦ÀíµÄ·½Ê½ |
| 161 | * @param us_DataLen(IN) :ÏûÏ¢ÖÐЯ´øÊý¾ÝµÄ³¤¶È |
| 162 | * @param pData(IN) :ÏûÏ¢ÖÐЯ´øµÄÊý¾ÝÄÚÈÝ |
| 163 | * @param msgflag(IN) :ÏûÏ¢µÄ·¢ËÍ·½Ê½£¬0±íʾ×èÈû·¢ËÍ£¬IPC_NOWAIT±íʾ·Ç×èÈû·¢ËÍ |
| 164 | * @return ·¢Ëͳɹ¦·µ»Ø0£¬·¢ËÍʧ°Ü·µ»Ø·Ç0£¬¾ßÌå´íÎóÀàÐÍÇë²Î¿¼linux±ê×¼µÄerrnoÀàÐÍ |
| 165 | * @note ´Ë½Ó¿ÚÓÃÓÚÏûÏ¢²»×¼¶ªÊ§µÄ³¡¾°£¬¼´: Ä¿±êÓ¦ÓÃÒ»¶¨»áÆô¶¯´¦Àí´ËÏûÏ¢£¬µ«ÓÐʱ´æÔÚ·¢ËÍÏûϢʱĿ±êÓ¦ÓÃÉÐδÆô¶¯ |
| 166 | * Èç: ¿ª»ú³õʼ»¯Ê±Ò»Ð©ÌØÊâÏûÏ¢ÈçÈȲå°ÎʼþÉϱ¨¶ø½ÓÊÕÓ¦ÓÃÉÐδÆô¶¯£¬½ÓÊÕ¶ÓÁÐÉÐδ´´½¨ |
| 167 | */ |
| 168 | int ipc_send_message2(int src_id, int dst_id, unsigned short Msg_cmd, unsigned short us_DataLen, unsigned char *pData, int msgflag); |
| 169 | |
| 170 | |
| 171 | /** |
| 172 | * @brief ATÃüÁî½âÎö½Ó¿Ú |
| 173 | * @param fmt ATÇëÇó»òÏìÓ¦µÄ¸ñʽ»¯·½Ê½ |
| 174 | * @param buf ATÇëÇó»òÏìÓ¦µÄ×Ö·û´®Ö¸Õë²»º¬Í·²¿ºÍ¿Õ¸ñ |
| 175 | * @param pval ¸ñʽ»¯ºóµÄATÃüÁî |
| 176 | * @return 0±íʾ½âÎö²ÎÊýÕý³££¬²»½øÐвÎÊý¸öÊýµÄÓÐЧÐÔ¼ì²é£¬¾ßÌå·µ»ØÖµ²Î¿´¸ÃÍ·ÎļþSAP_ERRö¾ÙÀàÐÍÖÐAT_PARSE_OKµÈºêÖµ |
| 177 | * @note |
| 178 | * 1. ½âÎöµÄATÃüÁî±ØÐë°´ÕÕ3GPP27007±ê×¼ÐÒ飬²ÎÊýÒÔ¶ººÅ¸ô¿ª£¬×Ö·û´®Ðè´øË«ÒýºÅ£¬·ñÔò»á¶ÏÑÔ |
| 179 | * 2. ×Ö·û´®½âÎöʱµÄÈë²Î³¤¶È±ØÐë´óÓÚ¿ÉÄܽâ³öµÄ×Ö·û´®³¤¶È£¬·ñÔò»áÔ½½ç |
| 180 | * 3. ·µ»ØÖµÇë²Î¿¼Ã¶¾Ùenum SAP_ERR,²»½øÐвÎÊý¸öÊýµÄÓÐЧÐÔ¼ì²é |
| 181 | * 4. ÈôfmtÖ¸¶¨µÄ²ÎÊýÀàÐͱØÐëÓëpvalÖÐÖ¸ÕëµÄÒ»Ò»¶ÔÓ¦ |
| 182 | * 5. ʾÀý |
| 183 | <pre> |
| 184 | char buf[]="1,2,\"test\""; |
| 185 | int n1 = 0; |
| 186 | int n2 = 0; |
| 187 | char *n3 = malloc(strlen(buf)); |
| 188 | char *p[] = {&n1,&n2,n3}; |
| 189 | ret = parse_param("%d,%d,%s", buf, (void**)p); |
| 190 | //½âÎöºón1==1 n2==2 n3=="test" |
| 191 | ret = parse_param("%4d,%d,%3s", buf, (void**)p); |
| 192 | //½âÎöºón1==1 n2==2 n3=="te" |
| 193 | </pre> |
| 194 | * @warning |
| 195 | */ |
| 196 | int parse_param(char *fmt, char *buf, void **pval); |
| 197 | |
| 198 | |
| 199 | /** |
| 200 | * @brief Ó¦Ó÷¢ËͶ¯×÷Àà»ò²éѯÀàATÇëÇó¸ø3GPPÐÒéÕ»£¬²¢×èÈûµÈ´ý¶¯×÷½á¹û£»×¢Ò⣺¸Ã½Ó¿ÚÖ»ÄÜÓÃÓÚ²éѯºÍÉèÖúÍÖ´ÐÐÇëÇó£¬Í¨¹ýÈë²Î½øÐÐÖмä½á¹ûµÄÄÚ²¿½âÎö´¦Àí£¬²¢ÇÒ |
| 201 | ÓÐÖмä½á¹ûÉϱ¨Ê±£¬Ö»Ö§³ÖÒ»ÌõÖмä½á¹ûµÄÉϱ¨½âÎö£» |
| 202 | * @param req_at ÇëÇóATÃüÁ´óСдÃô¸Ð£¬±ØÐë´óд |
| 203 | * @param info_fmt ATÏìÓ¦µÄ¸ñʽ»¯·½Ê½ |
| 204 | * @param pval ¸ñʽ»¯ºóµÄATÏìÓ¦£¬¾ßÌåʹÓòο´parse_param½Ó¿Ú |
| 205 | * @return 0±íʾ·µ»Ø³É¹¦£¬ÆäËûÖµ±íʾʧ°Ü´íÎóÂë |
| 206 | * @note |
| 207 | * 1. Óû§Ê¹ÓÃʱ£¬Èô²»ÏëÓɸýӿÚÄÚ²¿½øÐвÎÊýµÄ¸ñʽ»¯½âÎö£¬¿ÉÒÔ½«info_fmt¸³ÖµÎª"%s"£¬pval¸³ÖµÎªchar **p˫ָÕ룬ÕâÑù²ÎÊý½«×÷ΪÕûÌå×Ö·û´®·µ»Ø¸øµ÷ÓÃÕß |
| 208 | * 2. ¶ÔÓÚZMGL,CPBR, COPS=?µÈÒ»ÌõÇëÇó»áÓжàÌõÖмä½á¹ûÇé¿ö£¬¸Ãº¯Êý²»ÊÊÓà |
| 209 | * 3. ×Ö·û´®½âÎöʱµÄÈë²Î³¤¶È±ØÐë´óÓÚ¿ÉÄܽâ³öµÄ×Ö·û´®³¤¶È£¬·ñÔò»áÔ½½ç |
| 210 | * 4. µ±´æÔÚÖмäÉϱ¨Ê±£¬pvalºÍinfo_fmt²»Îª¿Õ£»µ±ÎªÖмäÉϱ¨Ê±£¬Á½¸ö±ØÐë½ÔΪ¿Õ |
| 211 | * 5. pvalºÍinfo_fmtÁ½ÕßҪô¶¼ÎªNULL,Ҫô¶¼²»ÎªNULL£¬²»ÄÜ´æÔÚÆäÖÐÒ»¸öΪNULL£¬ÁíÒ»¸ö²»ÎªNULLµÄÇé¿ö |
| 212 | * 6. ʾÀý |
| 213 | <pre> |
| 214 | int ret = 0; |
| 215 | ret = get_modem_info("AT+CFUN=1\r", NULL, NULL); |
| 216 | //·µ»Ø¼´±íʾִÐгɹ¦ |
| 217 | |
| 218 | char *pstr = malloc(50); |
| 219 | memset(pstr,0,50); |
| 220 | ret = get_modem_info("AT+CIMI\r", "%s", (void**)&pstr); |
| 221 | //·µ»Øºópstr==111111111111111 |
| 222 | |
| 223 | int n1 = 0; |
| 224 | int n2 = 0; |
| 225 | int n3 = 0; |
| 226 | char *p2[] = {&n1,&n2,&n3}; |
| 227 | ret = get_modem_info("AT+CCIOTOPT?\r", "%d,%d,%d", (void**)p2); |
| 228 | //+CCIOTOPT: 1,2,3½âÎöºón1==1 n2==2 n3==3 |
| 229 | </pre> |
| 230 | * @warning |
| 231 | */ |
| 232 | int get_modem_info(char *req_at,char *info_fmt,void **pval); |
| 233 | |
| 234 | |
| 235 | /** |
| 236 | * @brief Ó¦Ó÷¢ËͶ¯×÷Àà»ò²éѯÀàATÇëÇó¸øÍⲿMCU£¬²¢×èÈûµÈ´ý¶¯×÷½á¹û£¬Ö»Ö§³ÖÒ»ÌõÖмä½á¹ûµÄÉϱ¨½âÎö£» |
| 237 | * ÓÉÓÚ´®¿ÚͨÐÅ´æÔÚ¶ªÊý¾Ý¿ÉÄÜ£¬¼ì²âµ½ÖмäÉϱ¨»òÓ¦´ð½á¹ûÓдíÎóʱ£¬»á½øÐÐÖØ·¢³¢ÊÔ£¬Ä¿Ç°ÖØ·¢3´Îºó»á¶ÏÑÔ£» |
| 238 | * À©Õ¹ATÃüÁÒåµÄ´íÎóÂ볬¹ý9000£¬²»½øÐÐÖØ·¢³¢ÊÔ |
| 239 | * @param req_at ÇëÇóATÃüÁ´óСдÃô¸Ð£¬±ØÐë´óд |
| 240 | * @param len ÇëÇóATÃüÁîµÄ³¤¶È |
| 241 | * @param info_fmt ATÏìÓ¦µÄ¸ñʽ»¯·½Ê½ |
| 242 | * @param pval ¸ñʽ»¯ºóµÄATÏìÓ¦£¬£¬¾ßÌåʹÓòο´parse_param½Ó¿Ú |
| 243 | * @param safe_parm_check ָʾÊÇ·ñ¶Ô²ÎÊý¸öÊý½øÐÐÒ»ÖÂÐÔ¼ì²é£¬0±íʾº¬¿ÉÑ¡²ÎÊý£¬²»¶Ô²ÎÊý¸öÊý½øÐмì²é;1±íʾ¶Ô²ÎÊý¸öÊý½øÐÐÑϸñ¼ì²é |
| 244 | * @param timeout timeout==0 ±íʾÓÀ¾ÃµÈ´ý½á¹ûÂ룬·ñÔòµÈ´ýʱ¼äΪ[timeout]Ãë |
| 245 | * @return 0±íʾ·µ»Ø³É¹¦£¬ÆäËûÖµ±íʾʧ°Ü´íÎóÂë |
| 246 | * @note |
| 247 | * 1. Óû§Ê¹ÓÃʱ£¬Èô²»ÏëÓɸýӿÚÄÚ²¿½øÐвÎÊýµÄ¸ñʽ»¯½âÎö£¬¿ÉÒÔ½«info_fmt¸³ÖµÎª"%s"£¬pval¸³ÖµÎªchar **p˫ָÕ룬ÕâÑù²ÎÊý½«×÷ΪÕûÌå×Ö·û´®·µ»Ø¸øµ÷ÓÃÕß |
| 248 | * 2. ¶ÔÓÚZMGL,CPBR, COPS=?µÈÒ»ÌõÇëÇó»áÓжàÌõÖмä½á¹ûÇé¿ö£¬¸Ãº¯Êý²»ÊÊÓà |
| 249 | * 3. ×Ö·û´®½âÎöʱµÄÈë²Î³¤¶È±ØÐë´óÓÚ¿ÉÄܽâ³öµÄ×Ö·û´®³¤¶È£¬·ñÔò»áÔ½½ç |
| 250 | * 4. µ±´æÔÚÖмäÉϱ¨Ê±£¬pvalºÍinfo_fmt²»Îª¿Õ£»µ±ÎªÖмäÉϱ¨Ê±£¬Á½¸ö±ØÐë½ÔΪ¿Õ |
| 251 | * 5. pvalºÍinfo_fmtÁ½ÕßҪô¶¼ÎªNULL,Ҫô¶¼²»ÎªNULL£¬²»ÄÜ´æÔÚÆäÖÐÒ»¸öΪNULL£¬ÁíÒ»¸ö²»ÎªNULLµÄÇé¿ö |
| 252 | * 6. ʾÀý |
| 253 | <pre> |
| 254 | int ret = 0; |
| 255 | ret = send_reqat_to_farps("AT+CFUN=1\r", NULL, NULL, 0); |
| 256 | //·µ»Ø¼´±íʾִÐгɹ¦ |
| 257 | |
| 258 | char *pstr = malloc(50); |
| 259 | memset(pstr,0,50); |
| 260 | ret = send_reqat_to_farps("AT+CIMI\r", "%3s", (void**)&pstr, 3000); |
| 261 | //·µ»Øºópstr==111111111111111, pstrÖÐ×Ö·ûÊýÄ¿×î´óΪ2 |
| 262 | |
| 263 | int n1 = 0; |
| 264 | int n2 = 0; |
| 265 | int n3 = 0; |
| 266 | char *p2[] = {&n1,&n2,&n3}; |
| 267 | ret = send_reqat_to_farps("AT+CCIOTOPT?\r", "%d,%d,%d", (void**)p2, 5000); |
| 268 | //+CCIOTOPT: 1,2,3½âÎöºón1==1 n2==2 n3==3,×î´óµÈʱ¼äΪ5000ms |
| 269 | </pre> |
| 270 | * @warning |
| 271 | */ |
| 272 | int send_reqat_to_farps(char *req_at,int len,char *info_fmt,void **pval, int safe_parm_check, int timeout); |
| 273 | |
| 274 | |
| 275 | /** |
| 276 | * @brief ÓÃÓÚ¿ª»ú×¢²áËùÓеķþÎñ¶Ë¾ßÌåATÃüÁîʼþ£¬³£ÓÃÓÚÉϲ㼰¿Í»§¶¨ÖÆ£¬²»×¼ÓÃÓÚPSÐÒéÕ»¡£ |
| 277 | * @param at_cmd_prefix ATÃüÁîǰ׺ָÕë |
| 278 | * @param module_id Ô´Ä£¿é¶ÓÁÐid |
| 279 | * @param req_rcv_act ¾ßÌ庬Òå²Î¼ûtypedef int (*ser_req_func)(char *at_paras, void ** res_msg)½Ó¿Ú˵Ã÷ |
| 280 | * @return intÐͽá¹ûÂë |
| 281 | * @retval ³É¹¦ 0 |
| 282 | * @note ¸Ã×¢²áº¯ÊýÓëregister_serv_func2µÄÇø±ðÊÇÈë²ÎÖ»ÓÐat_cmd_prefix¡¢module_idºÍreq_rcv_act |
| 283 | * at_ctlÊÕµ½ATÃüÁîºó£¬µ÷ÓÃ×¢²áµÄreq_rcv_act£¬at_ctlÄÜ·µ»Ø´¦Àí½á¹û£¬Ö±½Ó½«½á¹ûÂë·¢Ë͸øÍⲿMCU£¬ |
| 284 | ·ñÔò£¬ÊÕµ½Íⲿ·¢Ë͵ÄATÇëÇó£¬Í¨¹ýÏûÏ¢MSG_CMD_SEND_REQ_TO_APP·¢Ë͸øÓ¦Ó㬠|
| 285 | Ó¦Óô¦Àíºóͨ¹ýµ÷Óú¯Êýsend_rsp_str_to_farps£¬ÓÉat_ctl½«Ó¦´ð½á¹û·¢Ë͵½ÍⲿMCU |
| 286 | */ |
| 287 | int register_serv_func(char *at_cmd_prefix, int module_id, ser_req_func req_rcv_act); |
| 288 | |
| 289 | |
| 290 | /** |
| 291 | * @brief ×¢²áÉϱ¨ATÃüÁîµÄʼþ´¦Àí£¬°üÀ¨²éѯÖмä½á¹ûÉϱ¨ºÍÖ÷¶¯Éϱ¨¡£ |
| 292 | * @param at_cmd_prefix ATÃüÁîǰ׺ָÕë |
| 293 | * @param inform_act ½ÓÊÕµ½ATÃüÁîÖмä½á¹ûºÍÖ÷¶¯Éϱ¨ºóµÄ´¦Àíº¯Êý |
| 294 | * @return intÐͽá¹ûÂë |
| 295 | * @retval ³É¹¦ 0, ʧ°Ü -1 |
| 296 | * @note ÏàͬµÄÃüÁîǰ׺¿ÉÒÔÖØ¸´×¢²á¶à¸ö£¬at_ctl¿ò¼ÜÔÚÊÕµ½Ö÷¶¯Éϱ¨»òÖмä½á¹ûʱ£¬±éÀúÁ´±í£¬Ã¿¸öÖ´Ðк¯Êý¶¼»áÖ´ÐÐÒ»±é¡£ |
| 297 | * ÕâÑù£¬Èç¹ûÊÇÖмä½á¹û£¬¾Í¿ÉÄܱ»µ±³ÉÖ÷¶¯Éϱ¨Éϱ¨¸øÓ¦Óã¬ÓÉÓ¦ÓùýÂËÎÞЧµÄÖ÷¶¯Éϱ¨ÏûÏ¢ |
| 298 | */ |
| 299 | int register_inform_func(char *at_cmd_prefix, inform_act_func inform_act); |
| 300 | |
| 301 | |
| 302 | /** |
| 303 | * @brief ·þÎñ¶ËÓ¦ÓóÌÐò£¬·¢ËÍÖмä½á¹ûºÍÏìÓ¦µ½ÍⲿMCU |
| 304 | * @param module_id Ó¦ÓÃÄ£¿é¶ÓÁÐid |
| 305 | * @param rsp_cmd ´ý·¢Ë͵½ÍⲿMCUµÄÊý¾Ý |
| 306 | * @param rsp_len ÃüÁ¶È |
| 307 | * @return intÐͽá¹ûÂë |
| 308 | * @retval ³É¹¦ 0, ʧ°Ü -1 |
| 309 | * @note |
| 310 | */ |
| 311 | int send_rsp_str_to_farps(int module_id, char *rsp_cmd,int rsp_len); |
| 312 | |
| 313 | |
| 314 | /** |
| 315 | * @brief Éú³ÉatÏìÓ¦½á¹ûERRORº¯Êý |
| 316 | * @param param ERRORµÄ´íÎóÂë |
| 317 | * @return atÏìÓ¦½á¹ûERROR×Ö·û´®µÄÖ¸Õë |
| 318 | * @note ÓÉat_ctl¸ºÔðÊÍ·ÅÄÚ´æ |
| 319 | */ |
| 320 | char* at_err_build(int param); |
| 321 | |
| 322 | /** |
| 323 | * @brief ·¢Æð¹Ø»úÇëÇó |
| 324 | * @param src_id ·¢Æð·½Ä£¿éid£¬Î´ÉêÇë¿ÉÒÔÌî0 |
| 325 | * @return ·¢Ëͽá¹û£¬0³É¹¦£¬·Ç0ʧ°Ü |
| 326 | */ |
| 327 | int poweroff_request(int src_id); |
| 328 | |
| 329 | /** |
| 330 | * @brief ·¢ÆðÖØÆôÇëÇó |
| 331 | * @param src_id ·¢Æð·½Ä£¿éid£¬Î´ÉêÇë¿ÉÒÔÌî0 |
| 332 | * @return ·¢Ëͽá¹û£¬0³É¹¦£¬·Ç0ʧ°Ü |
| 333 | */ |
| 334 | int restart_request(int src_id); |
| 335 | |
| 336 | /** |
| 337 | * @brief ·¢Æð»Ö¸´³ö³§ÉèÖÃÇëÇó |
| 338 | * @param src_id ·¢Æð·½Ä£¿éid£¬Î´ÉêÇë¿ÉÒÔÌî0 |
| 339 | * @return ·¢Ëͽá¹û£¬0³É¹¦£¬·Ç0ʧ°Ü |
| 340 | */ |
| 341 | int reset_request(int src_id); |
| 342 | |
| 343 | #ifndef DOXYGEN_SHOULD_SKIP_THIS |
| 344 | /** |
| 345 | * @brief ½ø³Ì¼äͨÐÅÏûÏ¢·¢ËÍ½Ó¿Ú |
| 346 | * @param position(IN) :ÏûÏ¢·¢ËÍ·½Ïò |
| 347 | * @param msg_cmd(IN) :ÏûÏ¢ÃüÁÓÃÓÚ½ÓÊÕÄ£¿é´¦ÀíÏûϢʱ£¬È·¶¨ÏûÏ¢´¦ÀíµÄ·½Ê½ |
| 348 | * @param len(IN) :ÏûÏ¢¶ÔÓ¦½á¹¹ÌåÊý¾Ý³¤¶È |
| 349 | * @param msg(IN) :ÏûÏ¢¶ÔÓ¦½á¹¹ÌåÊý¾Ý |
| 350 | * @return ·¢Ëͳɹ¦·µ»Ø0£¬·¢ËÍʧ°Ü·µ»Ø·Ç0£¬¾ßÌå´íÎóÀàÐÍÇë²Î¿¼linux±ê×¼µÄerrnoÀàÐÍ |
| 351 | * @note Éæ¼°ºË¼õÏûÏ¢´«µÝ£¬½öÄÚ²¿Ê¹Óᣠ|
| 352 | */ |
| 353 | int send_soc_msg(unsigned short position, int dst_id, unsigned short msg_cmd, unsigned short len, void *msg); |
| 354 | |
| 355 | /** |
| 356 | * @brief ½ø³Ì¼äͨÐż°ºË¼äͨÐÅÏûÏ¢·¢ËÍͨÓÃ½Ó¿Ú |
| 357 | * @param src_id(IN) :ÏûÏ¢·¢ËÍÄ£¿éID |
| 358 | * @param dst_id(IN) :ÏûÏ¢½ÓÊÕÄ£¿éID |
| 359 | * @param msg_cmd(IN) :ÏûÏ¢ÃüÁÓÃÓÚ½ÓÊÕÄ£¿é´¦ÀíÏûϢʱ£¬È·¶¨ÏûÏ¢´¦ÀíµÄ·½Ê½ |
| 360 | * @param datalen(IN) :ÏûÏ¢¶ÔÓ¦½á¹¹ÌåÊý¾Ý³¤¶È |
| 361 | * @param pData(IN) :ÏûÏ¢¶ÔÓ¦½á¹¹ÌåÊý¾Ý |
| 362 | * @return ·¢Ëͳɹ¦·µ»Ø0£¬·¢ËÍʧ°Ü·µ»Ø·Ç0£¬¾ßÌå´íÎóÀàÐÍÇë²Î¿¼linux±ê×¼µÄerrnoÀàÐÍ |
| 363 | * @note Éæ¼°ºË¼õÏûÏ¢´«µÝ£¬½öÄÚ²¿Ê¹Óᣠ|
| 364 | */ |
| 365 | int platform_send_msg(int src_id, int dst_id, unsigned short msg_cmd, unsigned short datalen, unsigned char *pData); |
| 366 | |
| 367 | /** |
| 368 | * @brief ƽ̨ÄÚ´íÎó¸ú×Ù |
| 369 | * @param err(IN): |
| 370 | * @return |
| 371 | */ |
| 372 | void zxic_err_track(int err); |
| 373 | |
| 374 | /** |
| 375 | * @brief ¼ì²éĬÈÏ·ÓÉÊÇ·ñÅäÖóɹ¦ |
| 376 | * @return ÅäÖóɹ¦·µ»Ø1, ²»³É¹¦·µ»Ø-1 |
| 377 | */ |
| 378 | int default_route_check(); |
| 379 | |
| 380 | extern long long int get_time_us(); |
| 381 | |
| 382 | extern int soft_system(const char *command); |
| 383 | |
| 384 | #endif |
| 385 | |
| 386 | /** |
| 387 | *brief »ñȡϵͳÆô¶¯Ê±¼ä |
| 388 | *return ·µ»ØÏµÍ³×Ô¿ª»úµ½ÏÖÔÚµÄʱ¼ä¼ä¸ô£¬µ¥Î»ÎªÃë |
| 389 | */ |
| 390 | long get_sys_uptime(); |
| 391 | |
| 392 | #endif |