SKTelecom_ThingPlug / GMMP_mbed

Dependents:   ThingPlug_WiFi_Example_2 ThingPlug_Ethernet_Example ThingPlug_Ethernet_Example_temp_V2

Fork of GMMP_2 by Sangmin Lee

Embed: (wiki syntax)

« Back to documentation index

GMMP.h File Reference

GMMP.h File Reference

Go to the source code of this file.

Functions

int GO_Reg (const char *pszGWID, const char *pszManufactureID)
 GW,Device 등록 절차 진행 명령 함수, 옵션으로 암호화 진행 유무 Flag가 있다.
int GO_DeReg (const char *pszGWID, const char *pszDeviceID)
 GW,Device 해지 절차 진행 명령 함수
int GO_Profile (const char *pszGWID, const char *pszDeviceID, const long nTID)
int GO_Delivery (const char *pszGWID, const char *pszDeviceID, const char cReportType, const char cMediaType, const char *pszMessageBody)
int GO_Control (const char *pszGWID, const char *pszDeviceID, long nTID, const char cControlType, const char cResultCode)
int GO_HB (const char *pszGWID)
int Initialize (byte *serverIp, const int nPort, const char *pszDomainCode, const char *pszGWAuthID, byte *mac)
 GMMP 라이브러리 초기화 및 기본 정보 입력
void Uninitialize ()
 GMMP 라이브러리 Uninitialize.
int GetReadData (GMMPHeader *pstGMMPHeader, void **pBody)
 TCP Always On 에서 사용하는 함수
Thread를 생성 하고 이 함수를 연결하여 사용한다.
long Char2int (void *pBuffer, int nSize)
 char 타입의 데이터를 int로 변환한다.
int Char2short (void *pBuffer, int nSize)
 char 타입의 데이터를 short로 변환한다.
void InitMemory ()
 내부 변수 초기화
void SetAuthKey (const char *pszAuthKey)
 OMP로 제공 받은 AuthKey값을 저장하는 함수
char * GetAuthKey ()
 저장된 AuthKey
void SetGWID (const char *pszGWID)
 OMP로 제공 받은 GW ID값을 저장하는 함수
char * GetGWID ()
int SetServerInfo (byte *serverIp, int nPort, const char *pszAuthID, const char *pszDomainCode)
 서버 정보 및 GW Auth ID, DomainCode를 저장한다.
void SetCallFunction (int(*pCallFunctionName)(GMMPHeader *pstGMMPHeader, void *pstBody))
 OMP서버로 부터 수신한 패킷을 제공할 콜백함수 저장 함수
int GO_Notifi (const char *pszGWID, const char *pszDeviceID, const char cControlType, const char cResultCode, const char *pszMessageBody, const int nMessageBodySize)

Detailed Description

Definition in file GMMP.h.


Function Documentation

long Char2int ( void *  pBuffer,
int  nSize 
)

char 타입의 데이터를 int로 변환한다.

Parameters:
pBufferin
nSizein pBuffer size
Returns:
int

Definition at line 446 of file GMMP.cpp.

int Char2short ( void *  pBuffer,
int  nSize 
)

char 타입의 데이터를 short로 변환한다.

Parameters:
pBuffer
nSize
Returns:
char* GetAuthKey (  )

저장된 AuthKey

Returns:
저장된 Auth Key
char* GetGWID (  )
Returns:
저장된 GW ID

Definition at line 208 of file GMMP.cpp.

int GetReadData ( GMMPHeader pstGMMPHeader,
void **  pBody 
)

TCP Always On 에서 사용하는 함수
Thread를 생성 하고 이 함수를 연결하여 사용한다.

Parameters:
pstGMMPHeaderGMMPHeader 구조체 포인트
pBodyBody 메시지 구조체 포인트
Returns:
성공 : GMMMP_SUCCESS, 실패 : ErrorCode.h 참조

Definition at line 418 of file GMMP.cpp.

int Initialize ( byte *  serverIp,
const int  nPort,
const char *  pszDomainCode,
const char *  pszGWAuthID,
byte *  mac 
)

GMMP 라이브러리 초기화 및 기본 정보 입력

