/** *Licensed to the Apache Software Foundation (ASF) under one *or more contributor license agreements. See the NOTICE file *distributed with this work for additional information *regarding copyright ownership. The ASF licenses this file *to you under the Apache License, Version 2.0 (the *"License"); you may not use this file except in compliance *with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * *Unless required by applicable law or agreed to in writing, *software distributed under the License is distributed on an *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the *specific language governing permissions and limitations *under the License. */ /** * track bundles * The add bundle callback will also be called for already installed bundles. * * @param ctx The bundle context. * @param callbackHandle The data pointer, which will be used in the callbacks * @param add Callback, which will be called for started bundles. * @param remove Callback, which will be called when bundles are stopped. * @return the bundle tracker id or < 0 if unsuccessful. */ long bundleContext_trackBundles( bundle_context_t* ctx, const char* serviceName, const char* serviceVersionRange, const char* filter, void* callbackHandle, void (*onStarted)(void* handle, const bundle_t *bundle), void (*onStopped)(void *handle, const bundle_t *bundle) ); typedef struct celix_bundle_tracker_options { void* callbackHandle; void (*onInstalled)(void *handle, const bundle_t *bundle); //highest ranking void (*onStopped)(void *handle, const bundle_t *bundle); void (*onBundleEvent)(void *handle, const bundle_event_t *event); } celix_bundle_tracker_options_t; /** * Tracks bundles using the provided bundle tracker options. * The tracker options are only using during this call and can safely be freed/reused after this call returns. * * @param ctx The bundle context. * @param opts The pointer to the bundle tracker options. * @return the bundle tracker id or < 0 if unsuccessful. */ long bundleContext_trackBundles( bundle_context_t* ctx, const celix_bundle_tracker_options_t *opts ); /** * Stop the tracker with the provided track id. * Only works for the trackers owned by the bundle of the bundle context. * * @return CELIX_SUCCESS if the tracker is stopped correctly. */ int bundleContext_stopTracking(bundle_context_t *ctx, long trackerId);