NeoSmartpen / IOS-SDK2.0

for Neo smartpen SDK2.0
GNU General Public License v3.0
10 stars 11 forks source link

Pen Not Storing Offline Data #4

Open INKWRXJamie opened 7 years ago

INKWRXJamie commented 7 years ago

Hi,

Pen model NWP-F110 is not storing offline data. I have disconnected the pen from the phone, and stopped the app from running. Neither my implementation of the SDK nor the sample app see the strokes. The pen memory says 0, as if it's not saving it.

Is there some way for me to turn on offline sync mode on the pen? The documentation says it's turned on when the pen is first connected but it doesn't appear to be.

INKWRXJamie commented 7 years ago

Additionally: When using live strokes through the sample app, they work perfectly, so the pattern and the pen itself are fine, it just seems to not be storing strokes at all while disconnected from bluetooth

INKWRXJamie commented 7 years ago

Additional update: Tested the pen on the Windows SDK and sample app, both these display offline data lists.

For iOS, the sample app included with the v2.0 SDK and the sample app in the separate repo (v1) do not see these offline files.

louisjrpark commented 7 years ago

Dear INKWRXJamie,

To be honest with you, I will not be able to provide a proper feedback on your questions because there is no log which shows what happened in your test. Can you please provide me with a log from when you connect your pen with the sample app right after you write in the offline mode? Before you create a log for it, I will describe some points based on what you explained the above comments.

  1. Please go to the menu in the sample app and click 'OfflineData list' or 'Show OfflineData' after writing in the offline mode.

  2. Source codes The following codes should be executed. [[NJPenCommManager sharedInstance] setOfflineDataDelegate:self]; Then, NJOfflineDataDelegate below method will be called automatically later.

    • (void) offlineDataDidReceiveNoteList:(NSDictionary *)noteListDic
  3. The Bluetooth applied for Windows is SPP, but, that for iOS is BLE (Bluetooth Low Energy) BLE and SPP are different protocols.

Thanks Louis Park

INKWRXJamie commented 7 years ago

Please see attached below the logs from the sample application.

This covers the whole process from connecting the pen, and then opening the offline data file list.

At this point in the app, the data list is empty.

I have tested this pen on the Android SDK and on the Android SDK the pen reveals 2 offline data notes, however the sample application on iOS does not show anything.


