void YRDKRL78_DataSend_1(char * cData, uint16_t size) { SetSendData() ; for(int i=0;size>0;i++) SPI_Send(SPI_LCD, (uint8_t *)cData[i],1); SetSendData() ; }
/****************************************************************************** * ID : 71.0 * Outline : YRDKRL78_DataSend * Include : YRDKRL78_RSPI0.h * Function Name: YRDKRL78_DataSend * Description : Send 8 bits of data to the LCD RAM at the current location. * The current location is determined and set with local functions. * Argument : cCommand - 8 bits of data to be sent to the LCD * : aHandle - the Glyph handle setup by the LCD and Communications. * Return Value : none * Calling Functions : ST7579_Config, ST7579_SetSystemBiasBooster, * ST7579_SetVO_Range, ST7579_SetFrameRate, * ST7579_SetPage, ST7579_SetChar, ST7579_SetLine, * ST7579_Send8bitsData, ST7579_Send16bitsCommand ******************************************************************************/ void YRDKRL78_DataSend(int8_t cData) { SetSendData() ; SPI_Send(SPI_LCD, (uint8_t *)&cData, 1); SetSendData() ; }
/****************************************************************************** * ID : 71.0 * Outline : YRDKRX62N_DataSend * Include : YRDKRX62N_RSPI0.h * Function Name: YRDKRX62N_DataSend * Description : Send 8 bits of data to the LCD RAM at the current location. * The current location is determined and set with local functions. * Argument : cCommand - 8 bits of data to be sent to the LCD * : aHandle - the Glyph handle setup by the LCD and Communications. * Return Value : none * Calling Functions : ST7579_Config, ST7579_SetSystemBiasBooster, * ST7579_SetVO_Range, ST7579_SetFrameRate, * ST7579_SetPage, ST7579_SetChar, ST7579_SetLine, * ST7579_Send8bitsData, ST7579_Send16bitsCommand ******************************************************************************/ void YRDKRX62N_DataSend(int8_t cData) { /* A0 = 1 */ SetSendData() ; YRDKRX62N_RSPITransferOutWord8Bit(cData) ; /* A0 = 1 */ SetSendData() ; }
/****************************************************************************** * ID : 71.0 * Outline : Glyph_uEZ_DataSend * Include : Glyph_uEZ_0.h * Function Name: Glyph_uEZ_DataSend * Description : Send 8 bits of data to the LCD RAM at the current location. * The current location is determined and set with local functions. * Argument : cCommand - 8 bits of data to be sent to the LCD * : aHandle - the Glyph handle setup by the LCD and Communications. * Return Value : none * Calling Functions : ST7579_Config, ST7579_SetSystemBiasBooster, * ST7579_SetVO_Range, ST7579_SetFrameRate, * ST7579_SetPage, ST7579_SetChar, ST7579_SetLine, * ST7579_Send8bitsData, ST7579_Send16bitsCommand ******************************************************************************/ void Glyph_uEZ_DataSend(int8_t cData) { /* A0 = 1 */ SetSendData() ; Glyph_uEZ_TransferOutWord8Bit(cData) ; /* A0 = 1 */ SetSendData() ; }
/****************************************************************************** * ID : 70.0 * Outline : YRDKRL78_CommandSend * Include : YRDKRL78_RSPI0.h * Function Name: YRDKRL78_CommandSend * Description : Send a command define to the LCD. The defines for all commands * available to send to the ST7579 LCD controller are defined in the header * for this file RL78_LCD.h. The nCommand parameter should always be * a define from that location. * Argument : cCommand - 8 bits of data to be used as a command to the LCD * : aHandle - the Glyph handle setup by the LCD and Communications. * Return Value : none * Calling Functions : ST7579_Config, ST7579_SetSystemBiasBooster, * ST7579_SetVO_Range, ST7579_SetFrameRate, * ST7579_SetPage, ST7579_SetChar, ST7579_SetLine, * ST7579_Send8bitsData, ST7579_Send16bitsCommand ******************************************************************************/ void YRDKRL78_CommandSend(int8_t cCommand) { SetSendCommand() ; SPI_Send(SPI_LCD, (uint8_t *)&cCommand, 1); SetSendData() ; }
void CInfoMapShadow::Copy(CInfoMapShadow *pSrc) { PBYTE pTmp; pTmp = pSrc->GetSendData (); SetSendData (pTmp); SAFE_DELETE_ARRAY (pTmp); }
/****************************************************************************** * ID : 70.0 * Outline : YRDKRX62N_CommandSend * Include : YRDKRX62N_RSPI0.h * Function Name: YRDKRX62N_CommandSend * Description : Send a command define to the LCD. The defines for all commands * available to send to the ST7579 LCD controller are defined in the header * for this file RX62N_LCD.h. The nCommand parameter should always be * a define from that location. * Argument : cCommand - 8 bits of data to be used as a command to the LCD * : aHandle - the Glyph handle setup by the LCD and Communications. * Return Value : none * Calling Functions : ST7579_Config, ST7579_SetSystemBiasBooster, * ST7579_SetVO_Range, ST7579_SetFrameRate, * ST7579_SetPage, ST7579_SetChar, ST7579_SetLine, * ST7579_Send8bitsData, ST7579_Send16bitsCommand ******************************************************************************/ void YRDKRX62N_CommandSend(int8_t cCommand) { /* Send Command To LCD */ /* A0 = 0 */ SetSendCommand() ; YRDKRX62N_RSPITransferOutWord8Bit(cCommand) ; /* A0 = 1 */ SetSendData() ; }
/****************************************************************************** * ID : 70.0 * Outline : Glyph_uEZ_CommandSend * Include : Glyph_uEZ_0.h * Function Name: Glyph_uEZ_CommandSend * Description : Send a command define to the LCD. The defines for all commands * available to send to the ST7579 LCD controller are defined in the header * for this file RX62N_LCD.h. The nCommand parameter should always be * a define from that location. * Argument : cCommand - 8 bits of data to be used as a command to the LCD * : aHandle - the Glyph handle setup by the LCD and Communications. * Return Value : none * Calling Functions : ST7579_Config, ST7579_SetSystemBiasBooster, * ST7579_SetVO_Range, ST7579_SetFrameRate, * ST7579_SetPage, ST7579_SetChar, ST7579_SetLine, * ST7579_Send8bitsData, ST7579_Send16bitsCommand ******************************************************************************/ void Glyph_uEZ_CommandSend(int8_t cCommand) { /* Send Command To LCD */ /* A0 = 0 */ SetSendCommand() ; Glyph_uEZ_TransferOutWord8Bit(cCommand) ; /* A0 = 1 */ SetSendData() ; }
// 发送结果 BOOL CNetUser::SendResult(WORD dwCmd, int nResultCode) { if (m_bNoUse) { std::cout << "SendResult fail. no used\n"; return FALSE; } ST_CMD_HEADER resultCmd; resultCmd.usVerifyCode = VERIFYCODE; resultCmd.usCmd = dwCmd; resultCmd.uPackSize = 0; resultCmd.usResult = nResultCode; return SetSendData((char*)&resultCmd, HEAD_SIZE); }
bool ServerHandler::RegisterHandle(const Json::Value &value, LPMESSAGE_DATA pMsgData) { if (value.isMember(BODY_PARAM) && value[BODY_PARAM].isObject()) { Json::Value valueBody = value[BODY_PARAM]; if (valueBody.isMember(APPID_PARAM) && valueBody[APPID_PARAM].isString() && !valueBody[APPID_PARAM].asString().empty() && valueBody.isMember(CHECKCODE_PARAM) && valueBody[CHECKCODE_PARAM].isString()) { // get appkey with appid DBHandler *pDBHandler = DBHandler::GetInstance(); TPushIdentItem item = pDBHandler->GetAppInfoWithAppid(valueBody[APPID_PARAM].asString().c_str()); // create checkcode string strToMD5 = valueBody[TOKENID_PARAM].asString() + m_strChanllenge + item.appkey; char *aCheckcode = (char*)pMsgData->pData->m_cBuff256; GetMD5String(strToMD5.c_str(), aCheckcode); gvLog(LOG_MSG, "(ServerHandler::RegisterHandle) MSG: iFd:%d strToMD5:%s strCheckcode:%s CHECKCODE:%s" , pMsgData->iFd, strToMD5.c_str(), aCheckcode, valueBody[CHECKCODE_PARAM].asString().c_str()); // compare checkcode Json::Value root; const char *pHttpHead = NULL; if(0 == strcmp(aCheckcode, valueBody[CHECKCODE_PARAM].asString().c_str())) { root[RET_PARAM] = SUCCESS_CODE; pHttpHead = HTTP_REPONSE; m_eHandleStep = PUSHMESSAGE_STEP; } else { root[RET_PARAM] = CHECKCODEERR_CODE; pMsgData->bSendAndClose = true; pHttpHead = HTTP_REPONSE_CLOSE; m_eHandleStep = BEGIN_STEP; } // set send data SetSendData(pMsgData, root, pHttpHead, HTTP_200_OK); return true; } } // protocol format error m_eHandleStep = BEGIN_STEP; gvLog(LOG_MSG, "(ServerHandler::RegisterHandle) MSG: protocol error iFd:%d", pMsgData->iFd); return false; }
// handle protocol bool ServerHandler::GetChanllengeHandle(const Json::Value &value, LPMESSAGE_DATA pMsgData) { gvLog(LOG_MSG, "(ServerHandler::GetChanllengeHandle) MSG: begin iFd:%d", pMsgData->iFd); // create chanllenge time_t tChanllenge = time(NULL); char *pTime = pMsgData->pData->m_cBuff256; snprintf(pTime, sizeof(pMsgData->pData->m_cBuff256), "%x%x00%d", GetTickCount(), tChanllenge << 2, pMsgData->iFd); m_strChanllenge = pTime; // create json Json::Value root; root[RET_PARAM] = SUCCESS_CODE; root[CHANLLENGE_PARAM] = m_strChanllenge.c_str(); // set send data SetSendData(pMsgData, root, HTTP_REPONSE, HTTP_200_OK); m_eHandleStep = REGISTER_SERVER_STEP; return true; }
bool ServerHandler::PushMessageHandle(const Json::Value &value, LPMESSAGE_DATA pMsgData) { // CAutoLock lock(&m_mutexSendPushMsg); gvLog(LOG_MSG, "(ServerHandler::PushMessageHandle) MSG: begin iFd:%d", pMsgData->iFd); if (value.isMember(BODY_PARAM) && value[BODY_PARAM].isObject()) { Json::Value valueBody = value[BODY_PARAM]; if (valueBody.isMember(TOKENIDLIST_PARAM) && valueBody[TOKENIDLIST_PARAM].isArray() && valueBody.isMember(BODY_PARAM) && valueBody[BODY_PARAM].isObject()) { Json::FastWriter writer; string strBody = writer.write(valueBody[BODY_PARAM]); gvLog(LOG_MSG, "(ServerHandler::PushMessageHandle) MSG: iFd:%d body:\n%s", pMsgData->iFd, strBody.c_str()); for (Json::Value::iterator iter = valueBody[TOKENIDLIST_PARAM].begin(); valueBody[TOKENIDLIST_PARAM].end() != iter; iter++) { if ((*iter).isMember(TOKENID_PARAM) && (*iter)[TOKENID_PARAM].isString()) { std::string tokenid = (*iter)[TOKENID_PARAM].asString(); if (!tokenid.empty()) { PushManager::GetInstance()->SendPushMessage(tokenid.c_str(), strBody.c_str()); } } } Json::Value root; root[RET_PARAM] = SUCCESS_CODE; SetSendData(pMsgData, root, HTTP_REPONSE, HTTP_200_OK); return true; } } gvLog(LOG_ERR_USER, "(ServerHandler::PushMessageHandle) MSG: protocol error iFd:%d", pMsgData->iFd); return false; }