lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame^] | 1 | /**
|
| 2 | *
|
| 3 | * @file amt_gps_test.c
|
| 4 | * @brief
|
| 5 | * This file is part of FTM.
|
| 6 | * AMT´úÀíÓ¦Óòã
|
| 7 | *
|
| 8 | * @details
|
| 9 | * @author Tools Team.
|
| 10 | * @email
|
| 11 | * @copyright Copyright (C) 2013 Sanechips Technology Co., Ltd.
|
| 12 | * @warning
|
| 13 | * @date 2019/02/02
|
| 14 | * @version 1.1
|
| 15 | * @pre
|
| 16 | * @post
|
| 17 | *
|
| 18 | * @par
|
| 19 | * Change History :
|
| 20 | * ---------------------------------------------------------------------------
|
| 21 | * date version author description
|
| 22 | * ---------------------------------------------------------------------------
|
| 23 | * 2015/04/28 1.0 lu.xieji Create file
|
| 24 | * 2019/02/02 1.1 jiang.fenglin ÐÞ¸Ä×¢ÊÍ·½Ê½Îªdoxygen
|
| 25 | * ---------------------------------------------------------------------------
|
| 26 | *
|
| 27 | *
|
| 28 | */
|
| 29 |
|
| 30 |
|
| 31 | #include <sys/msg.h>
|
| 32 | #include <stdarg.h>
|
| 33 | #include <stdlib.h>
|
| 34 | #include <stdio.h>
|
| 35 | #include <errno.h>
|
| 36 | #include <fcntl.h>
|
| 37 | #include <string.h>
|
| 38 | #include <sys/types.h>
|
| 39 | #include <semaphore.h>
|
| 40 | #include <time.h>
|
| 41 | #include <sys/stat.h>
|
| 42 | #include "softap_api.h"
|
| 43 | #include "kwatch_msg.h"
|
| 44 | #include "amt.h"
|
| 45 |
|
| 46 | /**
|
| 47 | * @brief AMT²âÊÔGPS³õʼ»¯
|
| 48 | * @return ³É¹¦·µ»Ø0, ʧ°Ü·µ»Ø-1
|
| 49 | * @note
|
| 50 | * @see
|
| 51 | */
|
| 52 | int Amt_Gps_Init(void)
|
| 53 | {
|
| 54 | return 0;
|
| 55 | }
|
| 56 |
|
| 57 |
|
| 58 | /**
|
| 59 | * @brief AMT´¦ÀíGPSÏûÏ¢º¯Êý
|
| 60 | * @param[in] msg_id FID
|
| 61 | * @param[in] msg_buf ½ÓÊÕÊý¾Ýbuffer
|
| 62 | * @param[in] msg_len ½ÓÊÕÊý¾Ýbuffer³¤¶È
|
| 63 | * @return ³É¹¦·µ»Ø0, ʧ°Ü·µ»Ø-1
|
| 64 | * @note
|
| 65 | * @see
|
| 66 | */
|
| 67 | int Amt_Gps_ProcessMsg(unsigned int msg_id, unsigned char *msg_buf, unsigned int msg_len)
|
| 68 | {
|
| 69 | UNUSED(msg_len);
|
| 70 |
|
| 71 | switch(msg_id)
|
| 72 | {
|
| 73 | case FID_GPS_MODULE_TEST:
|
| 74 | {
|
| 75 | AmtPrintf(AMT_INFO "%s: MODULE_ID_AMT=%d,MODULE_ID_GPS=%d\n", __FUNCTION__,MODULE_ID_AMT,MODULE_ID_GPS);
|
| 76 | AmtPrintf(AMT_INFO "%s: KWATCH_MSG_GPS_PWR_SET_REQ=%d\n", __FUNCTION__,KWATCH_MSG_GPS_PWR_SET_REQ);
|
| 77 | unsigned char Flag = 0;
|
| 78 | memcpy(&Flag,msg_buf,sizeof(unsigned char));
|
| 79 | if(Flag == 1) //´ò¿ªgps
|
| 80 | {
|
| 81 | char buf[] = {"1"};
|
| 82 | ipc_send_message2(MODULE_ID_AMT, MODULE_ID_GPS, KWATCH_MSG_GPS_PWR_SET_REQ, sizeof(buf), (unsigned char*)buf, 0);
|
| 83 | }
|
| 84 | else if(Flag == 0) //¹Ø±Õgps
|
| 85 | {
|
| 86 | char buf[] = {"0"};
|
| 87 | ipc_send_message2(MODULE_ID_AMT, MODULE_ID_GPS, KWATCH_MSG_GPS_PWR_SET_REQ, sizeof(buf), (unsigned char*)buf, 0);
|
| 88 | }
|
| 89 | else
|
| 90 | {
|
| 91 | AmtPrintf(AMT_ERROR "%s: param error!\n", __FUNCTION__);
|
| 92 | return -1;
|
| 93 | }
|
| 94 | break;
|
| 95 | }
|
| 96 | default:
|
| 97 | break;
|
| 98 | }
|
| 99 | return 0;
|
| 100 | }
|
| 101 |
|
| 102 | /**
|
| 103 | * @brief AMT·´À¡GPSÏûÏ¢¸øPC
|
| 104 | * @param[in] msg_id FID
|
| 105 | * @param[in] msg ÏûÏ¢Ìå
|
| 106 | * @return ³É¹¦·µ»Ø0, ʧ°Ü·µ»Ø-1
|
| 107 | * @note
|
| 108 | * @see
|
| 109 | */
|
| 110 | int Amt_Process_Gps_Rsp(MSG_BUF *msg, unsigned int msg_id)
|
| 111 | {
|
| 112 | unsigned char *buf = msg->aucDataBuf;
|
| 113 | AmtPrintf(AMT_INFO "%s: receive data= %s,datalen=%d.\n", __FUNCTION__,buf,msg->usDataLen);
|
| 114 | if (Amt_CreateResponse(msg_id, buf, msg->usDataLen) == -1)
|
| 115 | {
|
| 116 | AmtPrintf(AMT_ERROR "%s: Send data failure.\n", __FUNCTION__);
|
| 117 | }
|
| 118 | else
|
| 119 | {
|
| 120 | AmtPrintf(AMT_INFO "%s: Send data success.\n", __FUNCTION__);
|
| 121 | }
|
| 122 | return 0;
|
| 123 | }
|
| 124 |
|