Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: ThingPlug_Ethernet_Example
Fork of GMMP_mbed by
GMMP_Heartbeat.cpp
00001 /* 00002 * GMMP_Hearbeat.c 00003 * 00004 * Created on: 2013. 11. 18. 00005 * Author: root 00006 */ 00007 00008 #include "GMMP_Heartbeat.h" 00009 00010 int GMMP_Heartbeat_Req(HB_Req* pHB_Req) 00011 { 00012 if(pHB_Req == NULL) 00013 { 00014 return SERVER_INFO_NOT_FOUND; 00015 } 00016 00017 if(CheckSocket() != 0) 00018 { 00019 return SERVER_INFO_NOT_FOUND; 00020 } 00021 00022 return WriteTCP( (char*)pHB_Req, sizeof(HB_Req) ); 00023 } 00024 00025 int GMMP_Heartbeat_Rsp(HB_Rsp* pHB_Rsp) 00026 { 00027 if(pHB_Rsp == NULL) 00028 { 00029 return SERVER_INFO_NOT_FOUND; 00030 } 00031 00032 if(CheckSocket() != 0) 00033 { 00034 return SERVER_INFO_NOT_FOUND; 00035 } 00036 00037 int nRet = ReadTCP( (char*)&pHB_Rsp->header , sizeof(pHB_Rsp->header) ); 00038 if(nRet != GMMP_SUCCESS) 00039 { 00040 return nRet; 00041 } 00042 00043 ConvertShort cvtshort; 00044 cvtshort.sU8 = 0; 00045 memcpy(cvtshort.usShort, pHB_Rsp->header.usMessageLength, sizeof(pHB_Rsp->header.usMessageLength) ); 00046 00047 int nReadSize = ltobs(cvtshort.sU8)- sizeof(pHB_Rsp->header); 00048 00049 return ReadTCP( (char*)&pHB_Rsp->body, nReadSize); 00050 }
Generated on Tue Jul 12 2022 21:35:52 by
