首先要指出,字段属性有notify的不能同时有read,write属性,别问哥,哥也不知道,反正我做的就不能notify,只能read,write。

分享的程序段第一字段有notify属性,第二字段read,write属性。

费话少说,看代码,H文件:

  1. #ifndef LOCKER_H
  2. #define LOCKER_H
  3.  
  4. #ifdef __cplusplus
  5. extern "C"
  6. {
  7. #endif
  8.  
  9. #define SERVAPP_NUM_ATTR_SUPPORTED (1+4+3)
  10.  
  11. // Simple Profile Service UUID
  12. #define LOCKERPROFILE_SERV_UUID 0xFFF0
  13.  
  14. #define LOCKERPROFILE_NOTIFY_UUID 0xFFF1
  15. #define LOCKERPROFILE_NOTIFY_MAX_LEN 5
  16.  
  17. #define LOCKERPROFILE_STREAM_UUID 0xFFF2
  18. #define LOCKERPROFILE_STREAM_MAX_LEN 5
  19.  
  20. #define SIMPLEPROFILE_SERVICE 0x00000001
  21. /*********************************************************************
  22. * Profile Callbacks
  23. */
  24. // Callback when a characteristic value has changed
  25. typedef void (*app_input_cb_t)( uint16 uuid ,uint8 *pdata, int len);
  26.  
  27. /*********************************************************************
  28. * lockerProfile_AddService- Initializes the Simple GATT Profile service by registering
  29. * GATT attributes with the GATT server.
  30. * @param services - services to add. This is a bit map and can contain more than one service.
  31. * @param cb - the function will be called, while service receive a message .
  32. * return always return SUCCESS
  33. */
  34. bStatus_t lockerProfile_AddService( uint32 services ,app_input_cb_t cb);
  35. /*
  36. * lockerProfile_AddService - Set a Simple GATT Profile parameter.
  37. * uuid - which service's uuid as sender target
  38. * len - length of data to right
  39. * value - pointer to data to write. This is dependent on
  40. * the parameter uuid and WILL be cast to the appropriate
  41. * data type .
  42. */
  43. bStatus_t locker_send( uint16 uuid,void *pdata , uint8 len);
  44. /*
  45. * locker_Read - Get a Simple GATT Profile parameter by uuid.
  46. * param - Profile uuid
  47. * value - pointer to data to write. This is dependent on
  48. * the parameter ID and WILL be cast to the appropriate
  49. * data type .
  50. * return : return data length, if op' failse it'll return -1;
  51. */
  52. int locker_Read( uint16 uuid, void *pdata );
  53.  
  54. #ifdef __cplusplus
  55. }
  56. #endif
  57.  
  58. #endif /* SIMPLEGATTPROFILE_H */

  C文件:

  1. /*********************************************************************
  2. * INCLUDES
  3. */
  4. #include "bcomdef.h"
  5. #include "OSAL.h"
  6. #include "linkdb.h"
  7. #include "att.h"
  8. #include "gatt.h"
  9. #include "gatt_uuid.h"
  10. #include "gattservapp.h"
  11. #include "gapbondmgr.h"
  12.  
  13. #include "locker.h"
  14. #include "stdio.h"
  15.  
  16. /*********************************************************************
  17. * GLOBAL VARIABLES
  18. */
  19. // Simple GATT Profile Service UUID: 0xFFF0
  20. CONST uint8 lockerSvrUUID[ATT_BT_UUID_SIZE] =
  21. {
  22. LO_UINT16(LOCKERPROFILE_SERV_UUID),
  23. HI_UINT16(LOCKERPROFILE_SERV_UUID)
  24. };
  25. // notify UUID: 0xFFF1
  26. CONST uint8 lockerNotifyUUID[ATT_BT_UUID_SIZE] =
  27. {
  28. LO_UINT16(LOCKERPROFILE_NOTIFY_UUID),
  29. HI_UINT16(LOCKERPROFILE_NOTIFY_UUID)
  30. };
  31. // stream UUID: 0xFFF2
  32. CONST uint8 lockerStreamUUID[ATT_BT_UUID_SIZE] =
  33. {
  34. LO_UINT16(LOCKERPROFILE_STREAM_UUID),
  35. HI_UINT16(LOCKERPROFILE_STREAM_UUID)
  36. };
  37. /*********************************************************************
  38. * LOCAL VARIABLES
  39. */
  40. static app_input_cb_t app_input_cb = NULL;
  41. /*********************************************************************
  42. * Profile Attributes - variables
  43. */
  44. // locker Profile Service attribute
  45. static CONST gattAttrType_t lockerProfileService = { ATT_BT_UUID_SIZE, lockerSvrUUID };
  46.  
  47. // locker Profile Notify Properties
  48. static uint8 lockerNotifyProps = GATT_PROP_NOTIFY;
  49. static uint8 lockerNotifyStream[LOCKERPROFILE_NOTIFY_MAX_LEN];
  50. static uint8 lockerNotifyDesp[17] = "notify\0";
  51. static gattCharCfg_t lockerNotifyConfig[GATT_MAX_NUM_CONN];
  52.  
  53. // locker Profile Stream Properties
  54. static uint8 lockerStreamProps = GATT_PROP_READ | GATT_PROP_WRITE;
  55. static uint8 lockerStream[LOCKERPROFILE_STREAM_MAX_LEN];
  56. static uint8 lockerStreamDesp[17] = "stream\0";
  57. /*********************************************************************
  58. * Profile Attributes - Table
  59. */
  60.  
  61. static gattAttribute_t LockerProfileAttrTbl[SERVAPP_NUM_ATTR_SUPPORTED] =
  62. {
  63. // Simple Profile Service
  64. {
  65. { ATT_BT_UUID_SIZE, primaryServiceUUID }, /* type */
  66. GATT_PERMIT_READ, /* permissions */
  67. 0, /* handle */
  68. (uint8 *)&lockerProfileService /* pValue */
  69. },
  70. /**************notify attribute**********************/
  71. // notify Declaration
  72. {
  73. { ATT_BT_UUID_SIZE, characterUUID },
  74. GATT_PERMIT_READ,
  75. 0,
  76. &lockerNotifyProps
  77. },
  78. // notify stream buffer
  79. {
  80. { ATT_BT_UUID_SIZE, lockerNotifyUUID },
  81. 0,
  82. 0,
  83. lockerNotifyStream
  84. },
  85. // notify stream configuration
  86. {
  87. { ATT_BT_UUID_SIZE, clientCharCfgUUID },
  88. GATT_PERMIT_READ | GATT_PERMIT_WRITE,
  89. 0,
  90. (uint8 *)lockerNotifyConfig
  91. },
  92. // notify stream Description
  93. {
  94. { ATT_BT_UUID_SIZE, charUserDescUUID },
  95. GATT_PERMIT_READ,
  96. 0,
  97. lockerNotifyDesp
  98. },
  99. /************************stream buffer attribute***********************/
  100. // stream Declaration
  101. {
  102. { ATT_BT_UUID_SIZE, characterUUID },
  103. GATT_PERMIT_READ,
  104. 0,
  105. &lockerStreamProps
  106. },
  107. // stream buffer
  108. {
  109. { ATT_BT_UUID_SIZE, lockerStreamUUID },
  110. GATT_PERMIT_READ | GATT_PERMIT_WRITE,
  111. 0,
  112. lockerStream
  113. },
  114. // stream Description
  115. {
  116. { ATT_BT_UUID_SIZE, charUserDescUUID },
  117. GATT_PERMIT_READ,
  118. 0,
  119. lockerStreamDesp
  120. },
  121. };
  122.  
  123. /*********************************************************************
  124. * LOCAL FUNCTIONS
  125. */
  126. static uint8 lockerReadAttrCB( uint16 connHandle, gattAttribute_t *pAttr,
  127. uint8 *pValue, uint8 *pLen, uint16 offset, uint8 maxLen );
  128. static bStatus_t lockerWriteAttrCB( uint16 connHandle, gattAttribute_t *pAttr,
  129. uint8 *pValue, uint8 len, uint16 offset );
  130.  
  131. static void lockerHandleConnStatusCB( uint16 connHandle, uint8 changeType );
  132.  
  133. /*********************************************************************
  134. * PROFILE CALLBACKS
  135. */
  136. // Simple Profile Service Callbacks
  137. CONST gattServiceCBs_t lockerProfileCBs =
  138. {
  139. lockerReadAttrCB, // Read callback function pointer
  140. lockerWriteAttrCB, // Write callback function pointer
  141. NULL // Authorization callback function pointer
  142. };
  143.  
  144. bStatus_t lockerProfile_AddService( uint32 services ,app_input_cb_t cb)
  145. {
  146. uint8 status = SUCCESS;
  147. printf("lockerProfile_AddService: \n");
  148. // Initialize Client Characteristic Configuration attributes
  149. GATTServApp_InitCharCfg( INVALID_CONNHANDLE, lockerNotifyConfig );
  150. // Register with Link DB to receive link status change callback
  151. VOID linkDB_Register( lockerHandleConnStatusCB );
  152. if ( services & SIMPLEPROFILE_SERVICE )
  153. {
  154. // Register GATT attribute list and CBs with GATT Server App
  155. status = GATTServApp_RegisterService( LockerProfileAttrTbl,
  156. GATT_NUM_ATTRS( LockerProfileAttrTbl ),
  157. &lockerProfileCBs );
  158. }
  159. app_input_cb = cb;
  160. return ( status );
  161. }
  162. bStatus_t locker_send( uint16 uuid,void *pdata , uint8 len)
  163. {
  164. bStatus_t ret = SUCCESS;
  165.  
  166. switch ( uuid )
  167. {
  168. case LOCKERPROFILE_NOTIFY_UUID:
  169. if ( len <= LOCKERPROFILE_NOTIFY_MAX_LEN)
  170. {
  171. printf("locker_send: uuid:%04x notify app \n",uuid);
  172. osal_memcpy(lockerNotifyStream,pdata,len);
  173. GATTServApp_ProcessCharCfg(lockerNotifyConfig,lockerNotifyStream, FALSE,
  174. LockerProfileAttrTbl, GATT_NUM_ATTRS( LockerProfileAttrTbl ),
  175. INVALID_TASK_ID );
  176. }
  177. else
  178. {
  179. ret = bleInvalidRange;
  180. }
  181. break;
  182. case LOCKERPROFILE_STREAM_UUID:
  183. if ( len <= LOCKERPROFILE_STREAM_MAX_LEN)
  184. {
  185. printf("locker_Send: uuid:%04x write to stream buffer and waite to read \n",uuid);
  186. osal_memcpy(lockerStream,pdata,len);
  187. }
  188. else
  189. {
  190. ret = bleInvalidRange;
  191. }
  192. default:
  193. ret = INVALIDPARAMETER;
  194. break;
  195. }
  196. return ( ret );
  197. }
  198.  
  199. int locker_Read( uint16 uuid, void *pdata )
  200. {
  201. int ret;
  202. printf("locker_Read: uuid:%04x \n",uuid);
  203. switch ( uuid )
  204. {
  205. case LOCKERPROFILE_NOTIFY_UUID:
  206. osal_memcpy(pdata,lockerNotifyStream,LOCKERPROFILE_NOTIFY_MAX_LEN);
  207. ret = LOCKERPROFILE_NOTIFY_MAX_LEN;
  208. break;
  209. case LOCKERPROFILE_STREAM_UUID:
  210. osal_memcpy(pdata,lockerStream,LOCKERPROFILE_STREAM_MAX_LEN);
  211. ret = LOCKERPROFILE_NOTIFY_MAX_LEN;
  212. break;
  213. default:
  214. ret = -1;
  215. break;
  216. }
  217. return ( ret );
  218. }
  219.  
  220. static uint8 lockerReadAttrCB( uint16 connHandle, gattAttribute_t *pAttr,
  221. uint8 *pValue, uint8 *pLen, uint16 offset, uint8 maxLen )
  222. {
  223. bStatus_t status = SUCCESS;
  224.  
  225. // If attribute permissions require authorization to read, return error
  226. if ( gattPermitAuthorRead( pAttr->permissions ) )
  227. {
  228. // Insufficient authorization
  229. return ( ATT_ERR_INSUFFICIENT_AUTHOR );
  230. }
  231.  
  232. // Make sure it's not a blob operation (no attributes in the profile are long)
  233. if ( offset > 0 )
  234. {
  235. return ( ATT_ERR_ATTR_NOT_LONG );
  236. }
  237.  
  238. if ( pAttr->type.len == ATT_BT_UUID_SIZE )
  239. {
  240. // 16-bit UUID
  241. uint16 uuid = BUILD_UINT16( pAttr->type.uuid[0], pAttr->type.uuid[1]);
  242. printf("lockerProfile_ReadAttrCB: uuid:%04x \n",uuid);
  243. switch ( uuid )
  244. {
  245. // No need for "GATT_SERVICE_UUID" or "GATT_CLIENT_CHAR_CFG_UUID" cases;
  246. // gattserverapp handles those reads
  247. // characteristics 1 and 2 have read permissions
  248. // can be sent as a notification, it is included here
  249. case LOCKERPROFILE_NOTIFY_UUID:
  250. *pLen = LOCKERPROFILE_NOTIFY_MAX_LEN;
  251. osal_memcpy(pValue,pAttr->pValue,LOCKERPROFILE_NOTIFY_MAX_LEN);
  252. break;
  253. case LOCKERPROFILE_STREAM_UUID:
  254. *pLen = LOCKERPROFILE_STREAM_MAX_LEN;
  255. osal_memcpy(pValue,pAttr->pValue,LOCKERPROFILE_STREAM_MAX_LEN);
  256. break;
  257. default:
  258. // Should never get here! (characteristics 3 and 4 do not have read permissions)
  259. *pLen = 0;
  260. status = ATT_ERR_ATTR_NOT_FOUND;
  261. break;
  262. }
  263. }
  264. else
  265. {
  266. // 128-bit UUID
  267. *pLen = 0;
  268. status = ATT_ERR_INVALID_HANDLE;
  269. }
  270.  
  271. return ( status );
  272. }
  273.  
  274. static bStatus_t lockerWriteAttrCB( uint16 connHandle, gattAttribute_t *pAttr,
  275. uint8 *pValue, uint8 len, uint16 offset )
  276. {
  277. bStatus_t status = SUCCESS;
  278. // If attribute permissions require authorization to write, return error
  279. if ( gattPermitAuthorWrite( pAttr->permissions ) )
  280. {
  281. // Insufficient authorization
  282. return ( ATT_ERR_INSUFFICIENT_AUTHOR );
  283. }
  284.  
  285. if ( pAttr->type.len == ATT_BT_UUID_SIZE )
  286. {
  287. // 16-bit UUID
  288. uint16 uuid = BUILD_UINT16( pAttr->type.uuid[0], pAttr->type.uuid[1]);
  289. printf("lockerProfile_WriteAttrCB: uuid:%04x \n",uuid);
  290. switch ( uuid )
  291. {
  292. case LOCKERPROFILE_NOTIFY_UUID:
  293. status = ATT_ERR_INVALID_HANDLE;
  294. //Write the value
  295. break;
  296. case LOCKERPROFILE_STREAM_UUID:
  297. if((offset==0)&(app_input_cb!=NULL))
  298. {
  299. if(len<=LOCKERPROFILE_STREAM_MAX_LEN)
  300. osal_memcpy(lockerStream,pValue,len);
  301. app_input_cb(LOCKERPROFILE_STREAM_UUID,pValue,len);
  302. }
  303. break;
  304. case GATT_CLIENT_CHAR_CFG_UUID:
  305. status = GATTServApp_ProcessCCCWriteReq( connHandle, pAttr, pValue, len,
  306. offset, GATT_CLIENT_CFG_NOTIFY );
  307. break;
  308. default:
  309. // Should never get here! (characteristics 2 and 4 do not have write permissions)
  310. status = ATT_ERR_ATTR_NOT_FOUND;
  311. break;
  312. }
  313. }
  314. else
  315. {
  316. // 128-bit UUID
  317. status = ATT_ERR_INVALID_HANDLE;
  318. }
  319. return ( status );
  320. }
  321. static void lockerHandleConnStatusCB( uint16 connHandle, uint8 changeType )
  322. {
  323. // Make sure this is not loopback connection
  324. if ( connHandle != LOOPBACK_CONNHANDLE )
  325. {
  326. // Reset Client Char Config if connection has dropped
  327. if ( ( changeType == LINKDB_STATUS_UPDATE_REMOVED ) ||
  328. ( ( changeType == LINKDB_STATUS_UPDATE_STATEFLAGS ) &&
  329. ( !linkDB_Up( connHandle ) ) ) )
  330. {
  331. printf("lockerProfile_HandleConnStatusCB: Reset Client Char Config if connection has dropped \n");
  332. GATTServApp_InitCharCfg( connHandle, lockerNotifyConfig );
  333. }
  334. }
  335. }
  336.  
  337. /*********************************************************************
  338. *********************************************************************/

  在simpleBLEPeripheral.c下增加input函数用于接收数据:

  1. void input(uint16 uuid, uint8 *pdata , int len)
  2. {
  3. int i;
  4. printf("input from uuid: %04x len:%d data:",uuid,len);
  5. for(i=0;i<len;i++)
  6. printf("%02x ",pdata[i]);
  7. printf("\n");
  8. }

  初始化时:

  1. void SimpleBLEPeripheral_Init( uint8 task_id )
  2. {
  3. simpleBLEPeripheral_TaskID = task_id;
  4.  
  5. // Setup the GAP
  6. VOID GAP_SetParamValue( TGAP_CONN_PAUSE_PERIPHERAL, DEFAULT_CONN_PAUSE_PERIPHERAL );
  7.  
  8. // Setup the GAP Peripheral Role Profile
  9. {
  10. uint8 initial_advertising_enable = TRUE;
  11. // By setting this to zero, the device will go into the waiting state after
  12. // being discoverable for 30.72 second, and will not being advertising again
  13. // until the enabler is set back to TRUE
  14. uint16 gapRole_AdvertOffTime = 0;
  15.  
  16. uint8 enable_update_request = DEFAULT_ENABLE_UPDATE_REQUEST;
  17. uint16 desired_min_interval = DEFAULT_DESIRED_MIN_CONN_INTERVAL;
  18. uint16 desired_max_interval = DEFAULT_DESIRED_MAX_CONN_INTERVAL;
  19. uint16 desired_slave_latency = DEFAULT_DESIRED_SLAVE_LATENCY;
  20. uint16 desired_conn_timeout = DEFAULT_DESIRED_CONN_TIMEOUT;
  21.  
  22. // Set the GAP Role Parameters
  23. GAPRole_SetParameter( GAPROLE_ADVERT_ENABLED, sizeof( uint8 ), &initial_advertising_enable );
  24. GAPRole_SetParameter( GAPROLE_ADVERT_OFF_TIME, sizeof( uint16 ), &gapRole_AdvertOffTime );
  25.  
  26. GAPRole_SetParameter( GAPROLE_SCAN_RSP_DATA, sizeof ( scanRspData ), scanRspData );
  27. GAPRole_SetParameter( GAPROLE_ADVERT_DATA, sizeof( advertData ), advertData );
  28.  
  29. GAPRole_SetParameter( GAPROLE_PARAM_UPDATE_ENABLE, sizeof( uint8 ), &enable_update_request );
  30. GAPRole_SetParameter( GAPROLE_MIN_CONN_INTERVAL, sizeof( uint16 ), &desired_min_interval );
  31. GAPRole_SetParameter( GAPROLE_MAX_CONN_INTERVAL, sizeof( uint16 ), &desired_max_interval );
  32. GAPRole_SetParameter( GAPROLE_SLAVE_LATENCY, sizeof( uint16 ), &desired_slave_latency );
  33. GAPRole_SetParameter( GAPROLE_TIMEOUT_MULTIPLIER, sizeof( uint16 ), &desired_conn_timeout );
  34. }
  35.  
  36. // Set the GAP Characteristics
  37. GGS_SetParameter( GGS_DEVICE_NAME_ATT, GAP_DEVICE_NAME_LEN, attDeviceName );
  38.  
  39. // Set advertising interval
  40. {
  41. uint16 advInt = DEFAULT_ADVERTISING_INTERVAL;
  42.  
  43. GAP_SetParamValue( TGAP_LIM_DISC_ADV_INT_MIN, advInt );
  44. GAP_SetParamValue( TGAP_LIM_DISC_ADV_INT_MAX, advInt );
  45. GAP_SetParamValue( TGAP_GEN_DISC_ADV_INT_MIN, advInt );
  46. GAP_SetParamValue( TGAP_GEN_DISC_ADV_INT_MAX, advInt );
  47. }
  48.  
  49. // Setup the GAP Bond Manager
  50. {
  51. uint32 passkey = 0; // passkey "000000"
  52. uint8 pairMode = GAPBOND_PAIRING_MODE_WAIT_FOR_REQ;
  53. uint8 mitm = TRUE;
  54. uint8 ioCap = GAPBOND_IO_CAP_DISPLAY_ONLY;
  55. uint8 bonding = TRUE;
  56. GAPBondMgr_SetParameter( GAPBOND_DEFAULT_PASSCODE, sizeof ( uint32 ), &passkey );
  57. GAPBondMgr_SetParameter( GAPBOND_PAIRING_MODE, sizeof ( uint8 ), &pairMode );
  58. GAPBondMgr_SetParameter( GAPBOND_MITM_PROTECTION, sizeof ( uint8 ), &mitm );
  59. GAPBondMgr_SetParameter( GAPBOND_IO_CAPABILITIES, sizeof ( uint8 ), &ioCap );
  60. GAPBondMgr_SetParameter( GAPBOND_BONDING_ENABLED, sizeof ( uint8 ), &bonding );
  61. }
  62.  
  63. // Initialize GATT attributes
  64. GGS_AddService( GATT_ALL_SERVICES ); // GAP
  65. GATTServApp_AddService( GATT_ALL_SERVICES ); // GATT attributes
  66. DevInfo_AddService(); // Device Information Service
  67. lockerProfile_AddService( GATT_ALL_SERVICES,input); // Simple GATT Profile
  68.  
  69. // Register for all key events - This app will handle all key events
  70. RegisterForKeys( simpleBLEPeripheral_TaskID );
  71. // Enable clock divide on halt
  72. // This reduces active current while radio is active and CC254x MCU
  73. // is halted
  74. HCI_EXT_ClkDivOnHaltCmd( HCI_EXT_ENABLE_CLK_DIVIDE_ON_HALT );
  75.  
  76. // Setup a delayed profile startup
  77. osal_set_event( simpleBLEPeripheral_TaskID, SBP_START_DEVICE_EVT );
  78.  
  79. }

  good luck!!我的已经工作的,你的呢?

