In iOS 7, some Core Bluetooth things are now deprecated like CBUUIDGenericAccessProfileString and CBUUIDDeviceNameString. The apple docs state
"(Deprecated. There are no replacements for these constants.)"
I am wondering what we are supposed to do to replace these GAP things, as the apple docs and examples are of no help. The entire internet also seems to be silent about this. My code is pretty much just like the Heart Rate Monitor example which still has the deprecated code
/* GAP (Generic Access Profile) for Device Name */
if ( [aService.UUID isEqual:[CBUUID UUIDWithString:CBUUIDGenericAccessProfileString]] )
{
[aPeripheral discoverCharacteristics:nil forService:aService];
}
How about you just use the Generic Access service UUID directly?
if ( [aService.UUID isEqual:[CBUUID UUIDWithString:#"1800"]] )//0x1800 is the Generic Access Service Identifier
{
[aPeripheral discoverCharacteristics:nil forService:aService];
}
Check here for details on the Generic Access Service.
Related
I'm trying to get an access to datapoints in new cumulocity version. In older version such things as c8yDataPointSvc and schemaPropertiesSvc. I can't seem to find them anywhere. Basically I need components to work with datapoint as in the picture below. I would appreciate any info on how to either reuse those old components or a new way of using them as there is such.
Thanks a lot!
I see here three options. First what I am going to say is that we in Cumulocity use a hybrid approach for our core applications, since we have a lot of functionalities still written in AngularJS. Same as the one that you need. There is no equivalent in Angular yet. That is why you have several options to use those old services.
One is in a hybrid application to you a bridge service where you can define the upgraded c8yDataPointSvc like that -
constructor(
private ng1Injector: any,
...
) {}
get ng1DataPointSvc() {
return this.ng1Injector.get('c8yDataPointSvc');
}
This ng1Injector is a constructor input variable that we define when we provide that bridge service in the upgrade module like this:
{
provide: BridgeService,
useFactory: BridgeFactory,
deps: ['$injector', ...]
}
This way you will still have an Angular application, you will still use the provided from us factory c8yDataPointSvc in your Angular application just by upgrading it using anguar hybrid app upgrade functionality.
Other option is to just keep your widget an AngularJS one and when you have a hybrid app, you can just import the AngularJS widget and the angular compiler will take care of the upgrade/downgrade. This is what we are doing with a lot of our customers, who have angulatJS widgets and are using Cumulocity versions above 10.5.0.*
And the last option will be to not use the AngularJS services you need and using our SDK just implement the functionalities used from c8yDataPointSvc. But that will be the biggest effort probably.
We are developing an SAP Fiori App to be used on the Launchpad and as an offline-enabled hybrid app as well using the SAP SDK and its Kapsel Plug Ins. One issue we are facing at the moment is the ODATA message handling.
On the Gateway, we are using the Message Manager to add additional information to the response
" ABAP snippet, random Gateway entity method
[...]
DATA(lo_message_container) = me->mo_context->get_message_container( ).
lo_message_container->add_message(
iv_msg_type = /iwbep/cl_cos_logger=>warning
iv_msg_number = '123'
iv_msg_id = 'ZFOO'
).
" optional, only used for 'true' errors
RAISE EXCEPTION TYPE /iwbep/cx_mgw_busi_exception
EXPORTING
message_container = lo_message_container.
In the Fiori app, we can directly access those data from the message manager. The data can be applied to a MessageView control.
// Fiori part (Desktop, online)
var aMessageData = sap.ui.getCore().getMessageManager().getMessageModel().getData();
However, our offline app always has an empty message model. After a sync or flush, the message model is always empty - even after triggering message generating methods in the backend.
The only way to get some kind of messages is to raise a /iwbep/cx_mgw_busi_exception and pass the message container. The messages can be found, in an unparsed state, in the /ErrorArchive entity and be read for further use.
// Hybrid App part, offline, after sync and flush
this.getModel().read("/ErrorArchive", { success: .... })
This approach limits us to negative, "exception worthy", messages only. We also have to code some parts of our app twice (Desktop vs. Offlne App).
So: Is there a "proper" to access those messages after an offline sync and flush?
For analyzing the issue, you might use the tool ILOData as seen in this blog:
Step by Step with the SAP Cloud Platform SDK for Android — Part 6c — Using ILOData
Note, ILOData is part of the Kapsel SDK, so while the blog above was part of a series on the SAP Cloud Platform SDK for Android, it also applies to Kapsel apps.
ILOData is a command line based tool that lets you execute OData requests and queries against an offline store.
It functions as an offline OData client, without the need for an application.
Therefore, it’s a good tool to use to test data from the backend system, as well as verify app behavior.
If a client has a problem with some entries on their device, the offline store from the device can be retrieved using the sendStore method and then ILOData can be used to query the database.
This blog about Kapsel Offline OData plugin might also be helpful.
I found Worklight JSONStore has no size limit by Worklight runtime.
Does WL JSONStore API return error/error code if you add to collection and hit the size limit of your mobile device?
Yes, you should get an error, but it will be a generic one like PERSISTENT_STORE_FAILURE (-1). I recommend testing this as part of your regular unit, funcional, etc. tests and QA process for your application. Report back if you see something unexpected.
Recently I answered a similar question "Can the JSON offline device store be size restricted?". I'll add my answer here because I believe it could be helpful.
While this functionality is not baked into the core API, it should be fairly straightforward to implement.
JSONStore has an enhance method you can use to add functions to the JSONStoreInstance prototype. There's an example inside that should help.
Cordova has a File API
Note: "size: The size of the file in bytes. (long)"
JSONStore stores its data here:
iOS: [app]/Documents/wljsonstore/jsonstore.sqlite
Android: /data/data/com.[app-name]/databases/wljsonstor/jsonstore.sqlite
I talked a bit about that file in these StackOverflow answers:
What are the recommended ways to debug Worklight applications?
JSONStore difference between 'number' and 'integer' in searchFields
Check the file size of jsonstore.sqlite using Cordova's File API before you add more data to your JSONStore collection.
Basically you would do something like this:
if(checkFileSize(collection.name+'.sqlite') < LIMIT){
collection.add(...);
}
Using enhance you can wrap that logic into its own method (e.g. collection.addWithSizeCheck(....)) that checks the file size and calls collection.add(...).
Note that the default username is jsonstore, hence jsonstore.sqlite. If you pass a username to init it will create a new .sqlite file with that username.
I am performing a review on an iOS application for which I do not have the source code. In order to gain more control over the environment, I am running the application on a jailbroken iPad.
I'd like to be able to monitor the API calls that the application is making...ideally I'd like to find something like Rohitab's MS Windows based API Monitor, but instead for iOS.
I have done some research and found a project by KennyTM called "Subjective-C" that seems that it may do what I need. I actually have been using a cycript script, along with the libsubjc.dylib available on the Google code site.
However, I have been unable to figure out how to correctly get it to start logging calls for an app. Here's the link to the cycript script, written by the author of Subjective-C (libsubjc). I pasted the script below as well.
/*
libsubjc.cy ... Use libsubjc in cycript.
Copyright (C) 2009 KennyTM~ <kennytm#gmail.com>
[...GPL3...]
*/
dlopen("libsubjc.dylib", 10);
if (!dlfun) {
function dlfun(fn, encoding, altname) { var f = new Functor(dlsym(RTLD_DEFAULT, fn), encoding); if (f) this[altname || fn] = f; return f; }
}
dlfun("SubjC_start", "v");
dlfun("SubjC_end", "v");
dlfun("SubjC_set_file", "v^{sFILE=}");
dlfun("SubjC_set_maximum_depth", "vI");
dlfun("SubjC_set_print_arguments", "vB");
dlfun("SubjC_set_print_return_value", "vB");
dlfun("SubjC_set_print_timestamp", "vB");
SubjC_Deny = 0, SubjC_Allow = 1;
dlfun("SubjC_clear_filters", "v");
dlfun("SubjC_filter_method", "vi#:");
dlfun("SubjC_filter_class", "vi#");
dlfun("SubjC_filter_selector", "vi:");
dlfun("SubjC_default_filter_type", "vi");
dlfun("SubjC_filter_class_prefixes", "viI^*");
dlfun("SubjC_filter_class_prefix", "vi*");
dlfun("fopen", "^{sFILE=}**");
dlfun("fclose", "i^{sFILE=}");
I have been able to load the libsubjc cycript script, and call the SubjC_start function. However, how do I specify an input filehandle for the line starting with dlfun("SubjC_set_file", "v^{sFILE=}");
Has anyone successfully used the "libsubjc.cy" cycript script with the Subjective-C library (libsubjc.dylib) to monitor an app's API calls?
UPDATE
This is at least generating the output file, but I don't see any information populated within the output file (/tmp/test.txt).
cycript -p SpringBoard libsubjc.cy; cycript -p SpringBoard
f = fopen("/tmp/test.txt", "w");
SubjC_set_file(f);
SubjC_set_maximum_depth(15);
SubjC_set_print_arguments(YES);
SubjC_set_print_return_value(YES);
SubjC_set_print_timestamp(YES);
SubjC_default_filter_type(SubjC_Deny);
SubjC_start();
//do stuff
SubjC_end();
Or, if anyone knows of another way to monitor API calls (w/o source code) on a jailbroken device, please let me know!
I'm not aware of a direct equivalent to API Monitor. However, Frida is a popular tool for mobile app instrumentation, with a tutorial on iOS usage. Once installed, you can trace API calls with a command like frida-trace -U -i "CCCryptorCreate*" Twitter to trace calls from the Twitter app to functions starting with CCCryptorCreate.
Set up a proxy server on your computer to redirect and track all the API calls. This is a common way to peak into iOS web traffic and you don't need a jailbroken device.
I need just a simple Objective-C app or API that can send and receive IMs to a single user.
BARE BONES.
I've looked at Skype, but the Objective-C part looks really outdated. AIM is preferred, but anything that can send and receive IMs is perfect.
Is there an API for this? For AIM or Skype?
Examples would be appreciated, and remember, I'm totally new to Obj-C.
I don't know about simple or bare bones, but Adium is a good open-source IM client for OS X written in Cocoa.
UDPATE: You might want to check out this blog post ("Towards an Open Source XMPP Framework for Cocoa"). It looks like the author wanted his own Jabber/XMPP Cocoa framework, too, and has even created a project for it in Google Code.
I am currently working on an Objective-C implementation of the OSCAR (AIM) protocol. It is being updated on GitHub. If I understand what you want to do correctly, the library, although incomplete, will meet your needs. It can send and receive messages, and work with status messages. It can also read the buddy list if you are interested in that. The entire library should be finished by the end of the month, and you can check it out on GitHub:
https://github.com/unixpickle/LibOrange
Signing on is this simple:
login = [[AIMLogin alloc] initWithUsername:username password:password];
[login setDelegate:self];
if (![login beginAuthorization]) {
NSLog(#"Failed to start authenticating.");
abort();
}
Once signed on, sending messages works like this:
AIMMessage * reply = [AIMMessage messageWithBuddy:[message buddy] message:#"Test"];
[theSession.messageHandler sendMessage:reply];
Obviously, you can check out the sample on GitHub, but I thought I would put that sample code to wet your appetite. Enjoy!
I don't know exactly how hard it would be to use, but isn't there an open source library for accessing IMs called libPurple? maybe you should check that out and see what it can do in Xcode.
If it's for a small scale deployment, it would be pretty easy to roll your own using Distributed Objects. I've heard it can be problematic trying to use DO for a high traffic Internet service though.