Examples of DeviceManager


Examples of org.jnode.driver.DeviceManager

     * Plays a series of notes through the default speaker.
     * Null argument or zero length array plays the standard beep.
     */
    public static void play(Note[] n) {
        try {
            DeviceManager dm = InitialNaming.lookup(DeviceManager.NAME);
            Device dev = dm.getDevice("speaker0");
            SpeakerAPI s = dev.getAPI(SpeakerAPI.class);
            if (n == null || n.length == 0) {
                s.beep();
            } else {
                s.playNote(n);
View Full Code Here

Examples of org.jnode.driver.DeviceManager

    public CardBusDriver() {
    }

    protected void startDevice() throws DriverException {
        final Device device = getDevice();
        final DeviceManager dm;
        try {
            dm = InitialNaming.lookup(DeviceManager.NAME);
            dm.rename(device, getDevicePrefix(), true);
        } catch (DeviceAlreadyRegisteredException ex) {
            log.error("Cannot rename device", ex);
            throw new DriverException("Cannot rename device", ex);
        } catch (NameNotFoundException ex) {
            throw new DriverException("Cannot find DeviceManager", ex);
View Full Code Here

Examples of org.jnode.driver.DeviceManager

    public static void main(String[] args) {

        String devId = (args.length > 0) ? args[0] : "eth0";

        try {
            final DeviceManager dm = InitialNaming.lookup(DeviceManager.NAME);
            final Device dev = dm.getDevice(devId);
            final NetDeviceAPI api = dev.getAPI(NetDeviceAPI.class);
            final EthernetAddress mac = (EthernetAddress) api.getAddress();

            SocketBuffer skbuf = new SocketBuffer();
            skbuf.insert(28);
View Full Code Here

Examples of org.jnode.driver.DeviceManager

                new FileIDEDevice(name, true, true, new File(directory, name), DEFAULT_FILE_SIZE);
        return dev;
    }

    public static void restart(Device device) {
        DeviceManager devMan;
        try {
            devMan = org.jnode.driver.DeviceUtils.getDeviceManager();

            devMan.stop(device);
            devMan.start(device);
        } catch (NameNotFoundException e) {
            log.error(e);
        } catch (DeviceNotFoundException e) {
            log.error(e);
        } catch (DriverException e) {
View Full Code Here

Examples of org.jnode.driver.DeviceManager

    }

    public static boolean addDevice(AbstractIDEDevice device) {
        boolean success = false;
        try {
            DeviceManager devMan = org.jnode.driver.DeviceUtils.getDeviceManager();
            devMan.register(device);
            success = true;

            // PartitionHelper helper = new PartitionHelper(device);
            // helper.initMbr();
            // helper.write();
View Full Code Here

Examples of org.jnode.driver.DeviceManager

        return success;
    }

    public static String findUnusedName(String baseName) throws NameNotFoundException {
        DeviceManager devMan = org.jnode.driver.DeviceUtils.getDeviceManager();
        String name = null;
        int i = 0;
        do {
            String newName = baseName + "-" + i;
            try {
                devMan.getDevice(newName);
                i++;
            } catch (DeviceNotFoundException e) {
                name = newName;
            }
        } while (name == null);
View Full Code Here

Examples of org.jnode.driver.DeviceManager

    public static void addRoute(IPv4Address target, IPv4Address gateway, Device device)
        throws NetworkException {

        if (device == null) {
            // Find the device ourselves
            final DeviceManager dm;
            try {
                dm = InitialNaming.lookup(DeviceManager.NAME);
            } catch (NameNotFoundException ex) {
                throw new NetworkException("Cannot find DeviceManager", ex);
            }
View Full Code Here

Examples of org.jnode.driver.DeviceManager

                    dev = dev_a[0];
                }
            }

            if (dev == null) {
                final DeviceManager dm = InitialNaming.lookup(DeviceManager.NAME);
                dev = dm.getDevice(devId);
            }

            final FrameBufferAPI api = dev.getAPI(FrameBufferAPI.class);
            final FrameBufferConfiguration conf = api.getConfigurations()[0];
View Full Code Here

Examples of org.jnode.driver.DeviceManager

   
    public void execute() throws NameNotFoundException, ApiNotFoundException, NetworkException {
        PrintWriter out = getOutput().getPrintWriter();
        if (!argDevice.isSet()) {
            // Print MAC address, MTU and IP address(es) for all network devices.
            final DeviceManager dm = InitialNaming.lookup(DeviceManager.NAME);
            for (Device dev : dm.getDevicesByAPI(NetDeviceAPI.class)) {
                final NetDeviceAPI api = dev.getAPI(NetDeviceAPI.class);
                out.format(fmt_devices, dev.getId(), api.getAddress(), api.getMTU(),
                           api.getProtocolAddressInfo(EthernetConstants.ETH_P_IP));
            }
        } else {
View Full Code Here

Examples of org.jnode.driver.DeviceManager

     * @see org.jnode.driver.Driver#startDevice()
     */
    protected void startDevice() throws DriverException {
        final Device device = getDevice();
        try {
            final DeviceManager dm = InitialNaming.lookup(DeviceManager.NAME);
            dm.rename(device, getDevicePrefix() + "-" + device.getId(), false);
        } catch (DeviceAlreadyRegisteredException ex) {
            log.error("Cannot rename device", ex);
        } catch (NameNotFoundException ex) {
            throw new DriverException("Cannot find DeviceManager", ex);
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.