There are 3 app examples in this SDK:
The SanDisk® iXpand is a family of storage accessories for devices running Apple’s iOS. iXpand devices enable transfer and storage of photos, music, videos and files between iPhones, iPads, PCs and Mac computers. iXpand accessories are accessible over Lightning® and USB connectors.
The SanDisk iXpand SDK enables third party application developers to access and manage iXpand devices from their own iOS applications through the Lightning interface.
The SDK includes the binaries, libraries, simulator, demo and information for creating your app, using native Swift iOS code and examples. These are intended to show basic developer use of the iXpand device through the API in a iOS development environment.
The development process is to integrate the iXpand SDK into your app, perform your validation process, and submit your app to Western Digital to obtain the Product Plan ID (PPID) code that will be asked for when you submit your app to Apple.
The following figure shows the high level architecture for applications developed on the iXpand SDK:
Figure 1 - Conceptual Block Diagram
You will need a free WD Developer Portal account to download the binaries and libraries for the iXpand SDK - click here to sign up. After you have a WD Developer Portal account, click here to download the iXpand SDK.
Two external licensed code components are used in the SDK.
Present in iXpandSDKDemo Application is subject to the following MIT License:
Copyright© 2011 Matej Bukovinski
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Present in the SDK is the FatFs - Generic FAT Filesystem Module Rx.xx
Copyright (C) 2013, ChaN, all right reserved. FatFs module is an open source software. Redistribution and use of FatFs in source and binary forms, with or without modification, are permitted provided that the following condition is met:
This software is provided by the copyright holder and contributors "AS IS" and any warranties related to this software are DISCLAIMED. The copyright owner or contributors be NOT LIABLE for any damages caused by use of this software.
The FATFS open source taken from following link http://elm-chan.org/fsw/ff/00index_e.html. For further information on use and licensing, refer to the following link http://elm-chan.org/fsw/ff/doc/appnote.html#license
File system API's provide familiar filesystem API to the iXpand device for managing storage related software operations. System API's provide access to administration functionality not directly related to storage.
The iXpand SDK is available as an iOS framework file. A developer needs to include the framework and header files within the the target application’s source tree for successful integration.
To access the iXpand SDK, developers must first initialize “iXpandSystemController" and "FileSystemController" respectively. All system API's are accessible as part of "iXpandSystemController" and file system API's are accessible over “FileSystemController”.
To initialize the iXpand, "iXpandSystemController" instance is created first followed by calling "initDrive" and "OpenSession". When "OpenSession" is completed, iXpand is ready to communicate. Instances of "FileSystemController" can be created to deal with File System API's. When all operations with iXpand device are completed, the application can close communication with the device using "closeSession" API.
Figure 3 - Adding Library
In the application code, include the following header to allow access to the API's:
#import <iXpandSDKlib/iXpandSDKlib.h>
The code snippet below shows how to initialize the iXpand drive:
if (![[iXpandSystemController sharedController] initDrive:accessory]) { dispatch_sync(dispatch_get_main_queue(), ^{ [self.consoleString appendString:@"Drive Initialisation failed"]; [self updateConsole]; return; }); } else { If( [[iXpandSystemController sharedController] openSession]) { // iXpand is successfully opened } }
The following code snippet shows an example of opening a file and writing to iXpand:
If([[iXpandFileSystemController sharedController] changeDirectoryAbsolutePath:@"\\"]){ Int handle = [[iXpandFileSystemController sharedController] openFileAbsolutePath:path openMode:mode]; if (handle != -1) { uint32_t dataLength = 0; uint32_t uintDataSize = 0; uint32_t uintDataTranLen = 0; uintDataSize = (uint32_t)[self returnFileSize:test0]; @synchronized(self){ while((dataLength != -1) && (uintDataSize != 0)) { @autoreleasepool { uintDataTranLen = ((uintDataSize > MAX_DATABUFFER) ? MAX_DATABUFFER : uintDataSize); [[fileHandle readDataOfLength:uintDataTranLen] getBytes:byDataBuf]; NSData *aData = [NSData dataWithBytes:byDataBuf length:sizeof(byDataBuf)]; dataLength = [[iXpandFileSystemController sharedController] writeFile:handle writeBuf:aData writeSize:uintDataTranLen]; uintDataSize -= dataLength; } } [[iXpandFileSystemController sharedController] closeFile:handle]; [fileHandle closeFile]; } } }
The following code snippet shows closing a session with iXpand after a file operation is done:
[[iXpandSystemController sharedController] closeSession];
iXpand does not generate thumbnails and metadata information of media files. The developer will need to create or use a third party application or library to render thumbnail and metadata if required.
NOTE: The iXpand accessory does not protect application specific files.
The application developer has the flexibility to organize iXpand files in any manner as intended.
We recommend you call iXpand File System API's from a non-UI thread to offer a better user experience.
- API's to notify drive contents have changed is not optimized for multiple applications
- Seek file API with out of range seek doesn’t return error value
- getFileOpenMode API returns incorrect file mode if opened with OF_CREATE and OF_EXIST
- API ‘itemExists’ returns incorrect value. Use search API alternatively.
You will need a free WD Developer Portal account to download the binaries and libraries for the iXpand SDK - click here to sign up. After you have a WD Developer Portal account, click here to download the iXpand SDK. You will download a file named similar to 'ixpandsdk30.zip', extract it to a project directory.
The SDK includes a simulator and a debug and demo release app. You should run the simulator for testing your app on your PC, and use the Debug and Release versions for deployment to the actual iOS device.
Note: The app contains the FATFS open source taken from following link http://elm-chan.org/fsw/ff/00index_e.html. For further information on use and licensing, refer to the following link http://elm-chan.org/fsw/ff/doc/appnote.html#license
Download the sample application and load in Xcode as depicted below
Figure 1 - Load Project in Xcode
Figure 2 - Edit Scheme
Change Build Configuration to TEST
Figure 3 - Test Build Configuration
Change the device to an iOS Simulator
Figure 4 - Change to iOS Simulator
Run the sample app and try it out, your iPhone simulator should look like the below with the iXpand simulator running in a separate window.
Figure 5 - Simulator Running
First you can tap on Open Session, and then you can tap on the other buttons to see the communication from the iPhone simulator to the iXpand simulator appearing at the bottom of your screen.
Here is a sample of the views that the simulator shows:
Figure 1 - Open Session
Figure 3 - Get Software Version
Figure 4 - Read / Create File
Download the example application and load into Xcode.
Figure 1 - Start Here
Figure 2 - Edit Scheme
Change Build Configuration to debug.
Figure 3 - Debug Build Configuration
Change Device to a real device.
Figure 4 - Change Device
Select the 'iXpandSDK_Demo' folder in the folder navigation.
Figure 5 - Navigate to iXpandSDK_Demo
Enable 'Automatically manage signing' and allow it to reset the build settings.
Figure 6 - Manage Signing
Figure 7 - Provision Profile
Figure 8 - Build Settings
In 'Signing' change 'Code Signing Identity' to 'iOS Developer'.
Figure 9 - Sign as iOS Developer
Go to 'General' and in 'identity' change 'Bundle Identifier' to a new one.
Figure 10 - Change Bundle Identifier
Click 'Try Again' in signing and start building the Debug Demo.
Download the sample application and open the project in Xcode.
Figure 1 - Open Project in Xcode
Go to Edit Scheme.
Figure 2 - Edit Scheme
Change Build Configuration to debug.
Figure 3 - Set Build Configuration
Change device to a real device.
Figure 4 - Change Device
Select iXpandSDK_Demo in the folder navigation.
Figure 5 - Select App Framework
Enable 'Automatically manage signing'.
Figure 6 - Set Signing
Select a 'Provisioning Profile'.
Figure 7 - Provisioning Profile
Go to Build Settings.
Figure 8 - Build Settings
In 'Signing' change 'Code Signing Identity' to 'iOS Developer'.
Figure 9 - Code Signing
Go to 'General' and in 'identity' change 'Bundle Identifier' to a new one.
Figure 10 - Change Bundle Identifier
Click 'Try Again' in signing and start building the Demo.
We may be able to assist in obtaining hardware to use during your development activities. Make your request hardware here.
Submit your app for us to qualify & publish in the App Catalog.
When the validation process is complete, Western Digital will associate your app with the iXpand drive with Apple and send you the Product Plan ID (PPID) code. When you submit your app to Apple, edit your metadata and include the iXpand PPID code we sent you in the Comments of your submitted request.
After your app is published, if you change code related to the iXpand API, we ask that you resubmit to us for re-validation before submitting to Apple.
Click the buttons below to visit the iXpand Developer Home & Workflow pages