2017-09-18 17:29:51.548767+0100 n2sample[4306:5509378] Scanning started 2017-09-18 17:29:51.708048+0100 n2sample[4306:5509420] Discovered NWP-F110 at -47 2017-09-18 17:29:51.708163+0100 n2sample[4306:5509420] advertisement.localname (null) 2017-09-18 17:29:51.708402+0100 n2sample[4306:5509420] advertisement.manufactureData 9c7bd202ad37 2017-09-18 17:29:51.708698+0100 n2sample[4306:5509420] advertisement.serviceUUIDs ( 18F1 ) 2017-09-18 17:29:51.708815+0100 n2sample[4306:5509420] found service 18F1 2017-09-18 17:29:51.708879+0100 n2sample[4306:5509420] new discoveredPeripherals, rssi -47 2017-09-18 17:29:51.927241+0100 n2sample[4306:5509378] Discovered NWP-F110 at -46 2017-09-18 17:29:51.927439+0100 n2sample[4306:5509378] advertisement.localname (null) 2017-09-18 17:29:51.928002+0100 n2sample[4306:5509378] advertisement.manufactureData 9c7bd202ad37 2017-09-18 17:29:51.928548+0100 n2sample[4306:5509378] advertisement.serviceUUIDs ( 18F1 ) 2017-09-18 17:29:51.928817+0100 n2sample[4306:5509378] found service 18F1 2017-09-18 17:29:52.141451+0100 n2sample[4306:5509427] Discovered NWP-F110 at -46 2017-09-18 17:29:52.141651+0100 n2sample[4306:5509427] advertisement.localname (null) 2017-09-18 17:29:52.141863+0100 n2sample[4306:5509427] advertisement.manufactureData 9c7bd202ad37 2017-09-18 17:29:52.142101+0100 n2sample[4306:5509427] advertisement.serviceUUIDs ( 18F1 ) 2017-09-18 17:29:52.142295+0100 n2sample[4306:5509427] found service 18F1 2017-09-18 17:29:52.357636+0100 n2sample[4306:5509420] Discovered NWP-F110 at -55 2017-09-18 17:29:52.357790+0100 n2sample[4306:5509420] advertisement.localname (null) 2017-09-18 17:29:52.358082+0100 n2sample[4306:5509420] advertisement.manufactureData 9c7bd202ad37 2017-09-18 17:29:52.358321+0100 n2sample[4306:5509420] advertisement.serviceUUIDs ( 18F1 ) 2017-09-18 17:29:52.358496+0100 n2sample[4306:5509420] found service 18F1 2017-09-18 17:29:52.570729+0100 n2sample[4306:5509427] Discovered NWP-F110 at -54 2017-09-18 17:29:52.570892+0100 n2sample[4306:5509427] advertisement.localname (null) 2017-09-18 17:29:52.571096+0100 n2sample[4306:5509427] advertisement.manufactureData 9c7bd202ad37 2017-09-18 17:29:52.571331+0100 n2sample[4306:5509427] advertisement.serviceUUIDs ( 18F1 ) 2017-09-18 17:29:52.571509+0100 n2sample[4306:5509427] found service 18F1 2017-09-18 17:29:52.786965+0100 n2sample[4306:5509420] Discovered NWP-F110 at -59 2017-09-18 17:29:52.787128+0100 n2sample[4306:5509420] advertisement.localname (null) 2017-09-18 17:29:52.787331+0100 n2sample[4306:5509420] advertisement.manufactureData 9c7bd202ad37 2017-09-18 17:29:52.787565+0100 n2sample[4306:5509420] advertisement.serviceUUIDs ( 18F1 ) 2017-09-18 17:29:52.787743+0100 n2sample[4306:5509420] found service 18F1 2017-09-18 17:29:53.003866+0100 n2sample[4306:5509427] Discovered NWP-F110 at -49 2017-09-18 17:29:53.004031+0100 n2sample[4306:5509427] advertisement.localname (null) 2017-09-18 17:29:53.004279+0100 n2sample[4306:5509427] advertisement.manufactureData 9c7bd202ad37 2017-09-18 17:29:53.004519+0100 n2sample[4306:5509427] advertisement.serviceUUIDs ( 18F1 ) 2017-09-18 17:29:53.004696+0100 n2sample[4306:5509427] found service 18F1 2017-09-18 17:29:53.223869+0100 n2sample[4306:5509420] Discovered NWP-F110 at -50 2017-09-18 17:29:53.224030+0100 n2sample[4306:5509420] advertisement.localname (null) 2017-09-18 17:29:53.224234+0100 n2sample[4306:5509420] advertisement.manufactureData 9c7bd202ad37 2017-09-18 17:29:53.224470+0100 n2sample[4306:5509420] advertisement.serviceUUIDs ( 18F1 ) 2017-09-18 17:29:53.224649+0100 n2sample[4306:5509420] found service 18F1 2017-09-18 17:29:53.443218+0100 n2sample[4306:5509427] Discovered NWP-F110 at -55 2017-09-18 17:29:53.443379+0100 n2sample[4306:5509427] advertisement.localname (null) 2017-09-18 17:29:53.443583+0100 n2sample[4306:5509427] advertisement.manufactureData 9c7bd202ad37 2017-09-18 17:29:53.443816+0100 n2sample[4306:5509427] advertisement.serviceUUIDs ( 18F1 ) 2017-09-18 17:29:53.443992+0100 n2sample[4306:5509427] found service 18F1 2017-09-18 17:29:54.088696+0100 n2sample[4306:5509420] Discovered NWP-F110 at -50 2017-09-18 17:29:54.088879+0100 n2sample[4306:5509420] advertisement.localname (null) 2017-09-18 17:29:54.089089+0100 n2sample[4306:5509420] advertisement.manufactureData 9c7bd202ad37 2017-09-18 17:29:54.089327+0100 n2sample[4306:5509420] advertisement.serviceUUIDs ( 18F1 ) 2017-09-18 17:29:54.089523+0100 n2sample[4306:5509420] found service 18F1 2017-09-18 17:29:54.304864+0100 n2sample[4306:5509427] Discovered NWP-F110 at -50 2017-09-18 17:29:54.305020+0100 n2sample[4306:5509427] advertisement.localname (null) 2017-09-18 17:29:54.305224+0100 n2sample[4306:5509427] advertisement.manufactureData 9c7bd202ad37 2017-09-18 17:29:54.305475+0100 n2sample[4306:5509427] advertisement.serviceUUIDs ( 18F1 ) 2017-09-18 17:29:54.305651+0100 n2sample[4306:5509427] found service 18F1 2017-09-18 17:29:54.518771+0100 n2sample[4306:5509420] Discovered NWP-F110 at -59 2017-09-18 17:29:54.518931+0100 n2sample[4306:5509420] advertisement.localname (null) 2017-09-18 17:29:54.519138+0100 n2sample[4306:5509420] advertisement.manufactureData 9c7bd202ad37 2017-09-18 17:29:54.519537+0100 n2sample[4306:5509420] advertisement.serviceUUIDs ( 18F1 ) 2017-09-18 17:29:54.519720+0100 n2sample[4306:5509420] found service 18F1 2017-09-18 17:29:54.550963+0100 n2sample[4306:5509319] [selectRSSI] slectRSSI started.... 2017-09-18 17:29:54.551487+0100 n2sample[4306:5509319] [selectRSSI] already registred now trying to connect to pen.... 2017-09-18 17:29:54.551766+0100 n2sample[4306:5509319] [selectRSSI] connecting pen by using MAC.... 2017-09-18 17:29:54.552447+0100 n2sample[4306:5509319] Connecting to peripheral <CBPeripheral: 0x1700f6f80, identifier = 27BD5629-AB38-4B66-878F-F2485C05B4BB, name = NWP-F110, state = disconnected> 2017-09-18 17:29:54.847644+0100 n2sample[4306:5509427] Peripheral Connected 2017-09-18 17:29:54.880842+0100 n2sample[4306:5509378] Service UUID : 18F1 2017-09-18 17:29:54.882235+0100 n2sample[4306:5509378] Service UUID : 18F5 2017-09-18 17:29:54.884018+0100 n2sample[4306:5509378] Service UUID : 18F2 2017-09-18 17:29:54.884942+0100 n2sample[4306:5509378] Service UUID : 18F3 2017-09-18 17:29:54.886381+0100 n2sample[4306:5509378] Service UUID : 18F4 2017-09-18 17:29:54.887395+0100 n2sample[4306:5509378] Service UUID : 180A 2017-09-18 17:29:54.888303+0100 n2sample[4306:5509378] Service UUID : 18F6 2017-09-18 17:29:54.894514+0100 n2sample[4306:5509378] strokeDataUuid 2017-09-18 17:29:54.895342+0100 n2sample[4306:5509378] idDataUuid 2017-09-18 17:29:54.895741+0100 n2sample[4306:5509378] updownDataUuid 2017-09-18 17:29:54.897759+0100 n2sample[4306:5509378] penStateDataUuid 2017-09-18 17:29:54.898094+0100 n2sample[4306:5509378] setPenStateUuid 2017-09-18 17:29:54.898156+0100 n2sample[4306:5509378] setNoteIdListUuid 2017-09-18 17:29:54.898578+0100 n2sample[4306:5509378] readyExchangeDataUuid 2017-09-18 17:29:54.898635+0100 n2sample[4306:5509378] readyExchangeDataRequestUuid 2017-09-18 17:29:54.901924+0100 n2sample[4306:5509427] requestOfflineFileListUuid 2017-09-18 17:29:54.902231+0100 n2sample[4306:5509427] offlineFileListUuid 2017-09-18 17:29:54.902596+0100 n2sample[4306:5509427] requestDelOfflineFileUuid 2017-09-18 17:29:54.904607+0100 n2sample[4306:5509427] requestOfflineFileUuid 2017-09-18 17:29:54.904677+0100 n2sample[4306:5509427] offlineFileListInfoUuid 2017-09-18 17:29:54.905019+0100 n2sample[4306:5509427] offlineFileInfoUuid 2017-09-18 17:29:54.905382+0100 n2sample[4306:5509427] offlineFileDataUuid 2017-09-18 17:29:54.905705+0100 n2sample[4306:5509427] offline2FileAckUuid 2017-09-18 17:29:54.905765+0100 n2sample[4306:5509427] offlineFileStatusUuid 2017-09-18 17:29:54.907196+0100 n2sample[4306:5509427] updateFileInfoUuid 2017-09-18 17:29:54.907260+0100 n2sample[4306:5509427] requestUpdateFileInfoUuid 2017-09-18 17:29:54.907630+0100 n2sample[4306:5509427] updateFileDataUuid 2017-09-18 17:29:54.907701+0100 n2sample[4306:5509427] updateFileStatusUuid 2017-09-18 17:29:54.908931+0100 n2sample[4306:5509427] fwVersionUuid 2017-09-18 17:29:54.910504+0100 n2sample[4306:5509427] penPasswordRequestUuid 2017-09-18 17:29:54.911057+0100 n2sample[4306:5509427] penPasswordResponseUuid 2017-09-18 17:29:54.911122+0100 n2sample[4306:5509427] penPasswordChangeRequestUuid 2017-09-18 17:29:54.911176+0100 n2sample[4306:5509427] penPasswordChangeResponseUuid 2017-09-18 17:29:54.933416+0100 n2sample[4306:5509420] Notification began on <CBCharacteristic: 0x1700b89c0, UUID = 2AA0, properties = 0x10, value = <050f2c00 2500513c 0f082c00 25005461 19092c00 26005b29 19082c00 2600625b 18112d00 28001605 0f>, notifying = YES> 2017-09-18 17:29:54.993149+0100 n2sample[4306:5509427] Notification began on <CBCharacteristic: 0x1700b8ae0, UUID = 2AA1, properties = 0x10, value = <1c000003 19000000 00000000>, notifying = YES> 2017-09-18 17:29:55.053881+0100 n2sample[4306:5509420] Notification began on <CBCharacteristic: 0x1700b8ba0, UUID = 2AA2, properties = 0x10, value = <4d494585 5e010000 01000000 00>, notifying = YES> 2017-09-18 17:29:55.112706+0100 n2sample[4306:5509427] Notification began on <CBCharacteristic: 0x1700b8c60, UUID = 2AB0, properties = 0x10, value = <010100dd 6d006f97 45855e01 0000ff3c 00000000 00010102 01140000 00000000 00000000 00000000>, notifying = YES> 2017-09-18 17:29:55.173027+0100 n2sample[4306:5509420] Notification began on <CBCharacteristic: 0x1700b8f60, UUID = 2AB5, properties = 0x10, value = <01>, notifying = YES> 2017-09-18 17:29:55.233607+0100 n2sample[4306:5509427] setNoteIdListCharacteristic successful 2017-09-18 17:29:55.293077+0100 n2sample[4306:5509420] Notification began on <CBCharacteristic: 0x1740b3020, UUID = 2AC2, properties = 0x10, value = <011c0000 03021800 00001900 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 0000>, notifying = YES> 2017-09-18 17:29:55.352992+0100 n2sample[4306:5509427] Notification began on <CBCharacteristic: 0x1700b9260, UUID = 2AC8, properties = 0x10, value = (null), notifying = YES> 2017-09-18 17:29:55.443103+0100 n2sample[4306:5509420] Notification began on <CBCharacteristic: 0x1700b9320, UUID = 2AC9, properties = 0x10, value = (null), notifying = YES> 2017-09-18 17:29:55.503026+0100 n2sample[4306:5509427] Notification began on <CBCharacteristic: 0x1702a31e0, UUID = 2ACA, properties = 0x10, value = (null), notifying = YES> 2017-09-18 17:29:55.563586+0100 n2sample[4306:5509420] Notification began on <CBCharacteristic: 0x1740b3e60, UUID = 2ACC, properties = 0x10, value = (null), notifying = YES> 2017-09-18 17:29:55.623371+0100 n2sample[4306:5509427] Notification began on <CBCharacteristic: 0x1740b7940, UUID = 2AD2, properties = 0x10, value = (null), notifying = YES> 2017-09-18 17:29:55.682753+0100 n2sample[4306:5509420] Notification began on <CBCharacteristic: 0x1740b7700, UUID = 2AD4, properties = 0x10, value = (null), notifying = YES> 2017-09-18 17:29:55.742963+0100 n2sample[4306:5509427] Received: FW version 2017-09-18 17:29:55.803719+0100 n2sample[4306:5509420] Notification began on <CBCharacteristic: 0x1700b9020, UUID = 2AB7, properties = 0x10, value = <000b>, notifying = YES> 2017-09-18 17:29:55.863009+0100 n2sample[4306:5509427] Notification began on <CBCharacteristic: 0x1700b55a0, UUID = 2ABA, properties = 0x10, value = (null), notifying = YES> 2017-09-18 17:29:56.163653+0100 n2sample[4306:5509420] Received: readyExchangeDataRequestUuid 2017-09-18 17:29:56.163885+0100 n2sample[4306:5509420] isReadyExchangeSent set into YES because it is sent to Pen 2017-09-18 17:29:56.223009+0100 n2sample[4306:5509420] Unknown characteristic 2AB4 didWriteValueForCharacteristic successful 2017-09-18 17:29:56.552551+0100 n2sample[4306:5509427] Received: penPasswordRequestUuid 2017-09-18 17:29:56.642879+0100 n2sample[4306:5509427] Unknown characteristic 2AB8 didWriteValueForCharacteristic successful 2017-09-18 17:29:56.944043+0100 n2sample[4306:5509420] Received: pen status data 2017-09-18 17:29:56.946776+0100 n2sample[4306:5509420] penStatus 1, timezoneOffset 3600000, timeTick 1505752195990 2017-09-18 17:29:56.946915+0100 n2sample[4306:5509420] pressureMax 255, battery 60, memory 0 2017-09-18 17:29:56.947023+0100 n2sample[4306:5509420] autoPwrOffTime 20, penPressure 0 2017-09-18 17:29:56.947121+0100 n2sample[4306:5509420] Getting penstatus finished 2017-09-18 17:30:03.481254+0100 n2sample[4306:5509480] requestOfflineFileList successful 2017-09-18 17:30:03.795028+0100 n2sample[4306:5509480] Received: offline File list

