守望者--AIR技术交流

 找回密码
 立即注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

搜索
热搜: ANE FlasCC 炼金术
查看: 3118|回复: 2
打印 上一主题 下一主题

NetworkInfo native extension sample

[复制链接]
  • TA的每日心情
    擦汗
    2018-4-10 15:18
  • 签到天数: 447 天

    [LV.9]以坛为家II

    1742

    主题

    2094

    帖子

    13万

    积分

    超级版主

    Rank: 18Rank: 18Rank: 18Rank: 18Rank: 18

    威望
    562
    贡献
    29
    金币
    52903
    钢镚
    1422

    开源英雄守望者

    跳转到指定楼层
    楼主
    发表于 2015-1-7 14:28:20 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
    应用下载
    应用名称: NetworkInfo
    支持64位:
    当前版本: 未知
    运行平台: IOS 
    开发语言: ActionScript 3 
    应用类别: ANE-C/C++
    应用简介: Retrieves information about the network interfaces on an iOS device.






    Note: By clicking the download link for any source examples on this page, you acknowledge that you have read and agree to the Adobe AIR SDK License Agreement. These files are considered Sample Code.

    Note: Adobe recommends using the next version of Flash Builder for developing native extensions for Adobe AIR. Sign up now to get access to the prerelease of Flash Builder 4.6.

    The NetworkInfo class is a native extension for Adobe AIR. It allows AIR application developers, from ActionScript, to get information for each network interface.

    ActionScript already provides a NetworkInfo class that works on desktop and AIR for TV devices. This native extension provides a similar class so that AIR applications for iOS can also get information for each network interface.

    The attached ZIP files contain:

    • The ActionScript library in the directory NetworkInfoActionScriptLibrary: This directory contains the Flash Builder project for creating the ActionScript side of the NetworkInfo extension.
    • The iOS native library in the directory NetworkInfoiOSLibrary: This directory contains an Xcode project for creating the iOS native side of the NetworkInfo extension. To build the Xcode project, first copy FlashRuntimeExtension.h from <AIR_SDK>/include/FlashRuntimeExtensions.h to the directory
      NetworkInfoiOSLibrary.
    • A directory called Binaries: This directoyt contains everything the AIR application developer needs to use the native extension: the ANE file, the SWC file, and a text file that contains the extension ID.
    • A directory called NetworkInfoUsageApp: This directory contains a sample AIR application that uses the NetworkInfo native extension.


    The ActionScript library

    The ActionScript library contains the NetworkInfo class. The NetworkInfo class provides the AIR application this public method and property:

    • public static function get networkInfo(): NetworkInfo
    • public function findInterfaces(): Vector.<NetworkInterface>

    The NetworkInfo object is a singleton. The AIR application gets the single NetworkInfo object using the static networkInfoproperty.

    The findInterfaces() method returns a Vector of NetworkInterface objects. The NetworkInterface class is also defined in the ActionScript library. The NetworkInterface class provides these public properties:

    • public function get name():String
    • public function get displayName():String
    • public function get mtu():int
    • public function get hardwareAddress():String
    • public function get active():Boolean
    • public function get addresses():Vector.<InterfaceAddress>

    The addresses() property returns a Vector of InterfaceAddress objects. The InterfaceAddress class is also defined in the ActionScript library. It contains these public properties:

    • public function get address():String
    • public function get broadcast():String
    • public function get prefixLength():int
    • public function get ipVersion():String

    Note: The public functions and properties of the classes in the NetworkInfo extension—NetworkInfo, NetworkInterface, and InterfaceAddress—correspond with the public functions and properties in the existing ActionScript classes by the same name. See NetworkInfo, NetworkInterface, and InterfaceAddress in the ActionScript 3 Reference for the Adobe Flash Platform.



    Application usage

    To use the NetworkInfo extension, an AIR application does the following:

    • Get the NetworkInfo singleton object by accessing the static property NetworkInfo.networkInfo .
    • Call the NetworkInfo singleton object's findInterfaces() method to get a list of network interfaces.

    For example:


    1. <font face="inherit"><font style="font-size: 13.63636302947998px">var ntf:Vector.<NetworkInterface> = NetworkInfo.networkInfo.findInterfaces();</font></font>
    复制代码
    Note: Do not call new NetworkInfo() . Trying to create an instance of the NetworkInfo class in this manner throws an exception.Then you can process each NetworkInterface object in the returned Vector. For example:
    1. for each (var interfaceObj:NetworkInterface in ntf)
    2. {

    3.     // Access interfaceObj.name, interfaceObj.displayName, interfaceObj.active,
    4.     // interfaceObj.hardwareAddress, and interfaceObj.mtu

    5.     for each(var address:InterfaceAddress in interfaceObj.addresses)
    6.     {
    7.         // Access address.address, address.broadcast, address.ipVersion, and address.prefixLength
    8.     }
    9. }
    复制代码
    Note that the prefixLength field of the InterfaceAddress class is not supported. Its value is always -1 .

    The iOS native library
    The iOS native library is implemented in Objective C, using the native extension C API. The native library contains examples of these native extension C APIs:
    • The extension initializer and finalizer, using the signatures of FREInitializer()and FREFinalizer().
    • The context initializer and finalizer, using the signatures of FREContextInitializer() andFREContextFinalizer() .
    • A native function, findInterfaces(), that uses the signature of FREFunction().
    • FRENewObject()
    • FRENewObjectFromBool()
    • FRENewObjectFromInt32()
    • FRENewObjectFromUTF8()
    • FRESetArrayElementAt()
    The native function findInterfaces() calls the iOS API getifaddrs() function to get a linked list of the device's network interfaces. The function processes the elements in the list, returning an array of NetworkInterface objects to the ActionScript side of the extension.


    Where to go from here
    For more information about developing native extensions for Adobe AIR, see:For more information about using a native extension in an AIR application, see:







    More Like This
    相关链接:

    NetworkInfo native extension sample

    http://www.riaxe.com/blog/200-adobe-air-anes/









    本帖子中包含更多资源

    您需要 登录 才可以下载或查看,没有帐号?立即注册

    x
    分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友 微信微信
    收藏收藏 分享分享 支持支持 反对反对 微信
    守望者AIR技术交流社区(www.airmyth.com)
    回复

    使用道具 举报

  • TA的每日心情
    擦汗
    2018-4-10 15:18
  • 签到天数: 447 天

    [LV.9]以坛为家II

    1742

    主题

    2094

    帖子

    13万

    积分

    超级版主

    Rank: 18Rank: 18Rank: 18Rank: 18Rank: 18

    威望
    562
    贡献
    29
    金币
    52903
    钢镚
    1422

    开源英雄守望者

    沙发
     楼主| 发表于 2015-1-22 10:28:31 | 只看该作者
    本帖最后由 破晓 于 2015-1-22 10:36 编辑

    相关下载:

    获取网络(网卡)信息(iOS and Android)

    使用本地网络native networking on iOS
    守望者AIR技术交流社区(www.airmyth.com)
    回复 支持 反对

    使用道具 举报

  • TA的每日心情
    擦汗
    2018-4-10 15:18
  • 签到天数: 447 天

    [LV.9]以坛为家II

    1742

    主题

    2094

    帖子

    13万

    积分

    超级版主

    Rank: 18Rank: 18Rank: 18Rank: 18Rank: 18

    威望
    562
    贡献
    29
    金币
    52903
    钢镚
    1422

    开源英雄守望者

    板凳
     楼主| 发表于 2015-3-31 14:35:00 | 只看该作者
    Air Native Extension for iOS Device + Simuator – NetworkInfo (Universal/Fat binary)

    NetworkInfo is an Air native extension that allows AIR application developers, from ActionScript, to get information for each network interface.

    ActionScript already provides a NetworkInfo class that works on desktop and AIR for TV devices. This native extension provides a similar class so that AIR applications for iOS can also get information for each network interface
    This extension enables checking for the existence of an app to handle any specified URL within an Air project. The extension has a single command that checks for a URL handler.

    Note: This is an enhanced version of Adobe NetworkInfo implementaion to support running on iOS Simulator along with that it also has a ant build script to easily build in future

    Binary files

    The bin folder contains the compiled extension and the default swc, which can be used for local testing if required by your development environment (Flash Builder shouldn’t need it, but other IDEs may).

    Building

    Requirements – Adobe Air SDK 3.1 or later, XCode IDE, Java SDK, Apache Ant

    Mac_Terminal>cd build
    Mac_Terminal>ant all

    License

    Modified: GnanaPrakash
    Owner: Knobay Technologies
    http://www.knobay.com

    Copyright © 2015, Knobay Technologies Pvt Ltd.
    All rights reserved.

    Original:
    ADOBE SYSTEMS INCORPORATED
    Copyright 2011 Adobe Systems Incorporated
    All Rights Reserved.

    NOTICE: Adobe permits you to use, modify, and distribute this file in accordance with the
    terms of the Adobe license agreement accompanying it. If you have received this file from a
    source other than Adobe, then your use, modification, or distribution of it requires the prior
    written permission of Adobe.

    Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

    • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
    • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
    • Neither the name of Stick Sports Ltd. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.







    相关链接:



    https://github.com/CollabPlus/ANE-NetworkInfo


    本帖子中包含更多资源

    您需要 登录 才可以下载或查看,没有帐号?立即注册

    x
    守望者AIR技术交流社区(www.airmyth.com)
    回复 支持 反对

    使用道具 举报

    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    
    关闭

    站长推荐上一条 /4 下一条

    QQ|手机版|Archiver|网站地图|小黑屋|守望者 ( 京ICP备14061876号

    GMT+8, 2026-1-24 17:12 , Processed in 0.070330 second(s), 32 queries .

    守望者AIR

    守望者AIR技术交流社区

    本站成立于 2014年12月31日

    快速回复 返回顶部 返回列表