From dan at dogmelon.com.au Thu Jun 2 16:34:37 2005 From: dan at dogmelon.com.au (Dan Fletcher) Date: Thu Jun 2 00:35:25 2005 Subject: [missing-sync-palmos-dev-talk] Problems creating Palm Databases with MissingSync Message-ID: <200562153437.587237@balants-champ> I'm having some problems with conduits when they try and create databases on the Palm. First some background: I'm trying to port the NoteStudio conduit from Windows to Mac. This is quite a complicated conduit, that can sync multiple networked computers, and uses multiple databases on the Palm. These database names are dynamically named, so their names aren't known at compile time. I'm using XTools 1.5, installed on an iBook g4 with OSX 10.3.9, using the Cocoa MemoPad demo provided on the MarkSpace website, linking against the 10.2.8 SDK and Palm CDK 4.0.3, and I'm using Missing Sync version 4.0.5 (v63) Fortunately the conduit was initially designed on windows with the sync logic and the setup separated, so I thought porting it should be quite easy. The first thing I tried was just retrofitting the demo conduit with our code. It compiled and linked ok, but whenever it tried to create a database, a "funny" database would be created instead. It would have the correct creatorID, but everything else would be wrong. The name would be rubbish(Looking at the filename in a hex editor, it would be ascii code 08), the type field would contain rubbish, etc. So I tried just doing the create DB code in the demo conduit. Same effect. So I tried copy and pasting the create db code from the demo itself, just to make it create the file. Same effect! The original code compiled on windows, and the other code came from the demo, so I don't think the code is the problem. But just in case, the code is like this (Pasted in the demo just above: // Grab the memo pad data for the current user.) CDbCreateDB createInfo; createInfo.m_FileHandle = 0; createInfo.m_Creator = 'DMWI'; createInfo.m_Flags = (eDbFlags) (eRecord | eBackupDB); createInfo.m_CardNo = 0; memset(createInfo.m_Name,SYNC_DB_NAMELEN,0); strcpy(createInfo.m_Name, "aa_dan"); createInfo.m_Type = 'DATA'; createInfo.m_Version = 0; createInfo.m_dwReserved = 0; syncErr = [mSyncMgr createDB:createInfo]; if (syncErr == SYNCERR_NONE) { syncErr = [mSyncMgr closeDB:mDbHandle]; } return 0; It looks like everything else works, just not creating databases. Any ideas about what I could be doing wrong? I'm copying the created plugin files into /Library/Application Support/Palm HotSync/Conduit directory. I know the conduit is being run correctly, because Log statements I add are shown in the Hot Sync log. A few other questions that came up whilst I was doing this. 1) Is it a requirement to link against the 10.2.8 SDK? I didn't have this at first, so I was linking against the current OS SDK. Since then I've downloaded the 10.2.8 SDK, and link against that instead, but it doesn't seem to make any difference. 2) Do the original Palm CDK API calls still work? Can I call SyncCreateDB, or should I call [mSyncManager createDB] ? I've tried both, with no apparent change. I'd rather call SyncCreateDB if I can, because it won't require any code changes... 3) What exactly is the Remote Database Names list in the ConduitInfo.plist file used for? Can the conduit create databases NOT in that list? There is no way for us to know all the database names at compile time, so hopefully this isn't a requirement. Any feedback would be very welcome. I've just about reached the limit of ideas that I can think ok. I'm guessing it isn't the code, and is more likely the project (or even the iBook) setup, but I'm using the initial demo project, so it should be fine. In fact, I've just re-downloaded it to make sure I was using a clean, unaltered project, but no luck :( Dan Fletcher dogMelon Pty Ltd _______________________________________________________ Dan Fletcher dogMelon Pty Ltd Note Studio: A Powerful Note Taking system for your PC. Try a free demo today at http://www.dogmelon.com.au/nspc From sgruby at markspace.com Thu Jun 2 08:32:51 2005 From: sgruby at markspace.com (Scott Gruby) Date: Thu Jun 2 07:32:57 2005 Subject: [missing-sync-palmos-dev-talk] Problems creating Palm Databases with MissingSync In-Reply-To: <200562153437.587237@balants-champ> References: <200562153437.587237@balants-champ> Message-ID: <6B046E52-D670-4A6E-A52C-80639F1954BB@markspace.com> On Jun 2, 2005, at 12:34 AM, Dan Fletcher wrote: > I'm having some problems with conduits when they try and create > databases > on the Palm. > > First some background: > I'm trying to port the NoteStudio conduit from Windows to Mac. This is > quite a complicated conduit, that can sync multiple networked > computers, > and uses multiple databases on the Palm. These database names are > dynamically named, so their names aren't known at compile time. > > I'm using XTools 1.5, installed on an iBook g4 with OSX 10.3.9, > using the > Cocoa MemoPad demo provided on the MarkSpace website, linking > against the > 10.2.8 SDK and Palm CDK 4.0.3, and I'm using Missing Sync version > 4.0.5 > (v63) > > Fortunately the conduit was initially designed on windows with the > sync > logic and the setup separated, so I thought porting it should be quite > easy. The first thing I tried was just retrofitting the demo > conduit with > our code. It compiled and linked ok, but whenever it tried to create a > database, a "funny" database would be created instead. It would > have the > correct creatorID, but everything else would be wrong. The name > would be > rubbish(Looking at the filename in a hex editor, it would be ascii > code > 08), the type field would contain rubbish, etc. > > So I tried just doing the create DB code in the demo conduit. Same > effect. > So I tried copy and pasting the create db code from the demo > itself, just > to make it create the file. Same effect! > > The original code compiled on windows, and the other code came from > the > demo, so I don't think the code is the problem. But just in case, > the code > is like this (Pasted in the demo just above: // Grab the memo pad > data for > the current user.) > > CDbCreateDB createInfo; > createInfo.m_FileHandle = 0; > createInfo.m_Creator = 'DMWI'; > createInfo.m_Flags = (eDbFlags) (eRecord | eBackupDB); > createInfo.m_CardNo = 0; > memset(createInfo.m_Name,SYNC_DB_NAMELEN,0); > strcpy(createInfo.m_Name, "aa_dan"); > createInfo.m_Type = 'DATA'; > createInfo.m_Version = 0; > createInfo.m_dwReserved = 0; > syncErr = [mSyncMgr createDB:createInfo]; > if (syncErr == SYNCERR_NONE) > { > syncErr = [mSyncMgr closeDB:mDbHandle]; > } > return 0; > > > It looks like everything else works, just not creating databases. > Any ideas > about what I could be doing wrong? > Yes. You're closing mDbHandle that is never set. You need to do: if (syncErr == SYNCERR_NONE) { mDbHandle = createInfo.m_FileHandle; syncErr = [mSyncMgr closeDB:mDbHandle]; } The database is created at the time of close, but you must pass a valid database handle. > I'm copying the created plugin files into /Library/Application > Support/Palm > HotSync/Conduit directory. I know the conduit is being run correctly, > because Log statements I add are shown in the Hot Sync log. > > A few other questions that came up whilst I was doing this. > 1) Is it a requirement to link against the 10.2.8 SDK? No. However, whatever SDK you link against is the minimum requirement for your conduit (more or less). > I didn't have this > at first, so I was linking against the current OS SDK. Since then I've > downloaded the 10.2.8 SDK, and link against that instead, but it > doesn't > seem to make any difference. > > 2) Do the original Palm CDK API calls still work? Can I call > SyncCreateDB, > or should I call [mSyncManager createDB] ? I've tried both, with no > apparent change. I'd rather call SyncCreateDB if I can, because it > won't > require any code changes... > Yes you can make calls using the Palm CDK APIs. > 3) What exactly is the Remote Database Names list in the > ConduitInfo.plist > file used for? Can the conduit create databases NOT in that list? > There is > no way for us to know all the database names at compile time, so > hopefully > this isn't a requirement. Please check the Palm CDK documentation for an explanation; it is the same as what is contained in the CInf resource. You can create databases not in the list; the list is a convenience list. -- Scott Gruby Lead Engineer Mark/Space, Inc. Please visit for assistance with Mark/Space products. From dan at dogmelon.com.au Fri Jun 3 17:35:10 2005 From: dan at dogmelon.com.au (Dan Fletcher) Date: Fri Jun 3 01:36:03 2005 Subject: [missing-sync-palmos-dev-talk] Problems creating Palm Databases with MissingSync In-Reply-To: <6B046E52-D670-4A6E-A52C-80639F1954BB@markspace.com> Message-ID: <200563163510.601133@balants-champ> > Yes. You're closing mDbHandle that is never set. You need to do: > > if (syncErr == SYNCERR_NONE) > { > mDbHandle = createInfo.m_FileHandle; > syncErr = [mSyncMgr closeDB:mDbHandle]; } > > The database is created at the time of close, but you must pass a > valid database handle. Nothing so easy unfortunately :( I actually was doing code identical to the above, I just accidentally removed that line when I copied and pasted the code into the email (I was removing a lot of redundant logging statements, and removed that line as well by accident). I don't know if it will help, but I've put a copy of the conduit project + the built version on our website here: http://www.dogmelon.com.au/downloads/tmp/MemoPadConduit.zip It shouldn't be confusing, as it's pretty much the standard demo with the code I mentioned. If you use this, it would be interesting to directly try the version I have already built first. If that works, then it must be my computer/palm setup, if not, then something else is going on... Thanks for your help so far. Dan From sgruby at markspace.com Fri Jun 3 08:18:19 2005 From: sgruby at markspace.com (Scott Gruby) Date: Fri Jun 3 07:18:24 2005 Subject: [missing-sync-palmos-dev-talk] Problems creating Palm Databases with MissingSync In-Reply-To: <200563163510.601133@balants-champ> References: <200563163510.601133@balants-champ> Message-ID: <8C1EC026-8026-4932-B694-BC8A7657191B@markspace.com> On Jun 3, 2005, at 1:35 AM, Dan Fletcher wrote: > > >> Yes. You're closing mDbHandle that is never set. You need to do: >> >> if (syncErr == SYNCERR_NONE) >> { >> mDbHandle = createInfo.m_FileHandle; >> syncErr = [mSyncMgr closeDB:mDbHandle]; } >> >> The database is created at the time of close, but you must pass a >> valid database handle. >> > > Nothing so easy unfortunately :( > > I actually was doing code identical to the above, I just accidentally > removed that line when I copied and pasted the code into the email > (I was > removing a lot of redundant logging statements, and removed that > line as > well by accident). > > I don't know if it will help, but I've put a copy of the conduit > project + > the built version on our website here: > > http://www.dogmelon.com.au/downloads/tmp/MemoPadConduit.zip > > It shouldn't be confusing, as it's pretty much the standard demo > with the > code I mentioned. If you use this, it would be interesting to > directly try > the version I have already built first. If that works, then it must > be my > computer/palm setup, if not, then something else is going on... > Turn on "Short Enumeration Constants" in the project; this is needed as the Palm OS CDK uses short enums all over the place. If this isn't already in the sample code, we'll fix it and try to put a new version on our server soon. Sorry for the inconvenience. -- Scott Gruby Lead Engineer Mark/Space, Inc. Please visit for assistance with Mark/Space products. From michael at codecobblers.com Fri Jun 3 10:49:16 2005 From: michael at codecobblers.com (Michael Hunley) Date: Fri Jun 3 10:10:46 2005 Subject: [missing-sync-palmos-dev-talk] Problems creating Palm Databases with MissingSync In-Reply-To: <8C1EC026-8026-4932-B694-BC8A7657191B@markspace.com> References: <200563163510.601133@balants-champ> <8C1EC026-8026-4932-B694-BC8A7657191B@markspace.com> Message-ID: <6.2.1.2.0.20050603094709.02f2ca30@ppmail.tunnel> > >Turn on "Short Enumeration Constants" in the project; this is needed >as the Palm OS CDK uses short enums all over the place. If this isn't >already in the sample code, we'll fix it and try to put a new version >on our server soon. I assume this setting is for XCode. Is the equivalent setting in CodeWarrior to have the "Enums always int" setting off? thanks. michael From sgruby at markspace.com Fri Jun 3 11:15:12 2005 From: sgruby at markspace.com (Scott Gruby) Date: Fri Jun 3 10:15:36 2005 Subject: [missing-sync-palmos-dev-talk] Problems creating Palm Databases with MissingSync In-Reply-To: <6.2.1.2.0.20050603094709.02f2ca30@ppmail.tunnel> References: <200563163510.601133@balants-champ> <8C1EC026-8026-4932-B694-BC8A7657191B@markspace.com> <6.2.1.2.0.20050603094709.02f2ca30@ppmail.tunnel> Message-ID: <20F9FD3C-1FB8-475E-88DA-85EFC1B8F330@markspace.com> On Jun 3, 2005, at 9:49 AM, Michael Hunley wrote: > > >> >> Turn on "Short Enumeration Constants" in the project; this is needed >> as the Palm OS CDK uses short enums all over the place. If this isn't >> already in the sample code, we'll fix it and try to put a new version >> on our server soon. >> > > I assume this setting is for XCode. Yes. > Is the equivalent setting in CodeWarrior to have the "Enums always > int" setting off? > I believe this is correct; on my CFM conduits, this setting is off. -- Scott Gruby Lead Engineer Mark/Space, Inc. Please visit for assistance with Mark/Space products.