CC2540自己的配置文件的更多相关文章

  1. 蓝牙协议 基于TI cc2540 模块的理解(转)

    源:蓝牙协议 基于TI cc2540 模块的理解 Bluetooth 4.0开发 Platform:TI IC:cc2540 Environment:windows 7 tools:IAR 8.20. ...

  2. Ti CC2540蓝牙模块学习笔记整理

    接触CC2540几天,终于有了初步的理解,现将笔记整理如下,只是皮毛,如有错误,还请指正,还有好多没闹明白的地方,以后应该还会继续向里面更新~ 一.整体 1.TI的蓝牙平台支持2种协议栈/应用配置:单 ...

  3. .Net Core MVC 网站开发(Ninesky) 2.3、项目架构调整(续)-使用配置文件动态注入

    上次实现了依赖注入,但是web项目必须要引用业务逻辑层和数据存储层的实现,项目解耦并不完全:另一方面,要同时注入业务逻辑层和数据访问层,注入的服务直接写在Startup中显得非常臃肿.理想的方式是,w ...

  4. ASP.NET MVC5+EF6+EasyUI 后台管理系统(64)-补充WebApi与Unity注入-配置文件

    系列目录 上一篇演示了WebApi利用Unity注入 很多人问我如何用配置文件来配置注入,本节演示如何利用配置文件来注入,道理是一样的,跳转到上一节下载源码一起来动手! 1.打开源码定位到文件Depe ...

  5. Spring配置文件标签报错:The prefix "XXX" for element "XXX:XXX" is not bound. .

    例如:The prefix "context" for element "context:annotation-config" is not bound. 这种 ...

  6. nginx服务器安装及配置文件详解

    nginx在工作中已经有好几个环境在使用了,每次都是重新去网上扒博客,各种编译配置,今天自己也整理一份安装文档和nginx.conf配置选项的说明,留作以后参考.像负载均衡配置(包括健康检查).缓存( ...

  7. C#开发中使用配置文件对象简化配置的本地保存

    C#开发中使用配置文件对象简化配置的本地保存 0x00 起因 程序的核心是数据和逻辑,开发过程中免不了要对操作的数据进行设置,而有些数据在程序执行过程中被用户或程序做出的修改是应该保存下来的,这样程序 ...

  8. 使用T4模板生成不同部署环境下的配置文件

    在开发企业级应用的时候,通常会有不同的开发环境,比如有开发环境,测试环境,正式环境,生产环境等.在一份代码部署到不同环境的时候,不同环境的配置文件可能需要根据目标环境不同而不同.比如在开发环境中,数据 ...

  9. 配置文件Java读写

    今天把配置文件的Bug修复了,总结一下Java配置文件如何读写 配置文件的格式 以.properties后缀结尾,内容不出现空格和双引号 //config.properties Driver=com. ...

随机推荐

  1. c# Entity DbArithmeticExpression arguments must have a numeric common type

    在Entity Lambda表达式中计算DateTime类型的时候 不能直接用DateTime类型进行相减计算差值 需要使用DbFunctions提供的一些方法. 例如: DbFunctions.Di ...

  2. Beta版本冲刺第七天

    Aruba 408 409 410 428 429 431 完成任务: 新增:完成文字导出为图片并改善画布大小 改进:适应MIUI系统相册选图 改进:调整activity间的跳转逻辑 改进:调整编辑窗 ...

  3. 2016第七季极客大挑战Writeup

    第一次接触CTF,只会做杂项和一点点Web题--因为时间比较仓促,写的比较简略.以后再写下工具使用什么的. 纯新手,啥都不会.处于瑟瑟发抖的状态. 一.MISC 1.签到题 直接填入题目所给的SYC{ ...

  4. ubuntu修改163软件源

    cd /etc/apt cat sources.list sudo su root sudo echo '' > sources.list nano sources.list 复制163软件源 ...

  5. ionic ios iframe 白屏

    之前碰到一个问题: 在ios下边使用iframe出现白屏问题 android下边正常 原因是ios对app打开外部网页有限制需要取消限制 解决方法 1.确认添加whitelist 插件 2.在conf ...

  6. Android studio 软件板块

  7. IntelliJ IDEA mac 快捷键

    cmd+O 查找类alt+cmd+O 符号shift+cmd+O 查找文件^+space 补全alt + F7 查找符号的使用情况F1 查看文档cmd+b 跳转定义,或者 鼠标+ctrlcmd+F12 ...

  8. 仿淘宝分页按钮效果简单美观易使用的JS分页控件

    分页按钮思想:  1.少于9页,全部显示  2.大于9页,1.2页显示,中间页码当前页为中心,前后各留两个页码  附件中有完整例子的压缩包下载.已更新到最新版本  先看效果图:  01输入框焦点效果  ...

  9. 1. web前端开发分享-css,js入门篇

    关注前端这么多年,没有大的成就,就入门期间积累了不少技巧与心得,跟大家分享一下,不一定都适合每个人,毕竟人与人的教育背景与成长环境心理活动都有差别,但就别人的心得再结合自己的特点,然后探索适合自己的学 ...

  10. chrome谷歌浏览器插件制作简易教程

    1.在磁盘上创建一个目录,用来放应用的代码和资源 2.在这个目录中,创建一个文本文件,命名为manifest.json,其内容为: { "manifest_version": 2, ...