Kenial-Palm Programming Develop Daily Notes | UserPreferences |
Àú¼öÁØÀÇ Èû. ³î¶øµµ´Ù...
...
Lightweight C++ Framework for PalmOS. ÆÁ.
Palm ÇÁ·Î±×·¡¹Ö¿¡¼´Â ȸ鿡 º¸ÀÌ´Â ¸ðµç ¸®¼Ò½º(Æû ÄÁÆ®·Ñ)¿¡ ´ëÇØ ±× ÇØ´ç ¸®¼Ò½ºÀÇ struct°¡ Á¸ÀçÇÏÁö ¾Ê´Â´Ù. ¿¹¸¦ µé¸é Field°°Àº °æ¿ì´Â FieldType?À̶ó´Â ±¸Á¶Ã¼°¡ Á¸ÀçÇÏÁö¸¸, LabelÀÇ °æ¿ì¿¡´Â LabelType?À̶ó´Â ±¸Á¶Ã¼´Â Á¸ÀçÇÏÁö ¾Ê´Â´Ù. ´ë½Å, ControlType?À̶ó°í ÇÏ´Â »óÀ§ÀÇ ±¸Á¶Ã¼°¡ Á¸ÀçÇÑ´Ù. (FieldType? ±¸Á¶Ã¼µµ ÀϺδ ControlType? ±¸Á¶Ã¼·Î ij½ºÆÃÇؼ 'ÀϺÎ'´Â »ç¿ëÇÒ ¼ö ÀÖ´Ù. Áï, ControlType? ±¸Á¶Ã¼´Â FieldType?ÀÇ »óÀ§ ±¸Á¶Ã¼)
Lightweight C++ Framework for PalmOS(ÀÌÇÏ FW)¿¡¼´Â Æû ÄÁÆ®·Ñ¿¡ ´ëÇØ Wrapper Ŭ·¡½º¸¦ Á¦°øÇÏ°í ÀÖ´Ù : List, Field Ŭ·¡½º°¡ Á¦°øµÇ¸ç, (ÀÌ µÎ ÄÁÆ®·ÑÀÇ ÀÌ¿ëÀÌ °¡Àå ³ÇØÇϱ⠶§¹®ÀÎ µí) WidgetÀ̶ó´Â »óÀ§ Ŭ·¡½º¸¦ °®´Â´Ù.
ÇÏÁö¸¸, List, Field ÄÁÆ®·Ñ ÀÌ¿ÜÀÇ °Íµéµµ »ç¿ëÇÒ ¼ö ÀÖµµ·Ï Form Ŭ·¡½º¿¡¼ Áö¿øÇÏ°í ÀÖ´Ù. ´ÙÀ½°ú °°Àº ¹æ¹ýÀ¸·Î »ç¿ëÇÑ´Ù :
// ÀÌ·± ÆûÀÌ Á¸ÀçÇÒ ¶§.. AgentEditForm *f = (AgentEditForm*)(Application::Instance())->GetForm(AgentEditFormForm); // ÄÁÆ®·ÑÀÇ ºñÈ°¼ºÈ f->EnableControl(AgentEditFormUseEncryptionCheckbox, False) // Label, Trigger.. µî ·¹À̺íÀÌ ÀÖ´Â ÄÁÆ®·ÑÀÇ °æ¿ì ·¹À̺íÀ» ÁöÁ¤ f->SetLabelText(AgentEditFormPasswordSelTrigger,"--Assigned--"); // üũ¹Ú½º Check f->SetCheckBox(AgentEditFormUseEncryptionCheckbox, True); ±× ¿Ü¿¡µµ HideControl(), ShowControl(), IsCheckBoxSet(), DrawControl(), SetControlLabel() µîÀÌ ÀÖ´Ù.
You win -_-d
¾Æ¾Ç...!
µµ´ëü Ŭ¸®¿¡¸¦ ¿Ö °ø¼öÇؿ°Žþß? -_-
...
Ŭ¸®¿¡ÀÇ HR(HiRes?, °íÇØ»óµµ) °ü·Ã API »ç¿ë½Ã, ±âÁ¸ API¿Í ȣȯµÇ°Å³ª, ±×·¸Áö ¾ÊÀº °ÍµéÀÌ ¸¹´Ù.
ÇöÀç N700 ¿¡¹Ä¿¡¼ Å×½ºÆ®ÇÑ °á°ú´Â :
ÇØ°á¹æ¹ý ;
PopTrigger?¸¦ Ŭ¸¯Çؼ ´Ù¸¥ Çʵ带 ¼±ÅÃÇصµ, LabelÀÇ ³»¿ëÀÌ ÀÚµ¿À¸·Î ¹Ù²îÁö ¾ÊÀ¸¹Ç·Î ¹Ù²Ù´Â Äڵ带 ³Ö¾îÁà¾ß ÇÑ´Ù. popSelectEvent?¸¦ ¹ÞÀÚ.
¸ð´Þ ÆûÀ» ¸ð´Þ¸®½ºÃ³·³ »ç¿ëÇϱâ
Çʵ忡 °ª ½Ø·Á³Ö±â ÃÖÁ¾ÆÇ 2002³â 9¿ù
USB to IrDA ¸ðµâÀ» ÀÌ¿ëÇؼ ÀÎÅÍ³Ý °¡´ÉÇØÁü.
Ŭ¸®¿¡ T650C´Â USB¶ó¼¸®... ppp Á¢¼ÓÀ» ÇÒ ¼ö°¡ ¾ø´Ù.
¶§¸¶Ä§ ³ëÆ®ºÏµµ ¾ø¾î¼ IR Åë½Å pppµµ ºÒ°¡´ÉÇÏ´Ù. -_-;
WinSetDrawWindow? »ç¿ëºÒ´É - µû¶ó¼ WinCreateOffscreenWindow?()µîÀÇ ÇÔ¼ö·Î ¸¸µç °¡»ó À©µµ¿ì(Win32¿¡¼ÀÇ MemDC¿Í ºñ½ÁÇÑ °³³ä)¿¡ ¹º°¡¸¦ ±×¸± ¼ö°¡ ¾ø±â ¶§¹®¿¡ °¡»ó À©µµ¿ì »ç¿ëµµ ºÒ°¡ÇÏ´Ù.
ȸ鿡 ¹º°¡¸¦ ±×¸®´Â ÇÔ¼öÀÇ °æ¿ì¿¡´Â, ¿¹Àü ÀÏ¹Ý API¸¦ »ç¿ëÇϸé ÀúÇØ»óµµ ¸ðµå¿¡ ¸ÂÃç¼ ±×·ÁÁø´Ù. (ȤÀº, ¿¡·¯°¡ ³´Ù)
ÀúÇØ»óµµ ºñÆ®¸ÊÀÇ ¼Ò½º µ¥ÀÌÅ͸¦ ÇöÀç Æû À©µµ¿ì¿¡(ºñÆ®¸Ê ¼Ò½ºÀÇ ÁÖ¼Ò°ªÀ» ¾Ë¾Æ³»¼) Ä¥Çعö¸°´Ù.
¹®Á¦ÀÇ ¼ÒÁö°¡ ÀÖ´Â °ÍÀ¸·Î º¸ÀÌÁö¸¸, ¾ÆÁ÷±îÁö´Â Á¤»óÀûÀ¸·Î-°ÑÀ¸·Î º¸±â¿¡´Â-µ¿ÀÛÇÏ°í ÀÖ´Ù.
2002³â 8¿ù
BMP »ý¼º ¹× °¡»ó À©µµ¿ì¿¡¼ ³»¿ë ¿Å±â±â
WinHandle hWndScreen,oldDrawWinH;
UInt16 error;
BmpType* pBmpScreen
oldDrawWinH = WinGetDrawWindow();
pBmpScreen = BmpCreate(160,160,8,NULL,&error);
if(pBmpScreen)
{
hWndScreen = WinCreateBitmapWindow(pBmpScreen, &error);
if(hWndScreen)
{
WinSetDrawWindow(hWndScreen);
WinSetForeColor(BLACK);
WinDrawLine(0,0,10,10);
WinDrawLine(10,10,20,20);
WinSetForeColor(WHITE);
WinDrawLine(10,10,0,0);
WinDrawLine(20,20,10,10);
}
}
WinSetDrawWindow(oldDrawWinH); // ¿ø·¡ À©µµ¿ì ÇÚµé ¼³Á¤À¸·Î µ¹¾Æ¿È
WinSetDrawMode(winPaint);
WinDrawBitmap(pBmpScreen,0,0); // ½ÇÁ¦ ºñÆ®¸ÊÀ» ±×·ÁÁÖ´Â ÄÚµå
WinDeleteWindow(hWndScreen, true);
hWndScreen = NULL;
delete pBmpScreen;
pBmpScreen = NULL;
}
---
ÇöÀç ±â±âÀÇ »ç¿ëÀÚÀ̸§ ¾Ë¾Æ³»±â(HotSync?½Ã ½Äº°¿ëµµ·Îµµ »ç¿ë)
Char szUserName[32];
DlkGetSyncInfo (NULL, NULL, NULL, szUserName, NULL, NULL);
¸ð´ÞÆû Á¦´ë·Î »ç¿ëÇϱâ
FormPtr previousForm = FrmGetActiveForm();
FormPtr frm = FrmInitForm(ID_PASSWORD);
UInt16 hitButton;
FieldPtr fieldPtr;
MemHandle passwdH;
FrmSetActiveForm(frm);
FrmSetEventHandler(frm, PasswordFormHandleEvent);
/* Set default password to blank */
fieldPtr = FrmGetObjectPtr (frm, FrmGetObjectIndex (frm, ID_PASSWORD_PASSWORD));
passwdH = MemHandleNew (maxlength);
MemMove (MemHandleLock (passwdH), "\0", 1);
MemHandleUnlock (passwdH);
FldSetTextHandle (fieldPtr, (Handle)passwdH);
FrmSetFocus(frm, FrmGetObjectIndex(frm, ID_PASSWORD_PASSWORD));
hitButton = FrmDoDialog(frm);
if (hitButton == ID_PASSWORD_OK)
{
MemSet (password, maxlength, 0);
if ((FldGetTextPtr (fieldPtr) != NULL) && ((StrLen (FldGetTextPtr (fieldPtr)) + 1) < maxlength))
MemMove (password, FldGetTextPtr (fieldPtr), StrLen (FldGetTextPtr (fieldPtr)) + 1);
else
hitButton = ID_PASSWORD_CANCEL;
}
if (previousForm)
FrmSetActiveForm(previousForm);
FrmDeleteForm(frm);
return (hitButton == ID_PASSWORD_OK);
ÄÁÆ®·ÑÀ» Æû¿¡¼ °¨Ãß±â/º¸¿©ÁÖ±â
FrmHideObject(frmP,FrmGetObjectIndex(frmP,PreferencesNamingPortField));
FrmShowObject(frmP,FrmGetObjectIndex(frmP,PreferencesNamingPortField));
¸î°¡Áö ¹æ¹ýÀÌ ´õ ÀÖÀ» ¼ö ÀÖÀ¸³ª, ¾î¶² ÄÁÆ®·Ñ¿¡µµ Àû¿ëÇÒ ¼ö ÀÖ´Ù´Â Á¡¿¡¼ ÁÁ´Ù.
¸Þ´º, ȤÀº ¹öÆ°ÀÌ Å¬¸¯µÇ¾úÀ» ¶§ FrmGotoForm(FORM_ID)·Î ÆûÀ¸·Î À̵¿
AppHandleEvent¿¡¼ frmLoadEvent°¡ ¹ß»ýÇÏ°Ô µÇ¹Ç·Î, FrmInitForm, FrmSetActiveFormÀ» È£ÃâÇÑ´Ù.
FrmSetEventHandler(frmP, PreferencesFormHandleEvent); ·Î ÇØ´ç Æû¿¡ À̺¥Æ® Çڵ鷯¸¦ ÇÒ´ç.
±×·± ´ÙÀ½ ƯÁ¤ ¹öÆ°ÀÇ À̺¥Æ®¿¡ FrmGotoForm(MainForm)¸¦ ÇÒ´çÇÏ°í, frmCloseEvent½Ã FrmEraseForm(frmP); FrmDeleteForm(frmP);¸¦ È£Ãâ.
ÀÌ·¯¸é ¸Þ¸ð¸®ÀÇ ³¶ºñ¾øÀÌ(¹°·Ð ¸ÞÀÎÆûÀº °è¼Ó ¸Þ¸ð¸®¿¡ ³²¾Æ ÀÖÁö¸¸..) ´Ù¸¥ ÆûÀ» È£ÃâÇß´Ù°¡ Áö¿ï ¼ö ÀÖ´Ù.
¹°·Ð ¹öÆ°ÀÌ OK/Cancel»ÓÀ϶§´Â ±×³É FrmDoDialog()¸¦ ¾²´Â°Ô ÁÁ´Ù.
FieldType* field;
Char* dest;
Char tempNum[5];
Handle handle, oldHandle;
GetObjectPtr(field, FieldID);
oldHandle = FldGetTextHandle(field); // get the current text handle
if(oldHandle)
{
FldSetTextHandle(field,NULL); // release this handle from field
MemHandleFree(oldHandle);
}
StrIToA(tempNum, num);
handle = MemHandleNew(strlen(tempNum)+1);
dest = (Char*)MemHandleLock(handle);
strcpy(dest, tempNum);
MemHandleUnlock(handle);
FldSetTextHandle(field,handle);
À§¿Í °°ÀÌ ÇÑ ´ÙÀ½, frmCloseEvent?¸¦ ¹ÞÀ» ¶§ °¢ Çʵ忡 FldFreeMemory?()¸¦ È£ÃâÇÑ´Ù :
FieldType *pField; GetObjectPtr(pField, PreferencesNamingPortField); FldFreeMemory(pField);
if (eventP->eType == frmLoadEvent) { // Load the form resource. formId = eventP->data.frmLoad.formID; frmP = FrmGetFormPtr(formId); if (frmP == 0) frmP = FrmInitForm(formId); FrmSetActiveForm(frmP);À§ ÄÚµå´Â ÆûÀ» ·ÎµåÇÒ ¶§ ¾²´Â °ÍÀε¥, ÀÌÀ¯¾øÀÌ FrmInitForm?¿¡¼ NULL HandleÀ̶õ ¿¡·¯°¡ »¶»¶ ³ª¸é Ʋ¸²¾øÀÌ ¸®¼Ò½º¸¦ Á¦´ë·Î ÀоîµéÀÌÁö ¸øÇÏ´Â °ÍÀ̹ǷÎ... ¸®¼Ò½º Çì´õ ÆÄÀÏÀÇ À§Ä¡°¡ Rsc Æú´õ¿¡ ÀÖ´ÂÁö È®ÀÎÇÏ°í, ÇÁ·ÎÁ§Æ®¿¡ Æ÷ÇÔµÈ rsrc ÆÄÀÏÀÇ °æ·Îµµ È®ÀÎÇغ»´Ù. (È÷µçÆú´õ ¾È¿¡ ÀÖ´Â°Ô ¿¬°áµÇ¾î ÀÖÀ¸¸é Á¶¶©°Å½Ã´Ù)
°³¹ßÅøÀ» CodeWarrior R8(update to 8.3)À¸·Î º¯°æÇÏ´Ù.
¿¡·¯287°³¿ö´×66°³ÀǼҽºÄڵ带´«¾Õ¿¡µÐÄÚ´õÀdzú¸®¿¡Á¶¶Ç¶ó´Â´Ü¾î°¡½ºÃÄ°£´Ù.
ÄÚ´õ¿© ½ÅÈ°¡ µÇ¾î¶ó.
GCC ÃÖ°íÀÇ ÀâÁú...
¾îÁ¦ÀÇ ±³ÈÆ - ¾öÇÏ°Ô ÇÁ·Î±×·¥ À̸§À» ¹Ù²Ù·Á´Ù°£ Á¶¶§´Â ¼ö°¡ ÀÖ´Ù :
´ÜÁö Helloworld¸¦ TelnetTest?·Î ¹Ù²å´Ù°¡
ÇÁ·Î±×·¥ Å©±â°¡ 12¹è(32KB -> 390KB)·Î ´Ã¾î³ª´Â
Ȳ´çÇÑ °æÇèÀ» ÇÔ. -_-
(Âü°í·Î, PalmOS 3.5¿¡¼, 64KB(65505) ÀÌ»óÀÇ ÄÚµå´Â ·Îµå ÀÚü°¡ ºÒ°¡´ÉÇÏ´Ù.
...
ÀÏ´Ü CClientSocket?Àº RFB ÇÁ·ÎÅäÄÝ °ü·Ã ºÎºÐÀÌ ¿©·¯°¡Áö·Î ÇÇ°ïÇÏ°Ô µÇ¾î ÀÖÀ¸´Ï. -_- Àá½Ã º¸·ù.
std ¶óÀ̺귯¸®¶óµµ »ç¿ë °¡´ÉÇÏ°Ô µÅ¾ß ¹» ¾îÄÉ ÇÒ ¼ö ÀÖÀ» µí.
CListenSocket?Àº AcceptÇßÀ» ¶§...
»õ·Î¿î ¼ÒÄÏ(CClientSocket?)À» »ý¼ºÇÑ ÈÄ¿¡ óÀ½ ¼ÒÄÏÀÇ ¼³Á¤À» ÇØÁÖ´Â ºÎºÐ... °ú.
¼ÒÄÏÀÇ ¸®½ºÆ®¸¦ »ý¼ºÇؼ °¢ ¼ÒÄÏ¿¡°Ô ½ÇÇà ½Ã°£À» ÇÒ´çÇÏ´Â ºÎºÐÀ» ¸¸µé¾î¾ß ÇÏ°Ú´Ù...
Áö±Ý ¾ÆÀ̵ð¾î·Î´Â, ÀÏ´Ü Ã³À½ºÎÅÍ ¸®½ºÆ®¸¦ »ý¼ºÇؼ
¸®½ºÆ®ÀÇ Ã³À½¿¡ ±âº» ¼ÒÄÏÀ» ³Ö°í (¸®½¼À̵ç Ŭ¶óÀ̾ðÆ®µç) m_bSocketRunning?Àº false »óÅ¿¡¼
¹º°¡ ¾×¼¼½º°¡ µé¾î¿À°Å³ª, ¿¬°áÇϰųª, ±×¶§ºÎÅÍ ¼ÒÄÏÀ» Ãß°¡Çؼ
°¢ ¼ÒÄÏ¿¡ ½ÇÇà ½Ã°£À» ÇÒ´çÇÏ´Â ºÎºÐÀ» ¸¸µé¾î¾ß ÇÒ °Í °°´Ù.
m_bEnd´Â »ç¿ëÇؾ߸¸ ÇÒ °Í °°´Ù... °á±¹.
¼ÒÄÏÀÌ ÀÛµ¿ÇÏ´ÂÁöÀÇ ¿©ºÎ¸¸À¸·Î´Â ¾ðÁ¦ ¼ÒÄÏÀ» Á׿©¾ßÇÒÁö ¾Ë ¼ö ¾øÀ¸´Ï±î.
ÀÚ. ÀÚ.. ÀÏ´ÜÀº ÇÁ·ÎÅäŸÀÔÀ» ¸ñÇ¥·Î.
MoveNext?(pNode);
...
void MoveNext?(Node *pNode)
{ pNode = pNode->m_pNext; }
¿ª½Ã óÀ½¿¡ Á¦´ë·Î µ¿ÀÛÇÏ´Â ³ÑºÎÅÍ º¸°í ³ª¼ ÇÁ·Î±×·¥À» Â¥¾ßÇÑ´Ù. -_-
¾î·°Å³ª, Ä¡¸íÀûÀÎ ¿¡·¯´Â Àâ¾ÒÀ¸´Ï..
¿¡·¯³µÀ»¶§ Reject ¶§·ÁÁÖ´Â ºÎºÐÀÌ ¹®Á¦°¡ µÇ´Â°Ç°¡.
·ÎÁ÷Àº Àú³á ¸Ô±¸ ¿Í¼ Àâ¾Æ¾ßÁö. ¶ö¶ó¶ó... -_-;
³ëµå¿¡ ÇØ´çÇϴ Ŭ·¡½º¿Í, ¸®½ºÆ®¿¡ ÇØ´çÇϴ Ŭ·¡½º¸¦ ¸Í±Û¾ú´Ù. (CXStreamDataNode?, CXObList?)
³ªÁß¿¡ void*¸¦ Áö¿øÇϴ Ŭ·¡½º·Î ¸¸µé±â·Î ÇÏ°í, Áö±ÝÀº ÀÏ´Ü ±×³É ¾²±â·ÎÇصû.
ÇϾÆ..
MSLÀ̶ó´Â ¹°°ÇÀÌ ÀÖ¾î¼...
ÀÌ°É ¾²¸é ÀÏ´ÜÀº ±âº»ÀûÀÎ ¶óÀ̺귯¸®´Â »ç¿ë°¡´ÉÇѵí Çѵ¥(IOStream.h µûÀ§¶óµç°¡)
CodeWarrior¿ë ¶óÀ̺귯¸®´Ù. [...]
GCC¿¡¼´Â »ç¿ëÀÌ ºÒ°¡´ÉÇÑ µí ½ÍÀ¸¹Ç·Î. ÀÏ´Ü Å»¶ô.
HP »êÇÏ ¿¬±¸¼Ò³ÑµéÀÌ ¸Í±Û¾ú´Ù´Â STL ¶óÀ̺귯¸®¸¦ °¡Á®´Ù°¡ ¾µ±î Çϴµ¥..
list.h¸¦ ÀÎŬ·çµåÇß´õ´Ï. ÀÌ·±.
Palm SDK¿¡ list.h¶õ À̸§À» °¡Áø Çì´õÆÄÀÏÀÌ ÀÌ¹Ì Àֱ⠶§¹®¿¡.. Ãæµ¹ÇÑ´Ù. -_-;
ÀÏ´ÜÀº À̸§ ¹Ù²ã¼¶óµµ ÁË´Ù ÀÎŬ·çµå¸¦ Çغ¼±î ¸»±î... °í¹ÎÁß. »ðÁúÇϴ°Ű¡µû.
ÈÞÀÏÀÇ º¸¶÷Âù »ðÁú. -_- ¹¹ ±×·¡µµ ¾¾µð±Á°í ȸÈÅ×ÀԿűâ´Â°Ç ÇßÀ¸´Ï±î ;
Handle handle;
// 10¹ÙÀÌÆ® Å©±âÀÇ Movable chunk(=heap)ÀÇ ÇÚµéÀ» ¹ÝȯÇÑ´Ù.
handle = MemHandleNew?(10); Char* szTemp;
// ÇÚµéÀÇ Lock count++(ÇÚµéÀ» Àá±Ù´Ù) ÇØ´ç ¸Þ¸ð¸® handleÀÇ Æ÷ÀÎÅ͸¦ ¹ÝȯÇÑ´Ù. (Non-Movable)
szTemp = (Char*)MemHandleLock?(handle);
// MemHandleUnlock?(handle)µµ µÇÁö¸¸, UnlockÀ» µÎ¹øÇÏ¸é ¿¡·¯°¡ ¹ß»ýÇÑ´Ù (lock count==0À϶§´Â UnlockÇÒ ¼ö ¾ø´Ù.)
MemPtrUnlock?(szTemp);
// ¸Þ¸ð¸® ÇÚµéÀ» ¹«È¿ÈÇÏ°í ÇØ´ç chunk¸¦ OS¿¡ ¹ÝȯÇÑ´Ù. MemPtrFree?(szTemp)µµ °¡´ÉÇÒ±î?... ÇغÁ¶ó.
MemHandleFree?(Handle);
//////////////////////////////////// //¼öÁ¤ ¹öÀü if(strlen(buffer) > 0) { FieldPtr field; Char* dest; Handle handle, oldHandle; field = (FieldPtr) FrmGetObjectPtr(FrmGetActiveForm(), FrmGetObjectIndex(FrmGetActiveForm(), ID_MAIN_MESSAGEWINDOW)); oldHandle = FldGetTextHandle(field); // get the current text handle FldSetTextHandle(field,NULL); // release this handle from field handle = MemHandleNew(strlen(buffer)+1); dest = (Char*)MemHandleLock(handle); strcpy(dest, buffer); FldSetTextHandle(field,handle); FldDrawField(field); oldHandle = FldGetTextHandle(field); // get the current text handle FldSetTextHandle(field,NULL); // release this handle from field MemPtrUnlock(dest); //MemHandleUnlock(handle); Æ÷ÀÎÅÍ·Î ¹ÞÀº Non-Movable ¿µ¿ªÀ» ÇØÁ¦ÇßÀ¸¹Ç·Î, µû·Î ÇÒ ÇÊ¿ä°¡ ¾ø´Ù. if(oldHandle) { MemHandleFree(oldHandle); } }
//////////////////////////////////////////// // ¸Þ¸ð¸® ´©Ãâ ¾øÀÌ Çʵ忡 Ãâ·ÂÇÏ´Â ·çƾ Char buffer[1024]; Int16 nBufferLen; nBufferLen = Receive(buffer,1024); ////////////////////////////////////// // ¸Þ½ÃÁöâ¿¡ Ãâ·ÂÇÏ´Â ·çƾ if(strlen(buffer) > 0) { FieldPtr field; Char* dest; Handle handle, oldHandle; field = (FieldPtr) FrmGetObjectPtr(FrmGetActiveForm(), FrmGetObjectIndex(FrmGetActiveForm(), ID_MAIN_MESSAGEWINDOW)); handle = MemHandleNew(strlen(buffer)+1); dest = (Char*)MemHandleLock(handle); strcpy(dest, buffer); FldSetTextHandle(field,handle); FldDrawField(field); oldHandle = FldGetTextHandle(field); // get the current text handle FldSetTextHandle(field,NULL); // release this handle from field MemPtrUnlock(dest); MemHandleUnlock(handle); if(oldHandle) { MemHandleFree(oldHandle); } }
ProcessEvent?()ÀÇ ÀÛ¼º ¿Ï·á. select()¸¦ ÀÌ¿ëÇÑ ExceptionÀº 󸮵ÇÁö ¾ÊÀ½. (PalmOS¿¡¼ Áö¿øÇÏÁö ¾ÊÀ½)
CClientSocket?, CListenSocket?, CXStreamBuffer?(+CXStreamData?) Ŭ·¡½ºÀÇ ÆÄÀϵé Ãß°¡, ÄÁ¹öÀü ½ÃÀÛ
setsockopt()·Î Non-Blocking ¸ðµå¸¦ ÁöÁ¤ÇÒ ¼ö ¾ø´Ù.
Except for the netSocketOptSockNonBlocking? option, all
options listed above have equivalents in the sockets API. The
netSocketOptSockNonBlocking? option was added to this call
in the net library in order to implement the functionality of the
UNIX fcntl() control call, which can be used to turn nonblocking
mode on and off for sockets.
Palm ³×Æ®¿÷ ÇÁ·Î±×·¡¹Ö½Ã ÁÖÀÇ»çÇ× :
´ë½Å °í·ÁÇØ¾ß ÇÒ Á¡Àº, ³×Æ®¿÷ °ü·Ã Àü¿ª º¯¼ö¸¦ ¹Ì¸® ¼±¾ðÇØ¾ß ÇÑ´Ù.
¼±¾ðÇؾßÇÒ Àü¿ª º¯¼ö´Â ´ÙÀ½°ú °°´Ù. (°³¹ß¹®¼³ª À§ Çì´õ ÆÄÀÏÀ» ÂüÁ¶)
NetLibSysFind? (¸Â³ª?) -> NetLibOpen? -> NetLibSocketOpen? -> ... -> NetLibSocketClose? -> NetLibClose?
°£´ÜÇÑ ¼ÒÄÏ ÇÁ·Î±×·¡¹ÖÀº À§¿Í °°Àº ÇÔ¼ö¸¦ »ç¿ëÇؼ ÇÒ ¼ö ÀÖ´Ù.
(À§ÀÇ ÇÔ¼ö Áß Çϳª¶óµµ ´©¶ôµÇ¸é Á¤»óÀûÀÎ ÇÁ·Î±×·¡¹ÖÀÌ ºÒ°¡´ÉÇÏ´Ù!)
Palm ³×Æ®¿÷ ¼ÒÄÏ ÇÁ·Î±×·¡¹Ö¿¡¼ ´ëÀÀµÇ´Â ŸÀÔ
socket(int) - NetSocketRef?
sockaddr(struct *void) - NetSocketAddrType?
domain(int) - NetSocketAddrEnum?
TCP/UDP type(int) - NetSocketTypeEnum?
protocol(int) - Int16
sockaddr_in(struct *void) - NetSocketAddr?INType
system/sys_socket.h ÆÄÀÏ¿¡ Berkeley Socket API°¡ Á¤ÀǵǾî ÀÖ´Ù.
(ÀϺδ ¿ø·¡ ÇÔ¼öÀÇ ¿øÇüÀ¸·Î µ¿ÀÛÇÏ°í, ±×·¸Áö ¾ÊÀº °Íµµ ÀÖ´Ù.)
CXSocket -> CPalmXSocketÀ¸·Î ÄÁ¹öÁ¯ ½ÃÀÛ.
Palm ÇÁ·Î±×·¡¹Ö¿¡¼ »ç¿ëÇϴ ŸÀÔµé
Development Tools Guide p.383 Âü°í(Int16, UInt32.. °°Àº Çü½Ä. Çڵ鵵 Âü°í)
³×Æ®¿÷ °ü·Ã(Berkeley Socket API) : Palm OS Companion2.pds p.144 Âü°í
ÇöÀç Ç¥½ÃÁßÀΠȸéÀ» ³ªÅ¸³»´Â ±¸Á¶Ã¼ :
/* defines boudaries of the Pilot viewport */
typedef struct {
NetLibSend? ; Purpose Send data to a socket from a single buffer.
Int16 NetLibSend? (UInt16 libRefNum?, NetSocketRef? socket, void *bufP, UInt16 bufLen,
UInt16 flags, void *toAddrP, UInt16 toLen, Int32 timeout, Err *errP)
-> libRefNum? Reference number of the net library.
-> socket Descriptor for the open socket.
-> bufP Pointer to data to write.
-> bufLen Length of data to write
-> flags One or more netIOFlagxxx flags. See ¡°I/O Flags.¡±
-> toAddrP Address to send to (a pointer to a NetSocketAddrType?), or 0.
-> toLen Size of toAddrP buffer.
-> timeout Maximum timeout in system ticks; -1 means wait forever.
<- errP Contains an error code if the return value is -1.
Returns the number of bytes successfully sent. Returns 0 if the
socket has been shut down by the remote host. If the return value is
-1, an error has occurred, and errP contains one of the following
values:
0 No error.
netErrTimeout? Call timed out.
netErrNotOpen? The referenced net library has not been opened
yet.
netErrParamErr?
netErrSocketNotOpen?
netErrMessageTooBig?
netErrSocketNotConnected?
netErrSocketClosedByRemote?
netErrIPCantFragment?
netErrIPNoRoute?
netErrIPNoSrc?
netErrIPNoDst?
netErrIPktOverflow?
netErrOutOfCmdBlocks?
netErrOutOfPackets?
netErrInterfaceNotFound?
netErrInterfaceDown?
netErrUnreachableDest?
netErrNoMultiPktAddr?
netErrWouldBlock?
Sockets Equivalent
int sendto (int socket, const void *bufP,
int bufLen, int flags, const void *toAddrP,
int toLen);
int send (int socket, const void *bufP,
int bufLen, int flags);
int write (int socket, const void *bufP,
int bufLen,);
Comments
This call attempts to write data to the specified socket and returns
the number of bytes actually sent, which may be less than or equal
to the requested number of bytes. The data is passed in a single
buffer that bufP points to.
For datagram sockets, you must only send a single packet at a time.
If the data is too large to fit in a single UDP packet (1536 bytes), no
data is sent and -1 is returned.
The toAddrP field applies only to datagram sockets without an
existing connection. An error is returned if the datagram socket was
previously connected and toAddrP is specified. Stream-based
sockets, by definition, must have a connection established with a
remote host before data can be written. Raw sockets (supported in
Palm OS version 3.0 and higher) must construct the entire IP header,
including the destination address, before data can be sent; thus, the
address is taken from the data to be sent.
If there isn¡¯t enough buffer space to send any data, this call will
block until there is enough buffer space, or until a timeout.
NOTE: For stream-based sockets, this call may write only a
portion of the desired data. It always returns the number of bytes
actually written. Consequently, the caller should be prepared to
call this routine repeatedly until the desired number of bytes have
been written, or until it returns 0 or -1.
ÆûÀÌ ¿©·¯°³ÀÏ ¶§¿¡ À̺¥Æ® ÇÚµéÀ» ÇÒ´çÇÏ´Â ¹æ½Ä ;
switch(formId)
{
RGB °ü·Ã/ÆÈ·¹Æ®, Ä÷¯ À©µµ¿ì ½Ã½ºÅÛ¿¡ °ü·ÃµÈ °ÍÀº 3.5 À̻󿡼 »ç¿ë °¡´É.
Err WinPalette? (UInt8 operation, Int16 startIndex, UInt16 paletteEntries, RGBColorType? *tableP)
ÇöÀçÀÇ À©µµ¿ì ÆÈ·¹Æ®¸¦ ¼³Á¤/°¡Á®¿À°Å³ª µðÆúÆ® °ª ¼³Á¤ÇÏ´Â ¸í·É(V3.5 ÀÌ»ó)
SysLibFind? ; ½Ã½ºÅÛ¿¡ ÀÌ¹Ì ·ÎµåµÇ¾î ÀÖ´Â ¶óÀ̺귯¸®¸¦ ãÀ½. ´ëºÎºÐÀÇ ¶óÀ̺귯¸®(NetLib?,Serial,IR)Àº
¸®¼ÂµÇ¸é ÀÚµ¿À¸·Î ·ÎµåµÇ±â ¶§¹®¿¡, ±âŸ ¶óÀ̺귯¸®´Â SysLibLoad?¸¦ »ç¿ëÇؼ ·ÎµåÇÑ ÈÄ »ç¿ëÇÑ´Ù.
typedef struct RectangleType? {
DmOpenRef? DmOpenDatabaseByTypeCreator?(UInt32 type, UInt32 creator, UInt16 mode)
ÇÁ·Î±×·¥ÀÌ ±¸µ¿µÉ ¶§ ÇÊ¿äÇÑ »çÀüÁ¤º¸¸¦ °¡Á®¿À´Â ±â´ÉÀ¸·Î »ç¿ë. (V3.5 ÀÌ»ó)
Programming Palm OS in a Nutshell
Why Programming for Palm OS Is Different
ȸé Å©±â ; Åë»óÀûÀ¸·Î 160x160 Å©±â°¡ Áö¿øµÈ´Ù.
ºü¸¥ ¹ÝÀÀ¿¡ ´ëÇÑ ±â´ë ; º¸Åë ÆÊ À¯Àú´Â ÇÏ·ç¿¡ 15~20¹ø ÆÊ ¾ÖÇø®ÄÉÀ̼ÇÀ» º¸Åë ¼ö½ÊÃÊ µ¿¾È ½ÇÇàÇÑ´Ù.
PC¿ÍÀÇ ¿¬°á¼º ; PC-PalmÀÇ ¿¬°á ¼ö´ÜÀÎ Conduit ÇÁ·Î±×·¥ÀÌ Á¸ÀçÇÑ´Ù.
ÀÔ·Â ¹æ¹ý ; Graffiti
Àü¿ø ; ÇÁ·Î¼¼½Ì ÆÄ¿öÀÇ Á¦¾à
¸Þ¸ð¸® ; °¡´ÉÇÏ´Ù¸é, Èü ¸Þ¸ð¸®-¼Óµµ-ÄÚµå »çÀÌÁîÀÇ ¼øÀ¸·Î ÃÖÀûÈÇϴ°ÍÀÌ ÁÁ´Ù.
ÆÄÀÏ ½Ã½ºÅÛ ; PalmOS´Â record¶ó ºÒ¸®°í, database·Î Á¶Á÷µÇ´Â ¸Þ¸ð¸® ûũ¿¡ µ¥ÀÌÅ͸¦ ÀúÀåÇÒ ¼ö ÀÖµµ·Ï ÇØÁØ´Ù.
ÇÏÀ§ ȣȯ¼º
Palm OS Programming Concepts ; ÆÊ ÇÁ·Î±×·¥Àº º¸Åë ½Ì±Û½º·¹µåÀÇ À̺¥Æ® µå¸®ºì ÇÁ·Î±×·¥ÀÌ´Ù.
¸ðµç ÇÁ·Î±×·¥Àº ½ÇÇàµÉ ¶§ Launch code¸¦ ÀÎÀÚ·Î °®°í, ÇØ´ç ÇÁ·Î±×·¥ÀÇ PilotMain?À» È£ÃâÇÑ´Ù.
PalmOS´Â À̺¥Æ®±â¹ÝÀÇ ¿î¿µÃ¼Á¦ÀÌ´Ù. ¸ðµç ÇÁ·Î±×·¥Àº À̺¥Æ® ·çÇÁ¸¦ °¡Áö³ª, ±×·¸Áö ¾ÊÀ» ¼öµµ ÀÖ´Ù.
À¯Àú ÀÎÅÍÆäÀ̽º´Â formµé·Î ±¸¼ºµÇ¸ç, UI´Â ¹Ì¸® Á¤ÀÇµÈ UI ¿ä¼Ò, ȤÀº »ç¿ëÀÚ Á¤ÀÇ UI ¿ä¼Ò¸¦ °¡Áú ¼ö ÀÖ´Ù.
¸ðµç ÀÀ¿ë ÇÁ·Î±×·¥Àº ½Ã½ºÅÛ¿¡¼ Á¦°øÇÏ´Â µ¥ÀÌÅÍ °ü¸® ¹æ¹ýÀ» »ç¿ëÇØ¾ß ÇÑ´Ù.
PalmOS¿¡¼ Á¦°øÇÏ´Â ¸î¸î °ü¸®ÀÚµéÀ» »ç¿ëÇؼ ¿øÇÏ´Â ±â´ÉÀ» ±¸ÇöÇ϶ó. Ç¥ÁØ ANSI C ¶óÀ̺귯¸®´Â PalmOS¿¡¼ »ç¿ëÇÒ ¼ö´Â ÀÖÀ¸³ª, Å« ½ÇÇà ÆÄÀÏÀ» ¸¸µé°Ô µÈ´Ù.
Programming Tools
The CodeWarrior Debugger handles source-level debugging. You can use it with an application running on the Palm OS device, or you can use it in conjunction with one of the other debugging tools below.
The Palm OS Emulator (POSE) tests your application on the desktop computer before downloading it onto the device.
On the Macintosh, you can build a Simulator version of your application to test it. This is a standalone Mac OS application that runs your Palm OS application on a Macintosh computer.
The Palm Debugger is an assembly-level tool. You can also use it to enter commands directly to the Palm device.
Where to Go From Here
Palm OS Companion.pdf
The rest of this book provides details on how to implement common application features using the Palm OS SDK. If you¡¯re new to Palm OS programming, you need to read the next three chapters to learn the principles of Palm OS application and UI design, how to implement the main function, and how to implement the standard event loop. The remaining chapters you can read on an as-needed basis.
Example applications
The actual source code for the applications on the Palm OS device is included as examples on your SDK CD. The code can be a valuable aid when you develop your own program. The software development kit provides a royalty-free license that permits you to use any or all of the source code from the examples in your application.
Palm OS Programming Development Tools Guide
The Palm OS Programming Development Tools Guide provides more details on using the tools to debug programs. (You might also be interested in the ¡°Debugging Strategies¡±chapter in this book, which describes programmatic debugging solutions.)
Palm OS Programmer¡¯s API Reference
The reference book provides the details on all of the public data structures and API calls.
Conduit Development Kits and documentation
If you need to write a conduit for your application, see the documentation provided with the Conduit Development Kits.
Visual C++¿¡¼ÀÇ ÆÊ ÄÚµå ÄÚµù
GCC ±â¹ÝÀ¸·Î Win32 ȯ°æ¿¡¼ ÆÊ ÇÁ·Î±×·¡¹ÖÀ» Çϸé... ¼ÖÁ÷È÷ ·¹ÆÛ·±½º º¸±â°¡ ±ÍÂú´Ù. ÀÔ·ÂÀÌ Á¦´ë·Î µÈ°ÇÁö ¾Æ´ÑÁöµµ ¸ð¸£°Ú°í. ±×·² °æ¿ì ¾Æ·¡ ¹æ¹ýÀ» »ç¿ëÇØ º¸ÀÚ :
Visual Assist¸¦ ¼³Ä¡ÇÑ ÈÄ, Visual C++À» ¶ç¿î´Ù. Tools -> Options ¸Þ´º¿¡¼ Directories Ç׸ñ¿¡¼ Show directories for: ¸¦ Include files·Î ¼±ÅÃÇÏ°í, C:\PALMDEV\SDK-3.5\INCLUDE, C:\PALMDEV\SDK-3.5\INCLUDE\CORE, C:\PALMDEV\SDK-3.5\INCLUDE\CORE\HARDWARE, C:\PALMDEV\SDK-3.5\INCLUDE\CORE\SYSTEM, C:\PALMDEV\SDK-3.5\INCLUDE\CORE\UI µîÀ» Ãß°¡ÇÑ´Ù. (¼³Ä¡ÇÑ sdkÀÇ ¹öÀü¿¡ µû¶ó, ȤÀº µµ±¸ÀÇ ±¸¼º¿¡ µû¶ó °æ·Î´Â ´Þ¶óÁú ¼ö ÀÖ°Ú´Ù)
¿©ÀüÈ÷ ºÒÆíÇÏ´Ù¸é ÇÒ ¼ö ¾øÁö¸¸, ÃÖ¼ÒÇÑ ÇÔ¼ö À̸§À» Ʋ¸®°Ô ÀÔ·ÂÇÑ °Í °°Àº »ç¼ÒÇÑ ¿¡·¯´Â ½±°Ô ÀâÀ» ¼ö ÀÖÀ» °ÍÀÌ´Ù.
Palm¿¡¼ÀÇ ÄÄÆÄÀÏ
m68k-palmos-gcc -palmos3.5 -g
´ç¿¬ÇÑ À̾߱âÁö¸¸, »óÀ§ ¹öÀüÀ¸·ÎÀÇ È£È¯¼ºÀº À־ ÇÏÀ§ ¹öÀüÀ¸·ÎÀÇ È£È¯¼ºÀº ¾ø´Ù. °¡´ÉÇÏ¸é ³·Àº ¹öÀüÀÇ sdk·Î ÄÄÆÄÀÏÇÑ´Ù.