def test_dict(self): o_dict = objc_dict({ 'first_key': objc_i(2345), 'second_key': objc_d(4.54) }) self.assertEqual( o_dict.objectForKey_(objc_str('first_key')).intValue(), 2345)
def start_scanning(self, allow_duplicates=True): if self.scanning: return print('allow duplicates:', allow_duplicates) options = objc_dict( {'kCBScanOptionAllowDuplicates': objc_i(int(allow_duplicates))}) self.central.scanForPeripheralsWithServices_options_(None, options) # self.cbcentral.startScanning_(allow_duplicates) self.scanning = True
def start_advertising(self, name): services = [ iprop(s.service.UUID) for s in self.pending_services.values() ] servarray = objc_arr(*services) if services else None adv_dict = {CBAdvertisementDataKeys.LocalName: name} if servarray: adv_dict[CBAdvertisementDataKeys.ServiceUUIDs] = servarray data = objc_dict(adv_dict) self.peripheral.startAdvertising_(data) for service in self.pending_services.values(): self.peripheral.addService_(service.service)
def test_dict(self): o_dict = objc_dict({'first_key': objc_i(2345), 'second_key': objc_d(4.54)}) self.assertEqual(o_dict.objectForKey_(objc_str('first_key')).intValue(), 2345)
def finish_ios_init(self, *args): self.onesignal_object = autoclass("OneSignal") mock_launch_options = objc_dict({}) self.onesignal_object.initWithLaunchOptions_appId_( mock_launch_options, "Your OneSignal App_ID")