INKWRXJamie commented 7 years ago

I have also tested this in my code, with breakpoints.

I successfully connect to the pen, then when I receive the confirmation that the connection was successful, I set the delegate.

At this point, you say I should receive a call-back (after a delay) on (void) offlineDataDidReceiveNoteList:(NSDictionary *)noteListDic

This function has a call-back on it, and it is never being called.

I then also tested the same functions in the sample app, and got the same results. The delegate is being set, but (void) offlineDataDidReceiveNoteList:(NSDictionary *)noteListDic is never being called.

louisjrpark commented 7 years ago

Thank you for the log.

The log you provided includes the following lines which mean that the request command for offline file list was sent and the response from your pen was received.

2017-09-18 17:30:03.481254+0100 n2sample[4306:5509480] requestOfflineFileList successful 2017-09-18 17:30:03.795028+0100 n2sample[4306:5509480] Received: offline File list

However, the normal log should be as follows. The below first two lines are same as yours and after that, the rest of lines are different from yours. 2017-09-19 11:07:37.043323+1000 n2sample[13519:5127829] requestOfflineFileList successful 2017-09-19 11:07:37.373877+1000 n2sample[13519:5127829] Received: offline File list 2017-09-19 11:07:37.377223+1000 n2sample[13519:5127829] OfflineFileList owner : 50331675 2017-09-19 11:07:37.377409+1000 n2sample[13519:5127829] OfflineFileList note : 601 2017-09-19 11:07:37.377435+1000 n2sample[13519:5127639] offline Data Note List Count: 1 for sectionId 3, ownerId