Parameters:
serverIp접속할 서버 IP, 4 byte array. g_serverIp에 저장된다,
nPort접속할 서버 port, g_nServerPort에 저장된다.
pszDomainCodeOMP Portal을 통해 등록된 서비스 코드, g_szDomainCode에 저장된다,
pszGWAuthIDM2M GW 의 Serial Number 값이며, MSISDN 또는 MAC Address값을 사용할 수도 있다. g_szAuthID에 저장된다.
nGMMPMode로그 저장 유무, GMMP_OFF_LOG, GMMP_ON_LOG
nErrorLevel로그 출력 레벨
nNetwrokType통신 타입
macMAC Address. 6 byte array.
Returns:
성공 : GMMP_SUCCESS, 실패: 1이상 , 에러코드 참조

moved to main.cpp wifi.init();

wait(0.5); int s = wifi.disconnect(); if( s != 0 ) { return -1; }

wait(0.3); Connect AP wifi.connect( MBED_AP_SSID , strlen(MBED_AP_SSID) , MBED_AP_SECURITY_TYPE , MBED_AP_SECUTIRY_KEY , strlen(MBED_AP_SECUTIRY_KEY) ); wait(0.5); wifi.setIPConfig( true ); //Use DHCP wait(0.5);

tagWIFI_STATUS_T wifi_status; if( wifi.getWifiStatus(&wifi_status) ) printf("wifi_status error!\r\n");

printf("MAC Address is %02x:%02x:%02x:%02x:%02x:%02x\r\n", wifi_status.mac_address[0], wifi_status.mac_address[1], wifi_status.mac_address[2], wifi_status.mac_address[3], wifi_status.mac_address[4], wifi_status.mac_address[5]); printf("IP Address is %s\r\n", wifi.getIPAddress());

moved to main.cpp mbed_mac_address((char *)MAC_Addr); //Use mbed mac addres printf("input MAC Address is %02x:%02x:%02x:%02x:%02x:%02x\r\n", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);

int ret = ethernet.init(mac); printf("SPI Initialized \r\n"); wait(1); // 1 second for stable state

printf("W5500 Networking Started \r\n"); wait(1); // 1 second for stable state

if (!ret) { printf("Initialized, MAC: %s\r\n", ethernet.getMACAddress()); ret = ethernet.connect(); if (!ret) { printf("IP: %s, MASK: %s, GW: %s\r\n", ethernet.getIPAddress(), ethernet.getNetworkMask(), ethernet.getGateway()); } else { printf("Error ethernet.connect() - ret = %d\r\n", ret); exit(0); } } else { printf("Error ethernet.init() - ret = %d\r\n", ret); exit(0); }

Definition at line 87 of file GMMP.cpp.

void InitMemory (  )

내부 변수 초기화

Definition at line 468 of file GMMP.cpp.

void SetAuthKey ( const char *  pszAuthKey )

OMP로 제공 받은 AuthKey값을 저장하는 함수

Parameters:
pszAuthKeyOMP로 부터 제공 받은 Auth Key 값

Definition at line 195 of file GMMP.cpp.

void SetCallFunction ( int(*)(GMMPHeader *pstGMMPHeader, void *pstBody)  pCallFunctionName )

OMP서버로 부터 수신한 패킷을 제공할 콜백함수 저장 함수

Parameters:
pCallFunctionName콜백을 제공 받을 함수 포인트

Definition at line 238 of file GMMP.cpp.

void SetGWID ( const char *  pszGWID )

OMP로 제공 받은 GW ID값을 저장하는 함수

Parameters:
pszGWIDOMP로 부터 제공 받은 GW ID 값

Definition at line 200 of file GMMP.cpp.

int SetServerInfo ( byte *  serverIp,
int  nPort,
const char *  pszAuthID,
const char *  pszDomainCode 
)

서버 정보 및 GW Auth ID, DomainCode를 저장한다.

Parameters:
serverIpServer IP
nPortServer Port
pszAuthIDAuth ID
pszDomainCodeDomainCode
Returns:
성공 : GMMP_SUCCESS, 실패 : LIB_PARAM_ERROR

Definition at line 213 of file GMMP.cpp.

void Uninitialize (  )

GMMP 라이브러리 Uninitialize.

Definition at line 79 of file GMMP.cpp.