I attempted to guess the reason why your log is different from the normal one. The one possibility I can guess is that (void) offlineDataDidReceiveNoteList:(NSDictionary *)noteListDic is not called if the note count attribute of offline data transmitted from your pen is zero.

I have three more requests.

  1. Please connect your pen to your PC. Then, you will see 'Data' folder. Please check if 'Data' folder has 'section_owner id folder' > 'note Id folder' > 'page number folder' > 0.pen file or not.
  2. In case that you have '0.pen' file, can you share 'Data' folder with us if it is OK? In case that you don't, would you please remove 'Data' folder and test it again?
  3. Can you please let me know what note you are writing on? For example, pocket note or note id 601.

Also, for your information, the Bluetooth applied for Android is SPP protocol same as Windows.

Thanks Louis Park

INKWRXJamie commented 7 years ago

Hi,

  1. Yes, the two folders have a 0.pen file in them
  2. I have zipped this folder and it is available: Here
  3. The notes were generated for me using the SDK but the ones included in the Data folder in the link above are: (Section: 3, Owner: 28, Note: 24, Page: 1) and (Section: 3, Owner: 28, Note: 25, Page: 0)
louisjrpark commented 7 years ago

For the new owner id and note id, they should be registered to 'note_support_list.plist'. Please add Section: 3, Owner: 28, Note: 24 and Section: 3, Owner: 28, Note: 25 to 'note_support_list.plist' file.

Thanks Louis Park

INKWRXJamie commented 7 years ago

Ok, I was able to do this by just adding the section and owner ids to the plist file, and leaving the noteIds array empty. This seems to have allowed any note Id.

Will our section or owner ids ever change, or will all of our notes require the same?

Also, can you explain why this is necessary for iOS, yet Android and Windows SDKs appear to allow all ids? I understand they use different bluetooth interfaces but I can't see how that would affect which notes would be visible.

louisjrpark commented 7 years ago

My answers are below.

Will our section or owner ids ever change, or will all of our notes require the same? Also, can you explain why this is necessary for iOS, yet Android and Windows SDKs appear to allow all ids? I understand they use different bluetooth interfaces but I can't see how that would affect which notes would be visible. => It is useful when you need to set only some notebooks which you want to allow to be written on. It will work if you fill in a specific section id and owner id in 'note_support_list.plist'. Usually, one owner id should be allocated according to a client. Please let us know if your owner id will be changed after your app is released. In the offline mode, only section id and owner id should be registered to 'note_support_list.plist' In the online mode (writing with the app running), also some information should be registered to the plist file and a command method should be selected in '- (void) setPenCommNoteIdList', NJViewController.m. There are the following three command methods. 1.[[NJPenCommManager sharedInstance] setNoteIdListFromPList] => In the online mode, the section id, owner id and note id from the plist file will be allowed to be written on. 2.[[NJPenCommManager sharedInstance] setAllNoteIdList] => In the online mode, all note ids will be permitted. 3.[[NJPenCommManager sharedInstance] setNoteIdListSectionOwnerFromPList] => In the online mode, the section id and own id from the plist will be allowed.

Thanks Louis Park